Quellcode durchsuchen

Merge pull request #2943 from mark-monteiro/fix-browser-autolaunch

Respect AutoRunWebApp and NoAutoRunWebApp settings when HostWebClient is false
Bond-009 vor 5 Jahren
Ursprung
Commit
a85b1dcba6
1 geänderte Dateien mit 23 neuen und 13 gelöschten Zeilen
  1. 23 13
      Emby.Server.Implementations/EntryPoints/StartupWizard.cs

+ 23 - 13
Emby.Server.Implementations/EntryPoints/StartupWizard.cs

@@ -31,31 +31,41 @@ namespace Emby.Server.Implementations.EntryPoints
 
 
         /// <inheritdoc />
         /// <inheritdoc />
         public Task RunAsync()
         public Task RunAsync()
+        {
+            Run();
+            return Task.CompletedTask;
+        }
+
+        private void Run()
         {
         {
             if (!_appHost.CanLaunchWebBrowser)
             if (!_appHost.CanLaunchWebBrowser)
             {
             {
-                return Task.CompletedTask;
+                return;
             }
             }
 
 
-            if (!_appConfig.HostWebClient())
+            // Always launch the startup wizard if possible when it has not been completed
+            if (!_config.Configuration.IsStartupWizardCompleted && _appConfig.HostWebClient())
             {
             {
-                BrowserLauncher.OpenSwaggerPage(_appHost);
+                BrowserLauncher.OpenWebApp(_appHost);
+                return;
+            }
+
+            // Do nothing if the web app is configured to not run automatically
+            var options = ((ApplicationHost)_appHost).StartupOptions;
+            if (!_config.Configuration.AutoRunWebApp || options.NoAutoRunWebApp)
+            {
+                return;
             }
             }
-            else if (!_config.Configuration.IsStartupWizardCompleted)
+
+            // Launch the swagger page if the web client is not hosted, otherwise open the web client
+            if (_appConfig.HostWebClient())
             {
             {
                 BrowserLauncher.OpenWebApp(_appHost);
                 BrowserLauncher.OpenWebApp(_appHost);
             }
             }
-            else if (_config.Configuration.AutoRunWebApp)
+            else
             {
             {
-                var options = ((ApplicationHost)_appHost).StartupOptions;
-
-                if (!options.NoAutoRunWebApp)
-                {
-                    BrowserLauncher.OpenWebApp(_appHost);
-                }
+                BrowserLauncher.OpenSwaggerPage(_appHost);
             }
             }
-
-            return Task.CompletedTask;
         }
         }
 
 
         /// <inheritdoc />
         /// <inheritdoc />