zeroframework/Services/Identity/ZeroFramework.IdentityServer.API/Infrastructure/Swagger/Index.html
2023-12-05 17:22:48 +08:00

106 lines
3.6 KiB
HTML

<!--To customize the UI beyond the basic options listed above, you can provide your own version of the swagger-ui index.html page-->
<!--https://github.com/domaindrivendev/Swashbuckle.AspNetCore/blob/master/src/Swashbuckle.AspNetCore.SwaggerUI/index.html-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>%(DocumentTitle)</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css">
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<style>
html {
box-sizing: border-box;
overflow-y: scroll;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #fafafa;
}
</style>
<style>
.topbar-wrapper > .link > img {
content: url(https://cloud.helloworldnet.com/logo-white.svg);
margin-right: 5px;
}
.information-container {
display: none;
}
.swagger-ui .topbar {
margin-bottom: 20px;
background-color: #0072c6;
}
.swagger-ui .scheme-container {
padding: 0px;
}
.swagger-ui .scheme-container .auth-wrapper > button.btn.authorize {
display: none;
}
.swagger-ui .scheme-container div > .servers-title, .swagger-ui .scheme-container div > .servers {
display: none;
}
</style>
%(HeadContent)
</head>
<body>
<div id="swagger-ui"></div>
<!-- Workaround for https://github.com/swagger-api/swagger-editor/issues/1371 -->
<script>
if (window.navigator.userAgent.indexOf("Edge") > -1) {
console.log("Removing native Edge fetch in favor of swagger-ui's polyfill")
window.fetch = undefined;
}
</script>
<script src="./swagger-ui-bundle.js"></script>
<script src="./swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function () {
var configObject = JSON.parse('%(ConfigObject)');
var oauthConfigObject = JSON.parse('%(OAuthConfigObject)');
// Workaround for https://github.com/swagger-api/swagger-ui/issues/5945
configObject.urls.forEach(function (item) {
if (item.url.startsWith("http") || item.url.startsWith("/")) return;
item.url = window.location.href.replace("index.html", item.url).split('#')[0];
});
// If validatorUrl is not explicitly provided, disable the feature by setting to null
if (!configObject.hasOwnProperty("validatorUrl"))
configObject.validatorUrl = null
// If oauth2RedirectUrl isn't specified, use the built-in default
if (!configObject.hasOwnProperty("oauth2RedirectUrl"))
configObject.oauth2RedirectUrl = window.location.href.replace("index.html", "oauth2-redirect.html").split('#')[0];
// Apply mandatory parameters
configObject.dom_id = "#swagger-ui";
configObject.presets = [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset];
configObject.layout = "StandaloneLayout";
// Begin Swagger UI call region
const ui = SwaggerUIBundle(configObject);
ui.initOAuth(oauthConfigObject);
// End Swagger UI call region
window.ui = ui
document.querySelector(".topbar-wrapper>.link").appendChild(document.createTextNode("ZeroFramework"));
}
</script>
</body>
</html>