feat(router): v0.2.4 阶段二 管理入口迁移与前端同步
管理入口从 /admin 迁至 /dashboard: - /dashboard、/dashboard/voices、/dashboard/settings 为新入口 - 原挂在 /dashboard 上的服务状态预览页(health.html)迁至 /dashboard/status, 侧边栏新增「观测 → 详细状态」入口 - /admin 及子路径 301 永久重定向到对应新路径(页面用 301 是正确的) - 静态资源同时注册 /dashboard/ 与 /admin/ 两套路径, 避免过渡期出现"页面能开但丢样式" 前端同步: - admin-shell.js:侧边栏导航、登出、登录跳转改指 /dashboard/* - admin.html / admin-login.html / admin-voices.html / admin-settings.html: 静态资源引用与登录跳转改指 /dashboard/* - health.html:改用 admin-shell 的 http 实例并改调 /admin/health、/admin/metrics (该实例自动附加 Authorization: Bearer;原实现用裸 axios,不带凭证), 并加登录校验与「返回控制台」入口 - setup.html:安装完成跳转目标改为 /dashboard,页面内 /admin 文案同步更新 - 各页面的 API 调用路径无需修改:axios baseURL 为 /api, 故 /voices、/admin/overview 等自动落成 /api/admin/* controller/setup.go:安装成功响应的 redirect 字段由 /admin 改为 /dashboard。 验证:go build / go vet / go test ./... -count=1 全绿; 另用真实服务器端到端验证:旧入口 301 全部正确、静态资源新旧路径均 200、 管理页面内容协商(html 200 / 非 html 401)、登录页公开、 各页面引用的静态资源均为新路径且无残留旧路径。
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
<title>火山 TTS · 系统设置</title>
|
||||
<script src="https://cdn.bootcdn.net/ajax/libs/vue/3.4.21/vue.global.prod.js"></script>
|
||||
<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.6.7/axios.min.js"></script>
|
||||
<link rel="stylesheet" href="/admin/admin.css">
|
||||
<link rel="stylesheet" href="/dashboard/admin.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
@@ -34,7 +34,7 @@
|
||||
<div class="card-head">
|
||||
<div>
|
||||
<div class="card-title">鉴权 Key</div>
|
||||
<div class="card-sub">客户端调用 <code>/v1/audio/speech</code> 与登录 /admin 共用</div>
|
||||
<div class="card-sub">客户端调用 <code>/v1/audio/speech</code>。管理后台登录改用 <code>admin_key</code>(未配置时回退用本 Key)</div>
|
||||
</div>
|
||||
<span class="pill pill-accent">敏感</span>
|
||||
</div>
|
||||
@@ -143,7 +143,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/admin/admin-shell.js"></script>
|
||||
<script src="/dashboard/admin-shell.js"></script>
|
||||
<script>
|
||||
const { createApp, ref, computed, onMounted } = Vue;
|
||||
const { http, getKey, setKey, clearKey, toast, mountShell } = window.admin;
|
||||
@@ -236,7 +236,7 @@
|
||||
authKeyInput.value = '';
|
||||
setTimeout(() => {
|
||||
clearKey();
|
||||
location.href = '/admin/login';
|
||||
location.href = '/dashboard/login';
|
||||
}, 200);
|
||||
toast('ok', 'Auth Key 已更新,请用新 Key 重新登录');
|
||||
} catch (e) {
|
||||
@@ -246,7 +246,7 @@
|
||||
const resetSettingsForm = () => { loadSettings(); };
|
||||
|
||||
onMounted(() => {
|
||||
if (!getKey()) { location.href = '/admin/login'; return; }
|
||||
if (!getKey()) { location.href = '/dashboard/login'; return; }
|
||||
mountShell({
|
||||
activeNav: 'settings',
|
||||
overview: overview.value,
|
||||
|
||||
Reference in New Issue
Block a user