Skip to content

Commit

Permalink
Update for 3.5.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nvllsvm committed Jul 22, 2018
1 parent ea85b72 commit a7a681b
Show file tree
Hide file tree
Showing 2 changed files with 1,559 additions and 796 deletions.
243 changes: 125 additions & 118 deletions patches/PluginSecurityManager.cs.patch
Original file line number Diff line number Diff line change
@@ -1,119 +1,126 @@
*** PluginSecurityManager.cs 2018-05-02 14:25:12.000000000 -0400
--- PluginSecurityManager.cs.new 2018-05-03 00:12:35.076641948 -0400
*************** namespace Emby.Server.Implementations.Se
*** 176,178 ****
{
- throw new PaymentRequiredException();
}
--- 176,177 ----
*************** namespace Emby.Server.Implementations.Se
*** 207,295 ****
{
- 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 = regInfo != null && nextCheckDate >= DateTime.UtcNow && expDate >= DateTime.UtcNow,
- expDate = expDate
- };
-
- var key = SupporterKey;
-
- var success = reg.registered;
-
- if (!(lastChecked > DateTime.UtcNow.AddDays(-1)) || (!reg.registered))
- {
- var data = new Dictionary<string, string>
- {
- { "feature", feature },
- { "key", key },
- { "mac", _appHost.SystemId },
- { "systemid", _appHost.SystemId },
- { "ver", version },
- { "platform", _appHost.OperatingSystemDisplayName }
- };
-
- try
- {
- var options = new HttpRequestOptions
- {
- Url = MBValidateUrl,
-
- // Seeing block length errors
- EnableHttpCompression = false,
- BufferContent = false
- };
-
- options.SetPostData(data);
-
- using (var response = (await _httpClient.Post(options).ConfigureAwait(false)))
- {
- using (var json = response.Content)
- {
- reg = _jsonSerializer.DeserializeFromStream<RegRecord>(json);
- success = true;
- }
- }
-
- if (reg.registered)
- {
- _logger.Info("Registered for feature {0}", feature);
- LicenseFile.AddRegCheck(feature, reg.expDate);
- }
- else
- {
- _logger.Info("Not registered for feature {0}", feature);
- LicenseFile.RemoveRegCheck(feature);
- }
-
- }
- catch (Exception e)
- {
- _logger.ErrorException("Error checking registration status of {0}", e, feature);
- }
- }
-
var record = new MBRegistrationRecord
{
! IsRegistered = reg.registered,
! ExpirationDate = reg.expDate,
RegChecked = true,
! RegError = !success
};

- record.TrialVersion = IsInTrial(reg.expDate, record.RegChecked, record.IsRegistered);
- record.IsValid = !record.RegChecked || record.IsRegistered || record.TrialVersion;
-
return record;
--- 206,216 ----
{
var record = new MBRegistrationRecord
{
! IsRegistered = true,
RegChecked = true,
! TrialVersion = false,
! IsValid = true,
! RegError = false
};

return record;
*************** namespace Emby.Server.Implementations.Se
*** 310,311 ****
}
! }
--- a 2018-07-21 23:40:59.763170429 -0400
+++ b 2018-07-21 23:40:56.679819085 -0400
@@ -188,109 +188,14 @@

private async Task<MBRegistrationRecord> GetRegistrationStatusInternal(string feature, bool forceCallToServer, string version, CancellationToken cancellationToken)
{
- await _regCheckLock.WaitAsync(cancellationToken).ConfigureAwait(false);
-
- try
- {
- 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 = regInfo != null && nextCheckDate >= DateTime.UtcNow && expDate >= DateTime.UtcNow,
- expDate = expDate
- };
-
- var key = SupporterKey;
-
- if (!forceCallToServer && string.IsNullOrWhiteSpace(key))
- {
- return new MBRegistrationRecord();
- }
-
- var success = reg.registered;
-
- if (!(lastChecked > DateTime.UtcNow.AddDays(-1)) || (!reg.registered))
- {
- var data = new Dictionary<string, string>
- {
- { "feature", feature },
- { "key", key },
- { "mac", _appHost.SystemId },
- { "systemid", _appHost.SystemId },
- { "ver", version },
- { "platform", _appHost.OperatingSystemDisplayName }
- };
-
- try
- {
- var options = new HttpRequestOptions
- {
- Url = MBValidateUrl,
-
- // Seeing block length errors
- EnableHttpCompression = false,
- BufferContent = false,
- CancellationToken = cancellationToken
- };
-
- options.SetPostData(data);
-
- using (var response = (await _httpClient.Post(options).ConfigureAwait(false)))
- {
- using (var json = response.Content)
- {
- reg = await _jsonSerializer.DeserializeFromStreamAsync<RegRecord>(json).ConfigureAwait(false);
- success = true;
- }
- }
-
- if (reg.registered)
- {
- _logger.Info("Registered for feature {0}", feature);
- LicenseFile.AddRegCheck(feature, reg.expDate);
- }
- else
- {
- _logger.Info("Not registered for feature {0}", feature);
- LicenseFile.RemoveRegCheck(feature);
- }
-
- }
- catch (Exception e)
- {
- _logger.ErrorException("Error checking registration status of {0}", e, feature);
- }
- }
-
- var record = new MBRegistrationRecord
- {
- IsRegistered = reg.registered,
- ExpirationDate = reg.expDate,
- RegChecked = true,
- RegError = !success
- };
-
- record.TrialVersion = IsInTrial(reg.expDate, record.RegChecked, record.IsRegistered);
- record.IsValid = !record.RegChecked || record.IsRegistered || record.TrialVersion;
-
- return record;
- }
- finally
+ return new MBRegistrationRecord
{
- _regCheckLock.Release();
- }
+ IsRegistered = true,
+ RegChecked = true,
+ RegError = false,
+ TrialVersion = false,
+ IsValid = true
+ };
}

private bool IsInTrial(DateTime expirationDate, bool regChecked, bool isRegistered)
@@ -306,4 +211,4 @@
return isInTrial && !isRegistered;
}
}
-}
\ No newline at end of file
--- 231,232 ----
}
! }
+}
Loading

0 comments on commit a7a681b

Please sign in to comment.