Update index.html

Fix: Update index.html to properly load Swagger UI
This commit is contained in:
worldofiptvcom
2025-12-12 15:31:00 +03:00
parent 385ba5f309
commit 5304c29d8b
+57 -35
View File
@@ -5,15 +5,16 @@
<meta name="viewport" content="width=device-width, initial-scale=1" /> <meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="XUI.ONE Admin API Documentation - Interactive Swagger UI" /> <meta name="description" content="XUI.ONE Admin API Documentation - Interactive Swagger UI" />
<title>XUI.ONE Admin API Documentation</title> <title>XUI.ONE Admin API Documentation</title>
<link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css" /> <link rel="stylesheet" href="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui.css" />
<style> <style>
body { body {
margin: 0; margin: 0;
padding: 0; padding: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
} }
.topbar { .topbar {
display: none; display: none !important;
} }
.swagger-ui .info { .swagger-ui .info {
@@ -78,6 +79,18 @@
.info-banner strong { .info-banner strong {
color: #856404; color: #856404;
} }
#swagger-ui {
max-width: 1460px;
margin: 0 auto;
}
.loading-message {
text-align: center;
padding: 40px;
font-size: 18px;
color: #666;
}
</style> </style>
</head> </head>
<body> <body>
@@ -96,14 +109,29 @@
Replace placeholder values (<code>your-server.com</code>, <code>&lt;API-KEY&gt;</code>, <code>&lt;Access-Code&gt;</code>) with your actual credentials. Replace placeholder values (<code>your-server.com</code>, <code>&lt;API-KEY&gt;</code>, <code>&lt;Access-Code&gt;</code>) with your actual credentials.
</div> </div>
<div id="swagger-ui"></div> <div id="swagger-ui">
<div class="loading-message">⏳ Loading API Documentation...</div>
</div>
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-bundle.js" crossorigin></script> <footer style="text-align: center; padding: 40px 20px; background: #fafafa; margin-top: 50px; border-top: 1px solid #e5e5e5;">
<script src="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui-standalone-preset.js" crossorigin></script> <p style="color: #666; margin: 0;">
<strong>XUI.ONE Admin API Documentation</strong>
</p>
<p style="color: #999; margin: 10px 0 0; font-size: 14px;">
Made with ❤️ by <a href="https://www.worldofiptv.com" target="_blank" style="color: #667eea; text-decoration: none;">World of IPTV</a>
</p>
<p style="color: #999; margin: 10px 0 0; font-size: 12px;">
Documentation licensed under MIT | XUI.ONE software is proprietary
</p>
</footer>
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-bundle.js" crossorigin></script>
<script src="https://unpkg.com/swagger-ui-dist@5.11.0/swagger-ui-standalone-preset.js" crossorigin></script>
<script> <script>
window.onload = () => { window.onload = function() {
try {
window.ui = SwaggerUIBundle({ window.ui = SwaggerUIBundle({
url: './openapi.yaml', url: 'openapi.yaml',
dom_id: '#swagger-ui', dom_id: '#swagger-ui',
deepLinking: true, deepLinking: true,
presets: [ presets: [
@@ -121,38 +149,32 @@
showRequestHeaders: true, showRequestHeaders: true,
tryItOutEnabled: true, tryItOutEnabled: true,
requestSnippetsEnabled: true, requestSnippetsEnabled: true,
requestSnippets: { supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
generators: { validatorUrl: null,
curl_bash: { onComplete: function() {
title: "cURL (bash)", console.log('✅ Swagger UI loaded successfully!');
syntax: "bash"
}, },
curl_powershell: { onFailure: function(error) {
title: "cURL (PowerShell)", console.error('❌ Swagger UI failed to load:', error);
syntax: "powershell" document.getElementById('swagger-ui').innerHTML =
}, '<div style="padding: 40px; text-align: center; color: #d32f2f;">' +
curl_cmd: { '<h2>⚠️ Failed to Load API Documentation</h2>' +
title: "cURL (CMD)", '<p>Error: ' + error.message + '</p>' +
syntax: "bash" '<p>Please check the browser console for more details.</p>' +
} '<p><a href="openapi.yaml" target="_blank">View raw OpenAPI spec</a></p>' +
}, '</div>';
defaultExpanded: true,
languages: null
} }
}); });
} catch (error) {
console.error('❌ Error initializing Swagger UI:', error);
document.getElementById('swagger-ui').innerHTML =
'<div style="padding: 40px; text-align: center; color: #d32f2f;">' +
'<h2>⚠️ Failed to Initialize Swagger UI</h2>' +
'<p>Error: ' + error.message + '</p>' +
'<p><a href="openapi.yaml" target="_blank">View raw OpenAPI spec</a></p>' +
'</div>';
}
}; };
</script> </script>
<footer style="text-align: center; padding: 40px 20px; background: #fafafa; margin-top: 50px; border-top: 1px solid #e5e5e5;">
<p style="color: #666; margin: 0;">
<strong>XUI.ONE Admin API Documentation</strong>
</p>
<p style="color: #999; margin: 10px 0 0; font-size: 14px;">
Made with ❤️ by <a href="https://www.worldofiptv.com" target="_blank" style="color: #667eea; text-decoration: none;">World of IPTV</a>
</p>
<p style="color: #999; margin: 10px 0 0; font-size: 12px;">
Documentation licensed under MIT | XUI.ONE software is proprietary
</p>
</footer>
</body> </body>
</html> </html>