aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-12-03 17:14:35 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-12-03 17:14:35 -0500
commit8717f81bf406fb4f78adf117fd380f37bd6a98fc (patch)
tree57054284972548f6990bb5df5905857c4eef34a3 /Emby.Server.Implementations
parent70b0dd968fc381faacbf2207e3a5364d793bd98e (diff)
Add setting to auto-run web app when server starts
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs37
-rw-r--r--Emby.Server.Implementations/EntryPoints/StartupWizard.cs9
2 files changed, 37 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index abc6c3566..26450c06c 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.Implementations
OperatingSystemDisplayName = OperatingSystemDisplayName,
CanSelfRestart = CanSelfRestart,
CanSelfUpdate = CanSelfUpdate,
+ CanLaunchWebBrowser = CanLaunchWebBrowser,
WanAddress = ConnectManager.WanApiAddress,
HasUpdateAvailable = HasUpdateAvailable,
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
@@ -2358,13 +2387,7 @@ namespace Emby.Server.Implementations
public 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.cs
index 746edf9e7..103b4b321 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);
}