disable url parameter in swagger-ui page (backport #11202) (#11207)

* disable url parameter in swagger-ui page (#11202)

Closes: #11201
Solution:
- update swagger-ui to recent release
- add option `queryConfigEnabled: false`

(cherry picked from commit cb6fea997c)

# Conflicts:
#	client/docs/statik/statik.go
#	client/docs/swagger-ui/swagger-ui-bundle.js
#	client/docs/swagger-ui/swagger-ui-bundle.js.map
#	client/docs/swagger-ui/swagger-ui-es-bundle-core.js
#	client/docs/swagger-ui/swagger-ui-es-bundle-core.js.map
#	client/docs/swagger-ui/swagger-ui-es-bundle.js
#	client/docs/swagger-ui/swagger-ui-es-bundle.js.map
#	client/docs/swagger-ui/swagger-ui-standalone-preset.js
#	client/docs/swagger-ui/swagger-ui-standalone-preset.js.map
#	client/docs/swagger-ui/swagger-ui.js
#	client/docs/swagger-ui/swagger-ui.js.map

* fix conflicts

* override swagger-ui after resolve conflicts

Co-authored-by: yihuang <huang@crypto.com>
Co-authored-by: marbar3778 <marbar3778@yahoo.com>
This commit is contained in:
mergify[bot] 2022-02-21 11:53:38 +01:00 committed by GitHub
parent 7f949c0aa1
commit 4368a18d42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 46 additions and 54962 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 445 B

After

Width:  |  Height:  |  Size: 665 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 628 B

View File

@ -43,6 +43,7 @@
url: "./swagger.yaml",
dom_id: '#swagger-ui',
deepLinking: true,
queryConfigEnabled: false,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset

View File

@ -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 () {
@ -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({
@ -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. ") +
@ -64,4 +66,10 @@
}
window.close();
}
window.addEventListener('DOMContentLoaded', function () {
run();
});
</script>
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
client/docs/swagger-ui/swagger-ui.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,2 @@
#!/bin/sh
statik -src=./client/docs/swagger-ui -dest=./client/docs -f