Răsfoiți Sursa

Open the Swagger API page on server start if not hosting the static web content

Mark Monteiro 5 ani în urmă
părinte
comite
1b5999a1bc

+ 3 - 0
Emby.Server.Implementations/ApplicationHost.cs

@@ -244,6 +244,9 @@ namespace Emby.Server.Implementations
         /// </summary>
         public string ContentRoot { get; private set; }
 
+        /// <inheritdoc/>
+        public bool IsHostingContent => ContentRoot != null;
+
         /// <summary>
         /// Gets the server configuration manager.
         /// </summary>

+ 10 - 0
Emby.Server.Implementations/Browser/BrowserLauncher.cs

@@ -29,6 +29,16 @@ namespace Emby.Server.Implementations.Browser
             OpenDashboardPage("index.html", appHost);
         }
 
+        /// <summary>
+        /// Opens the swagger API page.
+        /// </summary>
+        /// <param name="appHost">The app host.</param>
+        public static void OpenSwaggerPage(IServerApplicationHost appHost)
+        {
+            var url = appHost.GetLocalApiUrl("localhost") + "/swagger/index.html";
+            OpenUrl(appHost, url);
+        }
+
         /// <summary>
         /// Opens the URL.
         /// </summary>

+ 5 - 1
Emby.Server.Implementations/EntryPoints/StartupWizard.cs

@@ -36,7 +36,11 @@ namespace Emby.Server.Implementations.EntryPoints
                 return Task.CompletedTask;
             }
 
-            if (!_config.Configuration.IsStartupWizardCompleted)
+            if (!_appHost.IsHostingContent)
+            {
+                BrowserLauncher.OpenSwaggerPage(_appHost);
+            }
+            else if (!_config.Configuration.IsStartupWizardCompleted)
             {
                 BrowserLauncher.OpenWebApp(_appHost);
             }

+ 5 - 0
MediaBrowser.Controller/IServerApplicationHost.cs

@@ -16,6 +16,11 @@ namespace MediaBrowser.Controller
     {
         event EventHandler HasUpdateAvailableChanged;
 
+        /// <summary>
+        /// Gets a value indicating whether the server is hosting the static web content from jellyfin-web.
+        /// </summary>
+        bool IsHostingContent { get; }
+
         /// <summary>
         /// Gets the system info.
         /// </summary>