Building Project Files
هذا الالتزام موجود في:
@@ -0,0 +1,3 @@
|
||||
<script src="{{ swagger_ui_bundle_js }}"></script>
|
||||
<script src="{{ swagger_ui_standalone_preset_js }}"></script>
|
||||
<script src="{{ jquery_js }}" type='text/javascript'></script>
|
||||
@@ -0,0 +1,2 @@
|
||||
<!-- Include custom css and top js in templates/flasgger/head.html -->
|
||||
{{flasgger_config.head_text | safe}}
|
||||
@@ -0,0 +1,11 @@
|
||||
<div class='swagger-ui'>
|
||||
<div class="wrapper">
|
||||
<section class="clear">
|
||||
{{flasgger_config.footer_text | safe}}
|
||||
<span style="float: right;">
|
||||
[Powered by <a target="_blank" href="https://github.com/rochacbruno/flasgger">Flasgger</a> {{ flasgger_version }}]
|
||||
<br>
|
||||
</span>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,27 @@
|
||||
<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="{{ 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>
|
||||
@@ -0,0 +1,36 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{% include 'flasgger/head.html' %}
|
||||
<!-- To add custom code here override the template templates/flasgger/custom_head.html -->
|
||||
{% include 'flasgger/custom_head.html' %}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
{% include 'flasgger/top.html' %}
|
||||
|
||||
<div id="swagger-ui">
|
||||
<div data-reactroot="" class="swagger-ui">
|
||||
<div>
|
||||
<div class="information-container wrapper">
|
||||
<section class="block col-12">
|
||||
<!-- ADDS THE LOADER SPINNER -->
|
||||
<div class="loading-container"><div class="loading"></div></div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
{% include 'flasgger/body_scripts.html' %}
|
||||
|
||||
<!-- To customize the script that loads swagger, override templates/flasgger/swagger.html -->
|
||||
{% include 'flasgger/swagger.html' %}
|
||||
|
||||
<!-- To customize the footer and include custom script on templates/flasgger/footer.html -->
|
||||
{% include 'flasgger/footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<body onload="run()">
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1);
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
) : {}
|
||||
|
||||
isValid = qp.state === sentState
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode"||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
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"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
let oauthErrorMsg
|
||||
if (qp.error) {
|
||||
oauthErrorMsg = "["+qp.error+"]: " +
|
||||
(qp.error_description ? qp.error_description+ ". " : "no accessCode received from the server. ") +
|
||||
(qp.error_uri ? "More info: "+qp.error_uri : "");
|
||||
}
|
||||
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: oauthErrorMsg || "[Authorization failed]: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,92 @@
|
||||
<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(
|
||||
{
|
||||
|
||||
{% if urls %}
|
||||
urls: {{ urls | tojson }},
|
||||
{% else %}
|
||||
url: "{{ specs[0]['url'] }}",
|
||||
{% endif %}
|
||||
dom_id: '#swagger-ui',
|
||||
validatorUrl: null,
|
||||
displayOperationId: true,
|
||||
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) {
|
||||
{% if config.JWT_AUTH_HEADER_NAME -%}
|
||||
var jwtAuthHeaderName = "{{ config.JWT_AUTH_HEADER_NAME }}";
|
||||
{%- else %}
|
||||
var jwtAuthHeaderName = "Authorization";
|
||||
{%- endif %}
|
||||
{% if config.JWT_AUTH_HEADER_TYPE -%}
|
||||
var jwtAuthHeaderType = "{{ config.JWT_AUTH_HEADER_TYPE }}";
|
||||
{%- else %}
|
||||
var jwtAuthHeaderType = "Bearer";
|
||||
{%- endif %}
|
||||
request.headers[jwtAuthHeaderName] = jwtAuthHeaderType + " " + jwt_token;
|
||||
}
|
||||
|
||||
return request;
|
||||
},
|
||||
responseInterceptor: function(response) {
|
||||
{% if config.JWT_AUTH_HEADER_TOKEN -%}
|
||||
var jwtAuthHeaderToken = "{{ config.JWT_AUTH_HEADER_TOKEN }}";
|
||||
{%- else %}
|
||||
var jwtAuthHeaderToken = "jwt-token";
|
||||
{%- endif %}
|
||||
var tokenField = jwtAuthHeaderToken;
|
||||
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 }}
|
||||
{% if flasgger_config.ui_params_text -%}
|
||||
, {{ flasgger_config.ui_params_text | safe }}
|
||||
{%- endif %}
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
let auth_config = {{ flasgger_config.get("auth") | safe }};
|
||||
|
||||
ui.initOAuth(auth_config);
|
||||
|
||||
window.ui = ui
|
||||
|
||||
{% if not flasgger_config.hide_top_bar -%}
|
||||
$(".topbar-wrapper .link span").replaceWith("<span>{{title}}</span>");
|
||||
{%- endif %}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,7 @@
|
||||
<div class='swagger-ui'>
|
||||
<div class="wrapper">
|
||||
<section class="clear">
|
||||
{{flasgger_config.top_text | safe}}
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
المرجع في مشكلة جديدة
حظر مستخدم