web-base/Core/Templates/swagger.twig

54 lines
1.7 KiB
Twig
Raw Normal View History

2022-02-20 16:53:26 +01:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link nonce="{{ site.csp.nonce }}" rel="stylesheet" type="text/css" href="/css/swagger-ui.css" />
<style nonce="{{ site.csp.nonce }}">
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script nonce="{{ site.csp.nonce }}" src="/js/swagger-ui-bundle.js" charset="UTF-8"></script>
<script nonce="{{ site.csp.nonce }}" src="/js/swagger-ui-standalone-preset.js" charset="UTF-8"></script>
<script nonce="{{ site.csp.nonce }}">
window.onload = function() {
// Begin Swagger UI call region
window.ui = SwaggerUIBundle({
url: "{{ site.baseUrl }}/api/swagger",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
2022-02-20 23:17:17 +01:00
{% if user.loggedIn %}
2022-02-20 16:53:26 +01:00
requestInterceptor: request => {
request.headers['XSRF-Token'] = '{{ user.session.csrfToken }}';
return request;
}
2022-02-20 23:17:17 +01:00
{% endif %}
2022-02-20 16:53:26 +01:00
});
};
</script>
</body>
</html>