瀏覽代碼

add support for custom doc css

crobibero 4 年之前
父節點
當前提交
1d9285c594

+ 2 - 0
Jellyfin.Server/Extensions/ApiApplicationBuilderExtensions.cs

@@ -38,12 +38,14 @@ namespace Jellyfin.Server.Extensions
                     c.DocumentTitle = "Jellyfin API";
                     c.DocumentTitle = "Jellyfin API";
                     c.SwaggerEndpoint($"/{baseUrl}api-docs/openapi.json", "Jellyfin API");
                     c.SwaggerEndpoint($"/{baseUrl}api-docs/openapi.json", "Jellyfin API");
                     c.RoutePrefix = $"{baseUrl}api-docs/swagger";
                     c.RoutePrefix = $"{baseUrl}api-docs/swagger";
+                    c.InjectStylesheet($"/{baseUrl}api-docs/swagger/custom.css");
                 })
                 })
                 .UseReDoc(c =>
                 .UseReDoc(c =>
                 {
                 {
                     c.DocumentTitle = "Jellyfin API";
                     c.DocumentTitle = "Jellyfin API";
                     c.SpecUrl($"/{baseUrl}api-docs/openapi.json");
                     c.SpecUrl($"/{baseUrl}api-docs/openapi.json");
                     c.RoutePrefix = $"{baseUrl}api-docs/redoc";
                     c.RoutePrefix = $"{baseUrl}api-docs/redoc";
+                    c.InjectStylesheet($"/{baseUrl}api-docs/redoc/custom.css");
                 });
                 });
         }
         }
     }
     }

+ 9 - 0
Jellyfin.Server/Jellyfin.Server.csproj

@@ -63,4 +63,13 @@
     <ProjectReference Include="..\Jellyfin.Server.Implementations\Jellyfin.Server.Implementations.csproj" />
     <ProjectReference Include="..\Jellyfin.Server.Implementations\Jellyfin.Server.Implementations.csproj" />
   </ItemGroup>
   </ItemGroup>
 
 
+  <ItemGroup>
+    <None Update="wwwroot\api-docs\swagger\custom.css">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+    <None Update="wwwroot\api-docs\redoc\custom.css">
+      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+    </None>
+  </ItemGroup>
+
 </Project>
 </Project>

+ 1 - 0
Jellyfin.Server/Startup.cs

@@ -73,6 +73,7 @@ namespace Jellyfin.Server
 
 
             // TODO app.UseMiddleware<WebSocketMiddleware>();
             // TODO app.UseMiddleware<WebSocketMiddleware>();
 
 
+            app.UseStaticFiles();
             app.UseAuthentication();
             app.UseAuthentication();
             app.UseJellyfinApiSwagger(_serverConfigurationManager);
             app.UseJellyfinApiSwagger(_serverConfigurationManager);
             app.UseRouting();
             app.UseRouting();

+ 0 - 0
Jellyfin.Server/wwwroot/api-docs/redoc/custom.css


+ 0 - 0
Jellyfin.Server/wwwroot/api-docs/swagger/custom.css