Add setting to auto-run web app when server starts
This commit is contained in:
parent
70b0dd968f
commit
8717f81bf4
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ namespace MediaBrowser.Api
|
|||
public void Post(ReportStartupWizardComplete request)
|
||||
{
|
||||
_config.Configuration.IsStartupWizardCompleted = true;
|
||||
_config.Configuration.AutoRunWebApp = true;
|
||||
_config.SetOptimalValues();
|
||||
_config.SaveConfiguration();
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in New Issue
Block a user