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>
|
/// <summary>
|
||||||
/// Occurs when [has pending restart changed].
|
/// Occurs when [has pending restart changed].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1936,6 +1964,7 @@ namespace Emby.Server.Implementations
|
||||||
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
OperatingSystemDisplayName = OperatingSystemDisplayName,
|
||||||
CanSelfRestart = CanSelfRestart,
|
CanSelfRestart = CanSelfRestart,
|
||||||
CanSelfUpdate = CanSelfUpdate,
|
CanSelfUpdate = CanSelfUpdate,
|
||||||
|
CanLaunchWebBrowser = CanLaunchWebBrowser,
|
||||||
WanAddress = ConnectManager.WanApiAddress,
|
WanAddress = ConnectManager.WanApiAddress,
|
||||||
HasUpdateAvailable = HasUpdateAvailable,
|
HasUpdateAvailable = HasUpdateAvailable,
|
||||||
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
SupportsAutoRunAtStartup = SupportsAutoRunAtStartup,
|
||||||
|
@ -2358,13 +2387,7 @@ namespace Emby.Server.Implementations
|
||||||
|
|
||||||
public virtual void LaunchUrl(string url)
|
public virtual void LaunchUrl(string url)
|
||||||
{
|
{
|
||||||
if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows &&
|
if (!CanLaunchWebBrowser)
|
||||||
EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.OSX)
|
|
||||||
{
|
|
||||||
throw new NotSupportedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Environment.UserInteractive)
|
|
||||||
{
|
{
|
||||||
throw new NotSupportedException();
|
throw new NotSupportedException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,15 +35,20 @@ namespace Emby.Server.Implementations.EntryPoints
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
|
if (!_appHost.CanLaunchWebBrowser)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (_appHost.IsFirstRun)
|
if (_appHost.IsFirstRun)
|
||||||
{
|
{
|
||||||
BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
|
BrowserLauncher.OpenDashboardPage("wizardstart.html", _appHost);
|
||||||
}
|
}
|
||||||
else if (_config.Configuration.IsStartupWizardCompleted)
|
else if (_config.Configuration.IsStartupWizardCompleted && _config.Configuration.AutoRunWebApp)
|
||||||
{
|
{
|
||||||
var options = ((ApplicationHost)_appHost).StartupOptions;
|
var options = ((ApplicationHost)_appHost).StartupOptions;
|
||||||
|
|
||||||
if (!options.ContainsOption("-service") && !options.ContainsOption("-nobrowser"))
|
if (!options.ContainsOption("-noautorunwebapp"))
|
||||||
{
|
{
|
||||||
BrowserLauncher.OpenDashboardPage("index.html", _appHost);
|
BrowserLauncher.OpenDashboardPage("index.html", _appHost);
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ namespace MediaBrowser.Api
|
||||||
public void Post(ReportStartupWizardComplete request)
|
public void Post(ReportStartupWizardComplete request)
|
||||||
{
|
{
|
||||||
_config.Configuration.IsStartupWizardCompleted = true;
|
_config.Configuration.IsStartupWizardCompleted = true;
|
||||||
|
_config.Configuration.AutoRunWebApp = true;
|
||||||
_config.SetOptimalValues();
|
_config.SetOptimalValues();
|
||||||
_config.SaveConfiguration();
|
_config.SaveConfiguration();
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,8 @@ namespace MediaBrowser.Controller
|
||||||
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if [supports automatic run at startup]; otherwise, <c>false</c>.</value>
|
||||||
bool SupportsAutoRunAtStartup { get; }
|
bool SupportsAutoRunAtStartup { get; }
|
||||||
|
|
||||||
|
bool CanLaunchWebBrowser { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the HTTP server port.
|
/// Gets the HTTP server port.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -61,6 +61,8 @@ namespace MediaBrowser.Model.Configuration
|
||||||
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance is port authorized; otherwise, <c>false</c>.</value>
|
||||||
public bool IsPortAuthorized { get; set; }
|
public bool IsPortAuthorized { get; set; }
|
||||||
|
|
||||||
|
public bool AutoRunWebApp { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
/// Gets or sets a value indicating whether [enable case sensitive item ids].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -68,6 +68,8 @@ namespace MediaBrowser.Model.System
|
||||||
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
|
||||||
public bool CanSelfUpdate { get; set; }
|
public bool CanSelfUpdate { get; set; }
|
||||||
|
|
||||||
|
public bool CanLaunchWebBrowser { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets plugin assemblies that failed to load.
|
/// Gets or sets plugin assemblies that failed to load.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user