Refactored file structure to fix docker build, fixed Unfold configuration.

This commit is contained in:
2025-11-11 09:08:09 +00:00
parent a82d0a5396
commit c488f18cc6
181 changed files with 46 additions and 4 deletions

View File

@@ -0,0 +1,46 @@
/**JS file for handling the SwaggerUIBundle and avoid inline script */
const csrfSettings = document.querySelector("body").dataset
const configJson = document.getElementById("swagger-settings").textContent;
const configObject = JSON.parse(configJson);
configObject.dom_id = "#swagger-ui";
configObject.presets = [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
];
if (csrfSettings.apiCsrf && csrfSettings.csrfToken) {
configObject.requestInterceptor = (req) => {
req.headers['X-CSRFToken'] = csrfSettings.csrfToken
return req;
};
};
// {% if add_csrf %}
// configObject.requestInterceptor = (req) => {
// req.headers['X-CSRFToken'] = "{{csrf_token}}";
// return req;
// };
// {% endif %}
const ui = SwaggerUIBundle(configObject);
// SwaggerUIBundle({
// url: swaggerUi.dataset.openapiUrl,
// dom_id: '#swagger-ui',
// presets: [
// SwaggerUIBundle.presets.apis,
// SwaggerUIBundle.SwaggerUIStandalonePreset
// ],
// layout: "BaseLayout",
// requestInterceptor: (req) => {
// if (swaggerUi.dataset.apiCsrf && swaggerUi.dataset.csrfToken) {
// req.headers['X-CSRFToken'] = swaggerUi.dataset.csrfToken
// }
// return req;
// },
// deepLinking: true
// })