From 900266eb54e3b13219eb21e6d22fb34ce28059ab Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 1 Oct 2013 11:16:38 -0400 Subject: [PATCH] implemented shutdown button --- MediaBrowser.ServerApplication/ApplicationHost.cs | 12 ++---------- MediaBrowser.WebDashboard/ApiClient.js | 13 +++++++++++++ MediaBrowser.WebDashboard/packages.config | 2 +- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs index 365e81bae..b54ca6e34 100644 --- a/MediaBrowser.ServerApplication/ApplicationHost.cs +++ b/MediaBrowser.ServerApplication/ApplicationHost.cs @@ -647,16 +647,8 @@ namespace MediaBrowser.ServerApplication { var availablePackages = await InstallationManager.GetAvailablePackagesWithoutRegistrationInfo(cancellationToken).ConfigureAwait(false); - var package = availablePackages.FirstOrDefault(p => p.name.Equals(Constants.MbServerPkgName, StringComparison.OrdinalIgnoreCase)); - - if (package == null) - { - return null; - } - - var version = package.versions - .OrderByDescending(v => v.version) - .FirstOrDefault(v => v.classification <= ConfigurationManager.CommonConfiguration.SystemUpdateLevel); + var version = InstallationManager.GetLatestCompatibleVersion(availablePackages, Constants.MbServerPkgName, ApplicationVersion, + ConfigurationManager.CommonConfiguration.SystemUpdateLevel); return version != null ? new CheckForUpdateResult { AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version } : new CheckForUpdateResult { AvailableVersion = ApplicationVersion, IsUpdateAvailable = false }; diff --git a/MediaBrowser.WebDashboard/ApiClient.js b/MediaBrowser.WebDashboard/ApiClient.js index 3200f25c4..0ef566fbf 100644 --- a/MediaBrowser.WebDashboard/ApiClient.js +++ b/MediaBrowser.WebDashboard/ApiClient.js @@ -700,6 +700,19 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi }); }; + /** + * Instructs the server to perform a shutdown. + */ + self.shutdownServer = function () { + + var url = self.getUrl("System/Shutdown"); + + return self.ajax({ + type: "POST", + url: url + }); + }; + /** * Gets information about an installable package */ diff --git a/MediaBrowser.WebDashboard/packages.config b/MediaBrowser.WebDashboard/packages.config index 3c4413345..3e9d96452 100644 --- a/MediaBrowser.WebDashboard/packages.config +++ b/MediaBrowser.WebDashboard/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file