From cc19ce0daf3edb46d1acffdf2af98787cc9f7f5a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 11 Nov 2015 09:56:31 -0500 Subject: added new parent methods --- .../EntryPoints/UserDataChangeNotifier.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs index 008363ca4..b059e4144 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UserDataChangeNotifier.cs @@ -74,7 +74,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints // Go up one level for indicators if (baseItem != null) { - var parent = baseItem.Parent; + var parent = baseItem.GetParent(); if (parent != null) { -- cgit v1.2.3 From 7f7d6cddcc97904f9923e9878d22b60d4f8e8d2c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 30 Dec 2015 02:11:58 -0500 Subject: add serverId to the log --- .../EntryPoints/UsageEntryPoint.cs | 4 ++-- .../EntryPoints/UsageReporter.cs | 13 +++++++++++-- MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs index f9a141da3..c3b9c0d4d 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs @@ -66,7 +66,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints { try { - await new UsageReporter(_applicationHost, _httpClient, _userManager) + await new UsageReporter(_applicationHost, _httpClient, _userManager, _logger) .ReportAppUsage(client, CancellationToken.None) .ConfigureAwait(false); } @@ -108,7 +108,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints { try { - await new UsageReporter(_applicationHost, _httpClient, _userManager) + await new UsageReporter(_applicationHost, _httpClient, _userManager, _logger) .ReportServerUsage(CancellationToken.None) .ConfigureAwait(false); } diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs index 77dd54a80..5496bd9b2 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs @@ -8,6 +8,7 @@ using System.Globalization; using System.Linq; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Model.Logging; namespace MediaBrowser.Server.Implementations.EntryPoints { @@ -16,13 +17,15 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private readonly IApplicationHost _applicationHost; private readonly IHttpClient _httpClient; private readonly IUserManager _userManager; + private readonly ILogger _logger; private const string MbAdminUrl = "http://www.mb3admin.com/admin/"; - public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager) + public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager, ILogger logger) { _applicationHost = applicationHost; _httpClient = httpClient; _userManager = userManager; + _logger = logger; } public Task ReportServerUsage(CancellationToken cancellationToken) @@ -47,7 +50,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints data["linkedusers"] = users.Count(i => i.ConnectLinkType.HasValue && i.ConnectLinkType.Value == UserLinkType.LinkedUser).ToString(CultureInfo.InvariantCulture); data["plugins"] = string.Join(",", _applicationHost.Plugins.Select(i => i.Id).ToArray()); - + return _httpClient.Post(MbAdminUrl + "service/registration/ping", data, cancellationToken); } @@ -58,6 +61,12 @@ namespace MediaBrowser.Server.Implementations.EntryPoints throw new ArgumentException("Client info must have a device Id"); } + _logger.Info("App Activity: app: {0}, version: {1}, deviceId: {2}, deviceName: {3}", + app.AppName ?? "Unknown App", + app.AppVersion ?? "Unknown", + app.DeviceId, + app.DeviceName ?? "Unknown"); + cancellationToken.ThrowIfCancellationRequested(); var data = new Dictionary diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 8680cff61..2bc01ebe1 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -321,6 +321,7 @@ namespace MediaBrowser.Server.Startup.Common { await base.RunStartupTasks().ConfigureAwait(false); + Logger.Info("ServerId: {0}", SystemId); Logger.Info("Core startup complete"); HttpServer.GlobalResponse = null; -- cgit v1.2.3 From 821e8246872cfa380249bca2f79ea810f27c87d5 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 2 Jan 2016 16:54:37 -0500 Subject: better caching of remote data --- MediaBrowser.Api/System/SystemService.cs | 13 -- .../Security/PluginSecurityManager.cs | 60 --------- .../Updates/InstallationManager.cs | 103 ++++++++++---- MediaBrowser.Common/Security/ISecurityManager.cs | 6 - .../MediaBrowser.Model.Portable.csproj | 3 - .../MediaBrowser.Model.net35.csproj | 3 - MediaBrowser.Model/Entities/SupporterInfo.cs | 15 --- MediaBrowser.Model/MediaBrowser.Model.csproj | 1 - .../Connect/ConnectEntryPoint.cs | 3 +- .../Connect/ConnectManager.cs | 15 --- .../EntryPoints/LoadRegistrations.cs | 2 +- .../Notifications/RemoteNotifications.cs | 148 --------------------- .../MediaBrowser.Server.Implementations.csproj | 1 - 13 files changed, 79 insertions(+), 294 deletions(-) delete mode 100644 MediaBrowser.Model/Entities/SupporterInfo.cs delete mode 100644 MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Api/System/SystemService.cs b/MediaBrowser.Api/System/SystemService.cs index 539b920a7..9b6b6a7d6 100644 --- a/MediaBrowser.Api/System/SystemService.cs +++ b/MediaBrowser.Api/System/SystemService.cs @@ -78,12 +78,6 @@ namespace MediaBrowser.Api.System public string Name { get; set; } } - [Route("/System/SupporterInfo", "GET")] - [Authenticated] - public class GetSupporterInfo : IReturn - { - } - /// /// Class SystemInfoService /// @@ -116,13 +110,6 @@ namespace MediaBrowser.Api.System _security = security; } - public async Task Get(GetSupporterInfo request) - { - var result = await _security.GetSupporterInfo().ConfigureAwait(false); - - return ToOptimizedResult(result); - } - public object Post(PingSystem request) { return _appHost.Name; diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index e796dba76..d8f350207 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -153,66 +153,6 @@ namespace MediaBrowser.Common.Implementations.Security } } - public async Task GetSupporterInfo() - { - var key = SupporterKey; - - if (string.IsNullOrWhiteSpace(key)) - { - return new SupporterInfo(); - } - - var data = new Dictionary - { - { "key", key }, - }; - - var url = MbAdmin.HttpsUrl + "/service/supporter/retrieve"; - - using (var stream = await _httpClient.Post(url, data, CancellationToken.None).ConfigureAwait(false)) - { - var response = _jsonSerializer.DeserializeFromStream(stream); - - var info = new SupporterInfo - { - Email = response.email, - PlanType = response.planType, - SupporterKey = response.supporterKey, - IsActiveSupporter = IsMBSupporter - }; - - if (!string.IsNullOrWhiteSpace(response.expDate)) - { - DateTime parsedDate; - if (DateTime.TryParse(response.expDate, out parsedDate)) - { - info.ExpirationDate = parsedDate; - } - else - { - _logger.Error("Failed to parse expDate: {0}", response.expDate); - } - } - - if (!string.IsNullOrWhiteSpace(response.regDate)) - { - DateTime parsedDate; - if (DateTime.TryParse(response.regDate, out parsedDate)) - { - info.RegistrationDate = parsedDate; - } - else - { - _logger.Error("Failed to parse regDate: {0}", response.regDate); - } - } - - info.IsExpiredSupporter = info.ExpirationDate.HasValue && info.ExpirationDate < DateTime.UtcNow && !string.IsNullOrWhiteSpace(info.SupporterKey); - - return info; - } - } - /// /// Register an app store sale with our back-end. It will validate the transaction with the store /// and then register the proper feature and then fill in the supporter key on success. diff --git a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs index dc642a0a8..014275331 100644 --- a/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs +++ b/MediaBrowser.Common.Implementations/Updates/InstallationManager.cs @@ -185,7 +185,7 @@ namespace MediaBrowser.Common.Implementations.Updates } } - private Tuple, DateTime> _lastPackageListResult; + private DateTime _lastPackageUpdateTime; /// /// Gets all available packages. @@ -194,40 +194,89 @@ namespace MediaBrowser.Common.Implementations.Updates /// Task{List{PackageInfo}}. public async Task> GetAvailablePackagesWithoutRegistrationInfo(CancellationToken cancellationToken) { - if (_lastPackageListResult != null) + using (var stream = await GetCachedPackages(cancellationToken).ConfigureAwait(false)) { - TimeSpan cacheLength; + var packages = _jsonSerializer.DeserializeFromStream>(stream).ToList(); - switch (_config.CommonConfiguration.SystemUpdateLevel) + if ((DateTime.UtcNow - _lastPackageUpdateTime) > GetCacheLength()) { - case PackageVersionClass.Beta: - cacheLength = TimeSpan.FromMinutes(30); - break; - case PackageVersionClass.Dev: - cacheLength = TimeSpan.FromMinutes(3); - break; - default: - cacheLength = TimeSpan.FromHours(24); - break; + UpdateCachedPackages(CancellationToken.None, false); } - if ((DateTime.UtcNow - _lastPackageListResult.Item2) < cacheLength) - { - return _lastPackageListResult.Item1; - } + return packages; } + } - using (var json = await _httpClient.Get(MbAdmin.HttpUrl + "service/MB3Packages.json", cancellationToken).ConfigureAwait(false)) + private string PackageCachePath + { + get { return Path.Combine(_appPaths.CachePath, "serverpackages.json"); } + } + + private async Task GetCachedPackages(CancellationToken cancellationToken) + { + try + { + return _fileSystem.OpenRead(PackageCachePath); + } + catch (Exception) { - cancellationToken.ThrowIfCancellationRequested(); - var packages = _jsonSerializer.DeserializeFromStream>(json).ToList(); + } - packages = FilterPackages(packages).ToList(); + await UpdateCachedPackages(cancellationToken, true).ConfigureAwait(false); + return _fileSystem.OpenRead(PackageCachePath); + } + + private readonly SemaphoreSlim _updateSemaphore = new SemaphoreSlim(1, 1); + private async Task UpdateCachedPackages(CancellationToken cancellationToken, bool throwErrors) + { + await _updateSemaphore.WaitAsync(cancellationToken).ConfigureAwait(false); - _lastPackageListResult = new Tuple, DateTime>(packages, DateTime.UtcNow); + try + { + if ((DateTime.UtcNow - _lastPackageUpdateTime) < GetCacheLength()) + { + return; + } - return _lastPackageListResult.Item1; + var tempFile = await _httpClient.GetTempFile(new HttpRequestOptions + { + Url = MbAdmin.HttpUrl + "service/MB3Packages.json", + CancellationToken = cancellationToken, + Progress = new Progress() + + }).ConfigureAwait(false); + + _fileSystem.CreateDirectory(Path.GetDirectoryName(PackageCachePath)); + + _fileSystem.CopyFile(tempFile, PackageCachePath, true); + _lastPackageUpdateTime = DateTime.UtcNow; + } + catch (Exception ex) + { + _logger.ErrorException("Error updating package cache", ex); + + if (throwErrors) + { + throw; + } + } + finally + { + _updateSemaphore.Release(); + } + } + + private TimeSpan GetCacheLength() + { + switch (_config.CommonConfiguration.SystemUpdateLevel) + { + case PackageVersionClass.Beta: + return TimeSpan.FromMinutes(30); + case PackageVersionClass.Dev: + return TimeSpan.FromMinutes(3); + default: + return TimeSpan.FromHours(24); } } @@ -554,7 +603,7 @@ namespace MediaBrowser.Common.Implementations.Updates if (packageChecksum != Guid.Empty) // support for legacy uploads for now { using (var crypto = new MD5CryptoServiceProvider()) - using (var stream = new BufferedStream(_fileSystem.OpenRead(tempFile), 100000)) + using (var stream = new BufferedStream(_fileSystem.OpenRead(tempFile), 100000)) { var check = Guid.Parse(BitConverter.ToString(crypto.ComputeHash(stream)).Replace("-", String.Empty)); if (check != packageChecksum) @@ -569,12 +618,12 @@ namespace MediaBrowser.Common.Implementations.Updates // Success - move it to the real target try { - _fileSystem.CreateDirectory(Path.GetDirectoryName(target)); - _fileSystem.CopyFile(tempFile, target, true); + _fileSystem.CreateDirectory(Path.GetDirectoryName(target)); + _fileSystem.CopyFile(tempFile, target, true); //If it is an archive - write out a version file so we know what it is if (isArchive) { - File.WriteAllText(target + ".ver", package.versionStr); + File.WriteAllText(target + ".ver", package.versionStr); } } catch (IOException e) diff --git a/MediaBrowser.Common/Security/ISecurityManager.cs b/MediaBrowser.Common/Security/ISecurityManager.cs index 729de911b..0d8934a62 100644 --- a/MediaBrowser.Common/Security/ISecurityManager.cs +++ b/MediaBrowser.Common/Security/ISecurityManager.cs @@ -41,12 +41,6 @@ namespace MediaBrowser.Common.Security /// Task LoadAllRegistrationInfo(); - /// - /// Gets the supporter information. - /// - /// Task<SupporterInfo>. - Task GetSupporterInfo(); - /// /// Register and app store sale with our back-end /// diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index 40e532b79..6145983e2 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -608,9 +608,6 @@ Entities\SortOrder.cs - - Entities\SupporterInfo.cs - Entities\TrailerType.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 09a7cde9d..435c4f50b 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -573,9 +573,6 @@ Entities\SortOrder.cs - - Entities\SupporterInfo.cs - Entities\TrailerType.cs diff --git a/MediaBrowser.Model/Entities/SupporterInfo.cs b/MediaBrowser.Model/Entities/SupporterInfo.cs deleted file mode 100644 index 233d5615f..000000000 --- a/MediaBrowser.Model/Entities/SupporterInfo.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace MediaBrowser.Model.Entities -{ - public class SupporterInfo - { - public string Email { get; set; } - public string SupporterKey { get; set; } - public DateTime? ExpirationDate { get; set; } - public DateTime RegistrationDate { get; set; } - public string PlanType { get; set; } - public bool IsActiveSupporter { get; set; } - public bool IsExpiredSupporter { get; set; } - } -} \ No newline at end of file diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 1386854bb..3664175d8 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -144,7 +144,6 @@ - diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 9ad04ebbd..af81b4eea 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -10,6 +10,7 @@ using System.IO; using System.Net; using System.Text; using System.Threading; +using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common.IO; @@ -40,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.Connect public void Run() { - LoadCachedAddress(); + Task.Run(() => LoadCachedAddress()); _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); } diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs index f1de09d56..fdc7e9ee2 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs @@ -1073,11 +1073,6 @@ namespace MediaBrowser.Server.Implementations.Connect public async Task GetConnectSupporterSummary() { - if (!_securityManager.IsMBSupporter) - { - return new ConnectSupporterSummary(); - } - var url = GetConnectUrl("keyAssociation"); var options = new HttpRequestOptions @@ -1106,11 +1101,6 @@ namespace MediaBrowser.Server.Implementations.Connect public async Task AddConnectSupporter(string id) { - if (!_securityManager.IsMBSupporter) - { - throw new InvalidOperationException(); - } - var url = GetConnectUrl("keyAssociation"); var options = new HttpRequestOptions @@ -1139,11 +1129,6 @@ namespace MediaBrowser.Server.Implementations.Connect public async Task RemoveConnectSupporter(string id) { - if (!_securityManager.IsMBSupporter) - { - throw new InvalidOperationException(); - } - var url = GetConnectUrl("keyAssociation"); var options = new HttpRequestOptions diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs index 27170ced9..701cf21fb 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs @@ -41,7 +41,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// public void Run() { - _timer = new Timer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(24)); + _timer = new Timer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(12)); } private async Task LoadAllRegistrations() diff --git a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs b/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs deleted file mode 100644 index 9a20505a5..000000000 --- a/MediaBrowser.Server.Implementations/EntryPoints/Notifications/RemoteNotifications.cs +++ /dev/null @@ -1,148 +0,0 @@ -using MediaBrowser.Common.Configuration; -using MediaBrowser.Common.IO; -using MediaBrowser.Common.Net; -using MediaBrowser.Controller.Library; -using MediaBrowser.Controller.Notifications; -using MediaBrowser.Controller.Plugins; -using MediaBrowser.Model.Logging; -using MediaBrowser.Model.Notifications; -using MediaBrowser.Model.Serialization; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using CommonIO; - -namespace MediaBrowser.Server.Implementations.EntryPoints.Notifications -{ - public class RemoteNotifications : IServerEntryPoint - { - private const string Url = "http://www.mb3admin.com/admin/service/MB3ServerNotifications.json"; - - private Timer _timer; - private readonly IHttpClient _httpClient; - private readonly IApplicationPaths _appPaths; - private readonly ILogger _logger; - private readonly IJsonSerializer _json; - private readonly IUserManager _userManager; - private readonly IFileSystem _fileSystem; - - private readonly TimeSpan _frequency = TimeSpan.FromHours(6); - private readonly TimeSpan _maxAge = TimeSpan.FromDays(31); - - private readonly INotificationManager _notificationManager; - - public RemoteNotifications(IApplicationPaths appPaths, ILogger logger, IHttpClient httpClient, IJsonSerializer json, IUserManager userManager, IFileSystem fileSystem, INotificationManager notificationManager) - { - _appPaths = appPaths; - _logger = logger; - _httpClient = httpClient; - _json = json; - _userManager = userManager; - _fileSystem = fileSystem; - _notificationManager = notificationManager; - } - - /// - /// Runs this instance. - /// - public void Run() - { - _timer = new Timer(OnTimerFired, null, TimeSpan.FromMilliseconds(500), _frequency); - } - - /// - /// Called when [timer fired]. - /// - /// The state. - private async void OnTimerFired(object state) - { - var dataPath = Path.Combine(_appPaths.DataPath, "remotenotifications.json"); - - var lastRunTime = _fileSystem.FileExists(dataPath) ? _fileSystem.GetLastWriteTimeUtc(dataPath) : DateTime.MinValue; - - try - { - await DownloadNotifications(dataPath, lastRunTime).ConfigureAwait(false); - } - catch (Exception ex) - { - _logger.ErrorException("Error downloading remote notifications", ex); - } - } - - /// - /// Downloads the notifications. - /// - /// The data path. - /// The last run time. - /// Task. - private async Task DownloadNotifications(string dataPath, DateTime lastRunTime) - { - using (var stream = await _httpClient.Get(new HttpRequestOptions - { - Url = Url - - }).ConfigureAwait(false)) - { - var notifications = _json.DeserializeFromStream(stream); - - _fileSystem.WriteAllText(dataPath, string.Empty); - - await CreateNotifications(notifications, lastRunTime).ConfigureAwait(false); - } - } - - /// - /// Creates the notifications. - /// - /// The notifications. - /// The last run time. - /// Task. - private async Task CreateNotifications(IEnumerable notifications, DateTime lastRunTime) - { - // Only show notifications that are active, new since last download, and not older than max age - var notificationList = notifications - .Where(i => string.Equals(i.active, "1") && i.date.ToUniversalTime() > lastRunTime && (DateTime.UtcNow - i.date.ToUniversalTime()) <= _maxAge) - .ToList(); - - var userIds = _userManager.Users.Select(i => i.Id.ToString("N")).ToList(); - - foreach (var notification in notificationList) - { - await _notificationManager.SendNotification(new NotificationRequest - { - Date = notification.date, - Name = notification.name, - Description = notification.description, - Url = notification.url, - UserIds = userIds - - }, CancellationToken.None).ConfigureAwait(false); - } - } - - public void Dispose() - { - if (_timer != null) - { - _timer.Dispose(); - _timer = null; - } - } - - private class RemoteNotification - { - public string id { get; set; } - public DateTime date { get; set; } - public string name { get; set; } - public string description { get; set; } - public string category { get; set; } - public string url { get; set; } - public object imageUrl { get; set; } - public string active { get; set; } - } - } -} diff --git a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj index bec2abdc4..52adae14c 100644 --- a/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj +++ b/MediaBrowser.Server.Implementations/MediaBrowser.Server.Implementations.csproj @@ -131,7 +131,6 @@ - -- cgit v1.2.3 From 9044750efd0ce98578dc863b67a5b6e9a11e16b2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 23 Jan 2016 13:21:35 -0500 Subject: update http compression --- .../Connect/ConnectEntryPoint.cs | 5 ++- .../EntryPoints/UsageReporter.cs | 36 +++++++++++++++++++--- 2 files changed, 36 insertions(+), 5 deletions(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index af81b4eea..6dab136a5 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -66,7 +66,10 @@ namespace MediaBrowser.Server.Implementations.Connect { Url = ipLookupUrl, UserAgent = "Emby/" + _appHost.ApplicationVersion, - LogErrors = logErrors + LogErrors = logErrors, + + // Seeing block length errors with our server + EnableHttpCompression = false }).ConfigureAwait(false)) { diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs index 5496bd9b2..be2817fd2 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs @@ -28,7 +28,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints _logger = logger; } - public Task ReportServerUsage(CancellationToken cancellationToken) + public async Task ReportServerUsage(CancellationToken cancellationToken) { cancellationToken.ThrowIfCancellationRequested(); @@ -51,10 +51,24 @@ namespace MediaBrowser.Server.Implementations.EntryPoints data["plugins"] = string.Join(",", _applicationHost.Plugins.Select(i => i.Id).ToArray()); - return _httpClient.Post(MbAdminUrl + "service/registration/ping", data, cancellationToken); + var options = new HttpRequestOptions + { + Url = MbAdminUrl + "service/registration/ping", + CancellationToken = cancellationToken, + + // Seeing block length errors + EnableHttpCompression = false + }; + + options.SetPostData(data); + + using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)) + { + + } } - public Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken) + public async Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken) { if (string.IsNullOrWhiteSpace(app.DeviceId)) { @@ -79,7 +93,21 @@ namespace MediaBrowser.Server.Implementations.EntryPoints { "platform", app.DeviceName }, }; - return _httpClient.Post(MbAdminUrl + "service/registration/ping", data, cancellationToken); + var options = new HttpRequestOptions + { + Url = MbAdminUrl + "service/registration/ping", + CancellationToken = cancellationToken, + + // Seeing block length errors + EnableHttpCompression = false + }; + + options.SetPostData(data); + + using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false)) + { + + } } } -- cgit v1.2.3 From 3510ef3d2beb810c87f8f3d52f95b95110e574d0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 28 Jan 2016 22:40:21 -0500 Subject: reduce use of timers throughout the system --- .../Networking/BaseNetworkManager.cs | 15 ++--- MediaBrowser.Common/MediaBrowser.Common.csproj | 1 + MediaBrowser.Common/Threading/PeriodicTimer.cs | 67 ++++++++++++++++++++++ .../People/MovieDbPersonProvider.cs | 18 +++--- .../Channels/ChannelManager.cs | 61 +------------------- .../Connect/ConnectEntryPoint.cs | 5 +- .../EntryPoints/ExternalPortForwarding.cs | 5 +- .../EntryPoints/UsageEntryPoint.cs | 16 ++---- 8 files changed, 97 insertions(+), 91 deletions(-) create mode 100644 MediaBrowser.Common/Threading/PeriodicTimer.cs (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs index bc3dc360f..527a5fb3e 100644 --- a/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs +++ b/MediaBrowser.Common.Implementations/Networking/BaseNetworkManager.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; -using System.Threading; using MoreLinq; namespace MediaBrowser.Common.Implementations.Networking @@ -14,14 +13,11 @@ namespace MediaBrowser.Common.Implementations.Networking public abstract class BaseNetworkManager { protected ILogger Logger { get; private set; } - private Timer _clearCacheTimer; + private DateTime _lastRefresh; protected BaseNetworkManager(ILogger logger) { Logger = logger; - - // Can't use network change events due to a crash in Linux - _clearCacheTimer = new Timer(ClearCacheTimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(1)); } private void ClearCacheTimerCallback(object state) @@ -41,15 +37,20 @@ namespace MediaBrowser.Common.Implementations.Networking /// IPAddress. public IEnumerable GetLocalIpAddresses() { - if (_localIpAddresses == null) + var forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= 1; + + if (_localIpAddresses == null || forceRefresh) { lock (_localIpAddressSyncLock) { - if (_localIpAddresses == null) + forceRefresh = (DateTime.UtcNow - _lastRefresh).TotalMinutes >= 1; + + if (_localIpAddresses == null || forceRefresh) { var addresses = GetLocalIpAddressesInternal().ToList(); _localIpAddresses = addresses; + _lastRefresh = DateTime.UtcNow; return addresses; } diff --git a/MediaBrowser.Common/MediaBrowser.Common.csproj b/MediaBrowser.Common/MediaBrowser.Common.csproj index ccdb319fe..17f211d84 100644 --- a/MediaBrowser.Common/MediaBrowser.Common.csproj +++ b/MediaBrowser.Common/MediaBrowser.Common.csproj @@ -90,6 +90,7 @@ + diff --git a/MediaBrowser.Common/Threading/PeriodicTimer.cs b/MediaBrowser.Common/Threading/PeriodicTimer.cs new file mode 100644 index 000000000..cb562a80d --- /dev/null +++ b/MediaBrowser.Common/Threading/PeriodicTimer.cs @@ -0,0 +1,67 @@ +using System; +using System.Threading; +using Microsoft.Win32; + +namespace MediaBrowser.Common.Threading +{ + public class PeriodicTimer : IDisposable + { + public Action Callback { get; set; } + private Timer _timer; + private readonly object _state; + private readonly object _timerLock = new object(); + private readonly TimeSpan _period; + + public PeriodicTimer(Action callback, object state, TimeSpan dueTime, TimeSpan period) + { + Callback = callback; + _period = period; + _state = state; + + StartTimer(dueTime); + } + + void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) + { + if (e.Mode == PowerModes.Resume) + { + DisposeTimer(); + StartTimer(Timeout.InfiniteTimeSpan); + } + } + + private void TimerCallback(object state) + { + Callback(state); + } + + private void StartTimer(TimeSpan dueTime) + { + lock (_timerLock) + { + _timer = new Timer(TimerCallback, _state, dueTime, _period); + + SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; + } + } + + private void DisposeTimer() + { + SystemEvents.PowerModeChanged -= SystemEvents_PowerModeChanged; + + lock (_timerLock) + { + if (_timer != null) + { + _timer.Dispose(); + _timer = null; + } + } + } + + public void Dispose() + { + DisposeTimer(); + } + } +} diff --git a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs index 5c5919709..14304c2eb 100644 --- a/MediaBrowser.Providers/People/MovieDbPersonProvider.cs +++ b/MediaBrowser.Providers/People/MovieDbPersonProvider.cs @@ -38,7 +38,7 @@ namespace MediaBrowser.Providers.People private int _requestCount; private readonly object _requestCountLock = new object(); - private Timer _requestCountReset; + private DateTime _lastRequestCountReset; public MovieDbPersonProvider(IFileSystem fileSystem, IServerConfigurationManager configurationManager, IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogger logger) { @@ -48,16 +48,6 @@ namespace MediaBrowser.Providers.People _httpClient = httpClient; _logger = logger; Current = this; - - _requestCountReset = new Timer(OnRequestThrottleTimerFired, null, TimeSpan.FromHours(1), TimeSpan.FromHours(1)); - } - - private void OnRequestThrottleTimerFired(object state) - { - lock (_requestCountLock) - { - _requestCount = 0; - } } public string Name @@ -101,6 +91,12 @@ namespace MediaBrowser.Providers.People { lock (_requestCountLock) { + if ((DateTime.UtcNow - _lastRequestCountReset).TotalHours >= 1) + { + _requestCount = 0; + _lastRequestCountReset = DateTime.UtcNow; + } + var requestCount = _requestCount; if (requestCount >= 5) diff --git a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs index fe13d8cef..c7865b6aa 100644 --- a/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs +++ b/MediaBrowser.Server.Implementations/Channels/ChannelManager.cs @@ -29,7 +29,7 @@ using CommonIO; namespace MediaBrowser.Server.Implementations.Channels { - public class ChannelManager : IChannelManager, IDisposable + public class ChannelManager : IChannelManager { private IChannel[] _channels; @@ -47,11 +47,6 @@ namespace MediaBrowser.Server.Implementations.Channels private readonly ILocalizationManager _localization; private readonly ConcurrentDictionary _refreshedItems = new ConcurrentDictionary(); - private readonly ConcurrentDictionary _downloadCounts = new ConcurrentDictionary(); - - private Timer _refreshTimer; - private Timer _clearDownloadCountsTimer; - public ChannelManager(IUserManager userManager, IDtoService dtoService, ILibraryManager libraryManager, ILogger logger, IServerConfigurationManager config, IFileSystem fileSystem, IUserDataManager userDataManager, IJsonSerializer jsonSerializer, ILocalizationManager localization, IHttpClient httpClient, IProviderManager providerManager) { _userManager = userManager; @@ -65,9 +60,6 @@ namespace MediaBrowser.Server.Implementations.Channels _localization = localization; _httpClient = httpClient; _providerManager = providerManager; - - _refreshTimer = new Timer(s => _refreshedItems.Clear(), null, TimeSpan.FromHours(3), TimeSpan.FromHours(3)); - _clearDownloadCountsTimer = new Timer(s => _downloadCounts.Clear(), null, TimeSpan.FromHours(24), TimeSpan.FromHours(24)); } private TimeSpan CacheLength @@ -211,6 +203,8 @@ namespace MediaBrowser.Server.Implementations.Channels public async Task RefreshChannels(IProgress progress, CancellationToken cancellationToken) { + _refreshedItems.Clear(); + var allChannelsList = GetAllChannels().ToList(); var numComplete = 0; @@ -1487,12 +1481,6 @@ namespace MediaBrowser.Server.Implementations.Channels var limit = features.DailyDownloadLimit; - if (!ValidateDownloadLimit(host, limit)) - { - _logger.Error(string.Format("Download limit has been reached for {0}", channel.Name)); - throw new ChannelDownloadException(string.Format("Download limit has been reached for {0}", channel.Name)); - } - foreach (var header in source.RequiredHttpHeaders) { options.RequestHeaders[header.Key] = header.Value; @@ -1511,8 +1499,6 @@ namespace MediaBrowser.Server.Implementations.Channels }; } - IncrementDownloadCount(host, limit); - if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase) && response.ContentType.StartsWith("video/", StringComparison.OrdinalIgnoreCase)) { var extension = response.ContentType.Split('/') @@ -1547,46 +1533,5 @@ namespace MediaBrowser.Server.Implementations.Channels } } - - private void IncrementDownloadCount(string key, int? limit) - { - if (!limit.HasValue) - { - return; - } - - int current; - _downloadCounts.TryGetValue(key, out current); - - current++; - _downloadCounts.AddOrUpdate(key, current, (k, v) => current); - } - - private bool ValidateDownloadLimit(string key, int? limit) - { - if (!limit.HasValue) - { - return true; - } - - int current; - _downloadCounts.TryGetValue(key, out current); - - return current < limit.Value; - } - - public void Dispose() - { - if (_clearDownloadCountsTimer != null) - { - _clearDownloadCountsTimer.Dispose(); - _clearDownloadCountsTimer = null; - } - if (_refreshTimer != null) - { - _refreshTimer.Dispose(); - _refreshTimer = null; - } - } } } \ No newline at end of file diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs index 6dab136a5..0d6b8ac26 100644 --- a/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/Connect/ConnectEntryPoint.cs @@ -13,12 +13,13 @@ using System.Threading; using System.Threading.Tasks; using CommonIO; using MediaBrowser.Common.IO; +using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.Connect { public class ConnectEntryPoint : IServerEntryPoint { - private Timer _timer; + private PeriodicTimer _timer; private readonly IHttpClient _httpClient; private readonly IApplicationPaths _appPaths; private readonly ILogger _logger; @@ -43,7 +44,7 @@ namespace MediaBrowser.Server.Implementations.Connect { Task.Run(() => LoadCachedAddress()); - _timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); + _timer = new PeriodicTimer(null, new TimerCallback(TimerCallback), TimeSpan.FromSeconds(5), TimeSpan.FromHours(3)); } private readonly string[] _ipLookups = { "http://bot.whatismyipaddress.com", "https://connect.emby.media/service/ip" }; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs index a2ffa9aff..2b2c338dd 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/ExternalPortForwarding.cs @@ -11,6 +11,7 @@ using System.IO; using System.Net; using System.Text; using System.Threading; +using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.EntryPoints { @@ -21,7 +22,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private readonly IServerConfigurationManager _config; private readonly ISsdpHandler _ssdp; - private Timer _timer; + private PeriodicTimer _timer; private bool _isStarted; public ExternalPortForwarding(ILogManager logmanager, IServerApplicationHost appHost, IServerConfigurationManager config, ISsdpHandler ssdp) @@ -95,7 +96,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints NatUtility.UnhandledException += NatUtility_UnhandledException; NatUtility.StartDiscovery(); - _timer = new Timer(s => _createdRules = new List(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); + _timer = new PeriodicTimer(s => _createdRules = new List(), null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(5)); _ssdp.MessageReceived += _ssdp_MessageReceived; diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs index c3b9c0d4d..d8aef909b 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageEntryPoint.cs @@ -9,6 +9,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Threading; +using System.Threading.Tasks; namespace MediaBrowser.Server.Implementations.EntryPoints { @@ -23,7 +24,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private readonly ISessionManager _sessionManager; private readonly IUserManager _userManager; - private Timer _timer; private readonly TimeSpan _frequency = TimeSpan.FromHours(24); private readonly ConcurrentDictionary _apps = new ConcurrentDictionary(); @@ -95,16 +95,16 @@ namespace MediaBrowser.Server.Implementations.EntryPoints return info; } - public void Run() + public async void Run() { - _timer = new Timer(OnTimerFired, null, TimeSpan.FromMilliseconds(5000), _frequency); + await Task.Delay(5000).ConfigureAwait(false); + OnTimerFired(); } /// /// Called when [timer fired]. /// - /// The state. - private async void OnTimerFired(object state) + private async void OnTimerFired() { try { @@ -121,12 +121,6 @@ namespace MediaBrowser.Server.Implementations.EntryPoints public void Dispose() { _sessionManager.SessionStarted -= _sessionManager_SessionStarted; - - if (_timer != null) - { - _timer.Dispose(); - _timer = null; - } } } } -- cgit v1.2.3 From e20de8ffaddc1e1d61759442f53036abe4cfb100 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 29 Jan 2016 21:42:53 -0500 Subject: update timer --- MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs index 701cf21fb..efda36821 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/LoadRegistrations.cs @@ -4,6 +4,7 @@ using MediaBrowser.Model.Logging; using System; using System.Threading; using System.Threading.Tasks; +using MediaBrowser.Common.Threading; namespace MediaBrowser.Server.Implementations.EntryPoints { @@ -22,7 +23,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// private readonly ILogger _logger; - private Timer _timer; + private PeriodicTimer _timer; /// /// Initializes a new instance of the class. @@ -41,7 +42,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints /// public void Run() { - _timer = new Timer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(12)); + _timer = new PeriodicTimer(s => LoadAllRegistrations(), null, TimeSpan.FromMilliseconds(100), TimeSpan.FromHours(12)); } private async Task LoadAllRegistrations() -- cgit v1.2.3 From de39408217b249102e38b8ef604d1777c090d86b Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 9 Feb 2016 12:13:50 -0500 Subject: update person editor --- MediaBrowser.Api/PackageReviewService.cs | 2 +- MediaBrowser.Common.Implementations/Security/MbAdmin.cs | 4 ++-- MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs | 2 +- MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs | 2 +- MediaBrowser.Server.Startup.Common/ApplicationHost.cs | 4 ---- 5 files changed, 5 insertions(+), 9 deletions(-) (limited to 'MediaBrowser.Server.Implementations/EntryPoints') diff --git a/MediaBrowser.Api/PackageReviewService.cs b/MediaBrowser.Api/PackageReviewService.cs index b4656b83e..e70d6a713 100644 --- a/MediaBrowser.Api/PackageReviewService.cs +++ b/MediaBrowser.Api/PackageReviewService.cs @@ -102,7 +102,7 @@ namespace MediaBrowser.Api { private readonly IHttpClient _httpClient; private readonly IJsonSerializer _serializer; - private const string MbAdminUrl = "http://www.mb3admin.com/admin/"; + private const string MbAdminUrl = "https://www.mb3admin.com/admin/"; private readonly IServerApplicationHost _appHost; public PackageReviewService(IHttpClient httpClient, IJsonSerializer serializer, IServerApplicationHost appHost) diff --git a/MediaBrowser.Common.Implementations/Security/MbAdmin.cs b/MediaBrowser.Common.Implementations/Security/MbAdmin.cs index ab4a83257..76ff92c2e 100644 --- a/MediaBrowser.Common.Implementations/Security/MbAdmin.cs +++ b/MediaBrowser.Common.Implementations/Security/MbAdmin.cs @@ -3,11 +3,11 @@ namespace MediaBrowser.Common.Implementations.Security { public class MbAdmin { - public const string HttpUrl = "http://www.mb3admin.com/admin/"; + public const string HttpUrl = "https://www.mb3admin.com/admin/"; /// /// Leaving as http for now until we get it squared away /// - public const string HttpsUrl = "http://www.mb3admin.com/admin/"; + public const string HttpsUrl = "https://www.mb3admin.com/admin/"; } } diff --git a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs index a6dbf77e9..d751083f0 100644 --- a/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs +++ b/MediaBrowser.Common.Implementations/Security/PluginSecurityManager.cs @@ -21,7 +21,7 @@ namespace MediaBrowser.Common.Implementations.Security public class PluginSecurityManager : ISecurityManager { private const string MBValidateUrl = MbAdmin.HttpsUrl + "service/registration/validate"; - private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "http://mb3admin.com/admin/service/appstore/register"; + private const string AppstoreRegUrl = /*MbAdmin.HttpsUrl*/ "https://mb3admin.com/admin/service/appstore/register"; /// /// The _is MB supporter diff --git a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs index be2817fd2..47c754643 100644 --- a/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs +++ b/MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs @@ -18,7 +18,7 @@ namespace MediaBrowser.Server.Implementations.EntryPoints private readonly IHttpClient _httpClient; private readonly IUserManager _userManager; private readonly ILogger _logger; - private const string MbAdminUrl = "http://www.mb3admin.com/admin/"; + private const string MbAdminUrl = "https://www.mb3admin.com/admin/"; public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, IUserManager userManager, ILogger logger) { diff --git a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs index 36d15b95a..b17f10af3 100644 --- a/MediaBrowser.Server.Startup.Common/ApplicationHost.cs +++ b/MediaBrowser.Server.Startup.Common/ApplicationHost.cs @@ -984,10 +984,6 @@ namespace MediaBrowser.Server.Startup.Common { get { - if (!ServerConfigurationManager.Configuration.EnableAutoUpdate) - { - return false; - } #if DEBUG return false; #endif -- cgit v1.2.3