mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-27 02:10:40 +00:00
parent
450fc9a120
commit
38b4c23d24
1 changed files with 26 additions and 15 deletions
|
@ -71,22 +71,33 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
// Build a system
|
// Fetch the Swagger JSON specs
|
||||||
const ui = SwaggerUIBundle({
|
var url = "{{AppUrl}}swagger.{{.APIJSONVersion}}.json"
|
||||||
url: "{{AppUrl}}swagger.{{.APIJSONVersion}}.json",
|
fetch(url)
|
||||||
dom_id: '#swagger-ui',
|
.then(function(response) {
|
||||||
deepLinking: true,
|
response.json()
|
||||||
presets: [
|
.then(function(spec) {
|
||||||
SwaggerUIBundle.presets.apis,
|
// Make the page's protocol be at the top of the schemes list
|
||||||
SwaggerUIStandalonePreset
|
var protocol = window.location.protocol.slice(0, -1)
|
||||||
],
|
spec.schemes.sort(function(x,y){ return x == protocol ? -1 : y == protocol ? 1 : 0 })
|
||||||
plugins: [
|
// Build the Swagger UI
|
||||||
SwaggerUIBundle.plugins.DownloadUrl
|
const ui = SwaggerUIBundle({
|
||||||
],
|
spec: spec,
|
||||||
layout: "StandaloneLayout"
|
dom_id: '#swagger-ui',
|
||||||
})
|
deepLinking: true,
|
||||||
|
presets: [
|
||||||
|
SwaggerUIBundle.presets.apis,
|
||||||
|
SwaggerUIStandalonePreset
|
||||||
|
],
|
||||||
|
plugins: [
|
||||||
|
SwaggerUIBundle.plugins.DownloadUrl
|
||||||
|
],
|
||||||
|
layout: "StandaloneLayout"
|
||||||
|
})
|
||||||
|
|
||||||
window.ui = ui
|
window.ui = ui
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue