Skip to content

Commit

Permalink
update swagger-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
stoicflame committed Mar 14, 2023
1 parent e8448fc commit 3f2a290
Show file tree
Hide file tree
Showing 16 changed files with 72 additions and 78 deletions.
16 changes: 16 additions & 0 deletions swagger/swagger-ui/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after {
box-sizing: inherit;
}

body {
margin: 0;
background: #fafafa;
}
64 changes: 2 additions & 62 deletions swagger/swagger-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,75 +5,15 @@
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" />
<link rel="stylesheet" type="text/css" href="index.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: -moz-scrollbars-vertical;
overflow-y: scroll;
}

*,
*:before,
*:after
{
box-sizing: inherit;
}

body
{
margin:0;
background: #fafafa;
}
</style>
</head>

<body>
<div id="swagger-ui"></div>

<script src="./swagger-ui-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
var url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
}
else if (document.location.href.substring(0, 5) === "file:") {
url = "../swagger.json";
}
else {
var baseUrl = document.location.href;
//this removes the anchor at the end, if there is one
baseUrl = baseUrl.substring(0, (baseUrl.indexOf("#") === -1) ? baseUrl.length : baseUrl.indexOf("#"));
//this removes the query after the file name, if there is one
baseUrl = baseUrl.substring(0, (baseUrl.indexOf("?") === -1) ? baseUrl.length : baseUrl.indexOf("?"));
//this removes everything after the last slash in the path
baseUrl = baseUrl.substring(0, (baseUrl.lastIndexOf("/") === -1) ? baseUrl.length : baseUrl.lastIndexOf("/"));

url = baseUrl + "/swagger.json";
}

// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: url,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});
// End Swagger UI call region

window.ui = ui;
};
</script>
<script src="./swagger-initializer.js" charset="UTF-8"> </script>
</body>
</html>
6 changes: 3 additions & 3 deletions swagger/swagger-ui/oauth2-redirect.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
var isValid, qp, arr;

if (/code|token|error/.test(window.location.hash)) {
qp = window.location.hash.substring(1);
qp = window.location.hash.substring(1).replace('?', '&');
} else {
qp = location.search.substring(1);
}
Expand All @@ -38,7 +38,7 @@
authId: oauth2.auth.name,
source: "auth",
level: "warning",
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
message: "Authorization may be unsafe, passed state was changed in server. The passed state wasn't returned from auth server."
});
}

Expand All @@ -58,7 +58,7 @@
authId: oauth2.auth.name,
source: "auth",
level: "error",
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server."
});
}
} else {
Expand Down
38 changes: 38 additions & 0 deletions swagger/swagger-ui/swagger-initializer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
window.onload = function() {
//<editor-fold desc="Changeable Configuration Block">
let url = window.location.search.match(/url=([^&]+)/);
if (url && url.length > 1) {
url = decodeURIComponent(url[1]);
}
else if (document.location.href.substring(0, 5) === "file:") {
url = "../openapi.json";
}
else {
var baseUrl = document.location.href;
//this removes the anchor at the end, if there is one
baseUrl = baseUrl.substring(0, (baseUrl.indexOf("#") === -1) ? baseUrl.length : baseUrl.indexOf("#"));
//this removes the query after the file name, if there is one
baseUrl = baseUrl.substring(0, (baseUrl.indexOf("?") === -1) ? baseUrl.length : baseUrl.indexOf("?"));
//this removes everything after the last slash in the path
baseUrl = baseUrl.substring(0, (baseUrl.lastIndexOf("/") === -1) ? baseUrl.length : baseUrl.lastIndexOf("/"));

url = baseUrl + "/openapi.json";
}

// the following lines will be replaced by docker/configurator, when it runs in a docker-container
window.ui = SwaggerUIBundle({
url: url,
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
});

//</editor-fold>
};
2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-bundle.js.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion swagger/swagger-ui/swagger-ui-es-bundle-core.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-es-bundle-core.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-es-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-es-bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-standalone-preset.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui-standalone-preset.js.map

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions swagger/swagger-ui/swagger-ui.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion swagger/swagger-ui/swagger-ui.js.map

Large diffs are not rendered by default.

0 comments on commit 3f2a290

Please sign in to comment.