-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46ad75f
commit 93be2d5
Showing
8 changed files
with
111 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!-- Include custom css and top js in templates/flasgger/head.html --> | ||
{{flasgger_config.head_text | safe}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,27 @@ | ||
<!-- Include custom css and top js in templates/flasgger/head.html --> | ||
{{flasgger_config.head_text | safe}} | ||
<meta charset="UTF-8"> | ||
<title>{{ title }}</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="{{url_for('flasgger.static', filename='swagger-ui.css')}}" > | ||
<!-- Customize the app.config['SWAGGER']['favicon'] --> | ||
<link rel="icon" type="image/png" href="{{ favicon }}" sizes="64x64 32x32 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<script> | ||
window.onload = function() { | ||
|
||
{% if config.JWT_AUTH_URL_RULE -%} | ||
// JWT token holder | ||
var jwt_token; | ||
{%- endif %} | ||
|
||
// Build a system | ||
const ui = SwaggerUIBundle( | ||
Object.assign( | ||
{ | ||
|
||
url: "{{ specs[0]['url'] }}", | ||
dom_id: '#swagger-ui', | ||
validatorUrl: null, | ||
deepLinking: true, | ||
jsonEditor: true, | ||
{% if flasgger_config.doc_expansion -%} | ||
docExpansion: "{{flasgger_config.doc_expansion | safe }}", | ||
{%- endif %} | ||
apisSorter: "alpha", | ||
presets: [ | ||
SwaggerUIBundle.presets.apis, | ||
SwaggerUIStandalonePreset | ||
], | ||
plugins: [ | ||
SwaggerUIBundle.plugins.DownloadUrl | ||
], | ||
{% if config.JWT_AUTH_URL_RULE -%} | ||
requestInterceptor: function(request) { | ||
if (jwt_token) { | ||
request.headers.Authorization = "Bearer " + jwt_token; | ||
} | ||
|
||
return request; | ||
}, | ||
responseInterceptor: function(response) { | ||
var tokenField = 'jwt-token'; | ||
var headers = response.headers; | ||
|
||
if (headers.hasOwnProperty(tokenField)) { | ||
jwt_token = headers[tokenField]; | ||
} | ||
|
||
return response; | ||
}, | ||
{%- endif %} | ||
{% if not flasgger_config.hide_top_bar -%} | ||
layout: "StandaloneLayout", | ||
{%- endif %} | ||
|
||
}, | ||
{{ json.dumps(flasgger_config.get('ui_params', {})) | safe }} | ||
) | ||
|
||
) | ||
|
||
window.ui = ui | ||
|
||
{% if not flasgger_config.hide_top_bar -%} | ||
$(".topbar-wrapper .link span").replaceWith("<span>{{title}}</span>"); | ||
{%- endif %} | ||
} | ||
</script> |