Files
2026-09-01 18:17:37 +08:00

58 lines
1.6 KiB
HTML

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>API 文档(全部)</title>
<link rel="stylesheet" href="swagger-ui.css">
<style>
html {
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
body {
margin: 0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="swagger-ui-bundle.js"></script>
<script src="swagger-ui-standalone-preset.js"></script>
<script>
window.onload = async function () {
let urls = [];
try {
const res = await fetch('urls');
if (res.ok) {
const list = await res.json();
if (Array.isArray(list) && list.length > 0) {
urls = list;
}
}
} catch (e) { }
if (urls.length === 0) {
document.getElementById('swagger-ui').innerHTML =
'<div style="padding:20px;color:#666;">无法加载文档列表,请确认服务正常运行。</div>';
return;
}
window.ui = SwaggerUIBundle({
urls: urls,
"urls.primaryName": urls[0].name,
dom_id: "#swagger-ui",
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "StandaloneLayout"
});
};
</script>
</body>
</html>