Skip to content

Commit

Permalink
Problem: The embed swagger-ui is not up to date
Browse files Browse the repository at this point in the history
Solution:
- Update to v4.1.0
  • Loading branch information
yihuang committed Nov 23, 2021
1 parent 0f99b25 commit 395f411
Show file tree
Hide file tree
Showing 17 changed files with 53 additions and 54,972 deletions.
2 changes: 1 addition & 1 deletion app/docs/statik/statik.go

Large diffs are not rendered by default.

Binary file modified app/docs/swagger-ui/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/docs/swagger-ui/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 10 additions & 10 deletions app/docs/swagger-ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<head>
<meta charset="UTF-8">
<title>Swagger UI</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" />
<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
{
Expand All @@ -33,12 +33,11 @@
<body>
<div id="swagger-ui"></div>

<script src="swagger-ui-bundle.js"> </script>
<script src="swagger-ui-standalone-preset.js"> </script>
<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() {

// Build a system
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "./swagger.yaml",
dom_id: '#swagger-ui',
Expand All @@ -51,10 +50,11 @@
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
});
// End Swagger UI call region

window.ui = ui
}
window.ui = ui;
};
</script>
</body>
</html>
30 changes: 19 additions & 11 deletions app/docs/swagger-ui/oauth2-redirect.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<!doctype html>
<html lang="en-US">
<body onload="run()">
</body>
</html>
<head>
<title>Swagger UI: OAuth2 Redirect</title>
</head>
<body>
<script>
'use strict';
function run () {
Expand All @@ -17,19 +18,20 @@
qp = location.search.substring(1);
}

arr = qp.split("&")
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
arr = qp.split("&");
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';});
qp = qp ? JSON.parse('{' + arr.join() + '}',
function (key, value) {
return key === "" ? value : decodeURIComponent(value)
return key === "" ? value : decodeURIComponent(value);
}
) : {}
) : {};

isValid = qp.state === sentState
isValid = qp.state === sentState;

if ((
oauth2.auth.schema.get("flow") === "accessCode"||
oauth2.auth.schema.get("flow") === "authorizationCode"
oauth2.auth.schema.get("flow") === "accessCode" ||
oauth2.auth.schema.get("flow") === "authorizationCode" ||
oauth2.auth.schema.get("flow") === "authorization_code"
) && !oauth2.auth.code) {
if (!isValid) {
oauth2.errCb({
Expand All @@ -45,7 +47,7 @@
oauth2.auth.code = qp.code;
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
} else {
let oauthErrorMsg
let oauthErrorMsg;
if (qp.error) {
oauthErrorMsg = "["+qp.error+"]: " +
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
Expand All @@ -64,4 +66,10 @@
}
window.close();
}

window.addEventListener('DOMContentLoaded', function () {
run();
});
</script>
</body>
</html>
Loading

0 comments on commit 395f411

Please sign in to comment.