Merge pull request #3932 from crobibero/api-doc-css

Add support for custom api-doc css
This commit is contained in:
Bond-009 2020-09-03 20:37:54 +02:00 committed by GitHub
commit 388fe236c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 0 deletions

View File

@ -39,12 +39,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");
}); });
} }

View File

@ -64,4 +64,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>

View File

@ -112,6 +112,7 @@ namespace Jellyfin.Server
app.UseHttpsRedirection(); app.UseHttpsRedirection();
} }
app.UseStaticFiles();
app.UseAuthentication(); app.UseAuthentication();
app.UseJellyfinApiSwagger(_serverConfigurationManager); app.UseJellyfinApiSwagger(_serverConfigurationManager);
app.UseRouting(); app.UseRouting();