|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Swagger UI</title>
|
|
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700"
|
|
rel="stylesheet">
|
|
<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>
|
|
<% if (!showExplorer) { %>
|
|
.swagger-ui .topbar .download-url-wrapper {
|
|
display: none
|
|
}
|
|
<% } %>
|
|
</style>
|
|
<% if (cssPath) { %>
|
|
<link rel="stylesheet" type="text/css" href="<%= cssPath %>">
|
|
<% } %>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="swagger-ui"></div>
|
|
|
|
<script src="./swagger-ui-bundle.js"></script>
|
|
<script src="./swagger-ui-standalone-preset.js"></script>
|
|
|
|
<script>
|
|
const initialOptions = <%- JSON.stringify(swaggerOptions) %>;
|
|
const currentUrl = window.origin + "<%- url %>";
|
|
const urls = <%- JSON.stringify(urls) %>
|
|
.map(function (o) {
|
|
if (!o.url.match(/^https?:/)) {
|
|
const url = window.origin + o.url;
|
|
return {
|
|
name: o.name,
|
|
url: url,
|
|
selected: url === currentUrl
|
|
}
|
|
}
|
|
return o;
|
|
})
|
|
.sort(function (a, b) {
|
|
return a.selected ? -1 : 1
|
|
});
|
|
|
|
const SwaggerUIBuilder = {
|
|
config: Object.assign({
|
|
urls: urls,
|
|
dom_id: '#swagger-ui',
|
|
deepLinking: true,
|
|
presets: [
|
|
SwaggerUIBundle.presets.apis,
|
|
SwaggerUIStandalonePreset
|
|
],
|
|
plugins: [
|
|
SwaggerUIBundle.plugins.DownloadUrl
|
|
],
|
|
layout: "StandaloneLayout",
|
|
oauth2RedirectUrl: currentUrl.replace('swagger.json', 'oauth2-redirect.html')
|
|
}, initialOptions),
|
|
/**
|
|
*
|
|
*/
|
|
init: function () {
|
|
this.ui = SwaggerUIBundle(this.config);
|
|
|
|
if (this.config.oauth) {
|
|
this.ui.initOAuth(this.config.oauth);
|
|
}
|
|
|
|
if (this.config.authorize) {
|
|
this.ui.authActions.authorize(this.config.authorize);
|
|
}
|
|
|
|
window.ui = this.ui;
|
|
|
|
const event = new Event('swagger.init');
|
|
document.dispatchEvent(event);
|
|
}
|
|
}
|
|
|
|
</script>
|
|
<% if (jsPath) { %>
|
|
<script src="<%= jsPath %>"></script>
|
|
<% } %>
|
|
<script>
|
|
window.onload = function () {
|
|
SwaggerUIBuilder.init();
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|