aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Security/PluginSecurityManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-12-01 13:23:47 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-12-01 13:23:47 -0500
commit77a6eafe154f2b5d1005c0dccffea6e3967635f1 (patch)
tree67165945fd4e0f16a9b3b4d2e2bc7eb67f4f2473 /Emby.Server.Implementations/Security/PluginSecurityManager.cs
parent3e9f65589907e1bf38f1c30848aa6a234bf33035 (diff)
update translations
Diffstat (limited to 'Emby.Server.Implementations/Security/PluginSecurityManager.cs')
-rw-r--r--Emby.Server.Implementations/Security/PluginSecurityManager.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/Security/PluginSecurityManager.cs b/Emby.Server.Implementations/Security/PluginSecurityManager.cs
index 61d4f5252..2a22d048c 100644
--- a/Emby.Server.Implementations/Security/PluginSecurityManager.cs
+++ b/Emby.Server.Implementations/Security/PluginSecurityManager.cs
@@ -245,13 +245,24 @@ namespace Emby.Server.Implementations.Security
string mb2Equivalent = null,
string version = null)
{
- var lastChecked = LicenseFile.LastChecked(feature);
+ var regInfo = LicenseFile.GetRegInfo(feature);
+ var lastChecked = regInfo == null ? DateTime.MinValue : regInfo.LastChecked;
+ var expDate = regInfo == null ? DateTime.MinValue : regInfo.ExpirationDate;
+
+ var maxCacheDays = 14;
+ var nextCheckDate = new [] { expDate, lastChecked.AddDays(maxCacheDays) }.Min();
+
+ if (nextCheckDate > DateTime.UtcNow.AddDays(maxCacheDays))
+ {
+ nextCheckDate = DateTime.MinValue;
+ }
//check the reg file first to alleviate strain on the MB admin server - must actually check in every 30 days tho
var reg = new RegRecord
{
// Cache the result for up to a week
- registered = lastChecked > DateTime.UtcNow.AddDays(-7)
+ registered = regInfo != null && nextCheckDate >= DateTime.UtcNow,
+ expDate = expDate
};
var success = reg.registered;
@@ -291,7 +302,7 @@ namespace Emby.Server.Implementations.Security
if (reg.registered)
{
- LicenseFile.AddRegCheck(feature);
+ LicenseFile.AddRegCheck(feature, reg.expDate);
}
else
{