diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs index 698d7e47fb..a45b11e269 100644 --- a/MediaBrowser.Api/PackageService.cs +++ b/MediaBrowser.Api/PackageService.cs @@ -123,10 +123,7 @@ namespace MediaBrowser.Api if (updateCheckResult.IsUpdateAvailable) { - result.Add(new PackageVersionInfo - { - versionStr = updateCheckResult.AvailableVersion.ToString() - }); + result.Add(updateCheckResult.Package); } } diff --git a/MediaBrowser.Common/Constants/Constants.cs b/MediaBrowser.Common/Constants/Constants.cs index e8a347829b..676518737d 100644 --- a/MediaBrowser.Common/Constants/Constants.cs +++ b/MediaBrowser.Common/Constants/Constants.cs @@ -8,6 +8,6 @@ namespace MediaBrowser.Common.Constants { public static class Constants { - public const string MBAdminUrl = "http://mb3admin.com/admin/"; + public const string MBAdminUrl = "http://www.mb3admin.com/admin/"; } } diff --git a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs index 48c0b398c1..c9bc2d6b9d 100644 --- a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs +++ b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs @@ -17,6 +17,15 @@ namespace MediaBrowser.Model.Updates /// Gets or sets the available version. /// /// The available version. - public Version AvailableVersion { get; set; } + public Version AvailableVersion + { + get { return Package != null ? Package.version : new Version(0, 0); } + set { } // need this for the serializer + } + + /// + /// Get or sets package information for an available update + /// + public PackageVersionInfo Package { get; set; } } } diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 5ba0485edf..d4b19e8723 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -1,4 +1,5 @@ -using BDInfo; +using System.Security; +using BDInfo; using MediaBrowser.ClickOnce; using MediaBrowser.Common.Implementations; using MediaBrowser.Common.Implementations.HttpClientManager; @@ -13,6 +14,8 @@ using MediaBrowser.Common.IO; using MediaBrowser.Common.Kernel; using MediaBrowser.Common.Net; using MediaBrowser.Common.ScheduledTasks; +using MediaBrowser.Common.Security; +using MediaBrowser.Common.Updates; using MediaBrowser.Controller; using MediaBrowser.Controller.Library; using MediaBrowser.IsoMounter; @@ -145,7 +148,7 @@ namespace MediaBrowser.ServerApplication /// true if this instance can self update; otherwise, false. public bool CanSelfUpdate { - get { return ClickOnceHelper.IsNetworkDeployed; } + get { return true; } } /// @@ -154,10 +157,14 @@ namespace MediaBrowser.ServerApplication /// The cancellation token. /// The progress. /// Task{CheckForUpdateResult}. - public Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) + public async Task CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress progress) { - // Get package manager using Resolve() - return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress); + var pkgManager = Resolve(); + var availablePackages = await pkgManager.GetAvailablePackages(Resolve(), Resolve(), Kernel.SecurityManager, Kernel.ResourcePools, Resolve(), CancellationToken.None).ConfigureAwait(false); + var version = Kernel.InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", Kernel.Configuration.SystemUpdateLevel); + + return version != null ? new CheckForUpdateResult {AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version} : + new CheckForUpdateResult(); } ///