The Free Software Media System - Server Backend & API
Add setting to auto-run web app when server starts
Luke Pulverenti8717f81bf406
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex abc6c35666..26450c06ca 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -148,6 +148,34 @@ namespace Emby.Server.Implementations}}+ public virtual bool CanLaunchWebBrowser+ {+ get+ {+ if (!Environment.UserInteractive)+ {+ return false;+ }++ if (StartupOptions.ContainsOption("-service"))+ {+ return false;+ }++ if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.Windows)+ {+ return true;+ }++ if (EnvironmentInfo.OperatingSystem == MediaBrowser.Model.System.OperatingSystem.OSX)+ {+ return true;+ }++ return false;+ }+ }+/// <summary>/// Occurs when [has pending restart changed]./// </summary>@@ -1936,6 +1964,7 @@ namespace Emby.Server.ImplementationsOperatingSystemDisplayName = OperatingSystemDisplayName,CanSelfRestart = CanSelfRestart,CanSelfUpdate = CanSelfUpdate,+ CanLaunchWebBrowser = CanLaunchWebBrowser,WanAddress = ConnectManager.WanApiAddress,HasUpdateAvailable = HasUpdateAvailable,SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,@@ -2358,13 +2387,7 @@ namespace Emby.Server.Implementationspublic virtual void LaunchUrl(string url){- if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&- EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX)- {- throw new NotSupportedException();- }-- if (!Environment.UserInteractive)+ if (!CanLaunchWebBrowser){throw new NotSupportedException();}diff --git a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs b/Emby.Server.Implementations/EntryPoints/StartupWizard.csindex 746edf9e7b..103b4b321e 100644--- a/Emby.Server.Implementations/EntryPoints/StartupWizard.cs+++ b/Emby.Server.Implementations/EntryPoints/StartupWizard.cs@@ -35,15 +35,20 @@ namespace Emby.Server.Implementations.EntryPoints/// </summary>public void Run(){+ if (!_appHost.CanLaunchWebBrowser)+ {+ return;+ }+if (_appHost.IsFirstRun){BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);}- else if (_config.Configuration.IsStartupWizardCompleted)+ else if (_config.Configuration.IsStartupWizardCompleted && _config.Configuration.AutoRunWebApp){var options = ((ApplicationHost)_appHost).StartupOptions;- if (!options.ContainsOption("-service") && !options.ContainsOption("-nobrowser"))+ if (!options.ContainsOption("-noautorunwebapp")){BrowserLauncher.OpenDashboardPage("index.html", _appHost);}diff --git a/MediaBrowser.Api/StartupWizardService.cs b/MediaBrowser.Api/StartupWizardService.csindex 54e4657c11..c6345c17f4 100644--- a/MediaBrowser.Api/StartupWizardService.cs+++ b/MediaBrowser.Api/StartupWizardService.cs@@ -67,6 +67,7 @@ namespace MediaBrowser.Apipublic void Post(ReportStartupWizardComplete request){_config.Configuration.IsStartupWizardCompleted = true;+ _config.Configuration.AutoRunWebApp = true;_config.SetOptimalValues();_config.SaveConfiguration();diff --git a/MediaBrowser.Controller/IServerApplicationHost.cs b/MediaBrowser.Controller/IServerApplicationHost.csindex 89ae85b508..3f7f8248b5 100644--- a/MediaBrowser.Controller/IServerApplicationHost.cs+++ b/MediaBrowser.Controller/IServerApplicationHost.cs@@ -29,7 +29,9 @@ namespace MediaBrowser.Controller/// </summary>/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>bool SupportsAutoRunAtStartup { get; }-++ bool CanLaunchWebBrowser { get; }+/// <summary>/// Gets the HTTP server port./// </summary>diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex f2c3b7cc8a..41ed0648a6 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -61,6 +61,8 @@ namespace MediaBrowser.Model.Configuration/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>public bool IsPortAuthorized { get; set; }+ public bool AutoRunWebApp { get; set; }+/// <summary>/// Gets or sets a value indicating whether [enable case sensitive item ids]./// </summary>diff --git a/MediaBrowser.Model/System/SystemInfo.cs b/MediaBrowser.Model/System/SystemInfo.csindex b61d637293..9ed0f904f0 100644--- a/MediaBrowser.Model/System/SystemInfo.cs+++ b/MediaBrowser.Model/System/SystemInfo.cs@@ -68,6 +68,8 @@ namespace MediaBrowser.Model.System/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>public bool CanSelfUpdate { get; set; }+ public bool CanLaunchWebBrowser { get; set; }+/// <summary>/// Gets or sets plugin assemblies that failed to load./// </summary>