diff options
Diffstat (limited to 'Emby.Server.Implementations/Security/PluginSecurityManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/Security/PluginSecurityManager.cs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Security/PluginSecurityManager.cs b/Emby.Server.Implementations/Security/PluginSecurityManager.cs index 61d4f5252..f21259137 100644 --- a/Emby.Server.Implementations/Security/PluginSecurityManager.cs +++ b/Emby.Server.Implementations/Security/PluginSecurityManager.cs @@ -245,18 +245,29 @@ 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 >= DateTime.UtcNow, + expDate = expDate }; var success = reg.registered; - if (!(lastChecked > DateTime.UtcNow.AddDays(-1))) + if (!(lastChecked > DateTime.UtcNow.AddDays(-1)) || !reg.registered) { var data = new Dictionary<string, string> { @@ -291,7 +302,7 @@ namespace Emby.Server.Implementations.Security if (reg.registered) { - LicenseFile.AddRegCheck(feature); + LicenseFile.AddRegCheck(feature, reg.expDate); } else { |
