Update: cache module, security modules and build
This commit is contained in:
@@ -49,6 +49,8 @@
|
||||
.tab-content.active { display: block; }
|
||||
|
||||
.json-input { width: 100%; min-height: 100px; padding: 10px; border: 1px solid #ddd; border-radius: 5px; font-family: monospace; font-size: 0.9em; }
|
||||
.profile-banner { background:#fff7e6;border-left:4px solid #fa8c16;padding:12px 14px;border-radius:8px;margin-bottom:18px; color:#874d00; }
|
||||
.tools { margin: 10px 0 16px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -68,6 +70,12 @@
|
||||
<a href="api.html" class="active">🔌 API</a>
|
||||
</div>
|
||||
|
||||
<div id="profileBanner" class="profile-banner">正在读取 profile...</div>
|
||||
<div class="tools">
|
||||
<button class="btn btn-primary" onclick="copyCurl()">复制当前示例 cURL(GET /api/users)</button>
|
||||
<a class="btn btn-primary" href="verify-lab.html">进入修复验证实验室</a>
|
||||
</div>
|
||||
|
||||
<div class="tabs">
|
||||
<div class="tab active" onclick="switchTab('user')">👥 用户 API</div>
|
||||
<div class="tab" onclick="switchTab('product')">📦 产品 API</div>
|
||||
@@ -248,6 +256,27 @@
|
||||
document.getElementById(tab + 'Tab').classList.add('active');
|
||||
}
|
||||
|
||||
async function loadProfileBanner() {
|
||||
try {
|
||||
const res = await fetch('/api/profile');
|
||||
const data = await res.json();
|
||||
const enabled = (data.enabledModules || []).join(', ');
|
||||
document.getElementById('profileBanner').textContent = `当前 profile: ${data.profile} | 鉴权模式: ${data.authType || 'none'} | 已启用模块: ${enabled}`;
|
||||
} catch (e) {
|
||||
document.getElementById('profileBanner').textContent = '当前 profile 读取失败,请检查 /api/profile';
|
||||
}
|
||||
}
|
||||
|
||||
async function copyCurl() {
|
||||
const curl = `curl -X GET "${window.location.origin}/api/users"`;
|
||||
try {
|
||||
await navigator.clipboard.writeText(curl);
|
||||
alert('已复制: ' + curl);
|
||||
} catch (e) {
|
||||
alert('复制失败,请手动复制: ' + curl);
|
||||
}
|
||||
}
|
||||
|
||||
async function testApi(method, url, body, resultId) {
|
||||
const resultDiv = document.getElementById(resultId);
|
||||
resultDiv.classList.add('show');
|
||||
@@ -275,6 +304,8 @@
|
||||
resultDiv.innerHTML = `<strong style="color:#ff6b6b;">Error</strong>\n\n${e.message}`;
|
||||
}
|
||||
}
|
||||
|
||||
loadProfileBanner();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user