feat: 所有入口统一到 /api/ 前缀
将 zTools2 托管的页面/静态/探针/WebSocket 路由全部从顶级路径迁移到 /api/ 下:
- 页面:/pdf -> /api/pdf、/pdf-admin -> /api/pdf-admin、/upload -> /api/upload、
/files -> /api/files-page、/wb/{id} -> /api/wb-page/{id}、/wb-admin -> /api/wb-admin
(页面类加 -page 后缀以规避同名 REST API /api/files、/api/wb/{id})
- 静态资源:/static -> /api/static
- 探针:/health -> /api/health
- WebSocket:/ws/wb/{id} -> /api/ws/wb/{id}
- 前端 HTML 壳与 JS 中的资源/页间链接/WS URL 同步更新
- 手动测试脚本 BASE_WS 同步
这样反代与 vite proxy 只需一条 /api/ 规则即可转发全部入口;
前端 iframe 用同源相对路径 /api/pdf,与环境无关,不再误打到其它环境域名。
README 新增「路由约定」说明。
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
newBtn.addEventListener("click", () => {
|
||||
// 生成一个随机 board_id 并打开(访问即创建)
|
||||
const id = "b_" + Math.random().toString(36).slice(2, 10);
|
||||
window.open(`/wb/${id}`, "_blank");
|
||||
window.open(`/api/wb-page/${id}`, "_blank");
|
||||
});
|
||||
|
||||
async function load() {
|
||||
@@ -47,7 +47,7 @@
|
||||
for (const b of items) {
|
||||
const row = el("tr", null,
|
||||
el("td", { class: "col-id" },
|
||||
el("a", { class: "bid link", href: `/wb/${b.board_id}`, target: "_blank" }, b.board_id)
|
||||
el("a", { class: "bid link", href: `/api/wb-page/${b.board_id}`, target: "_blank" }, b.board_id)
|
||||
),
|
||||
el("td", { class: "col-mods mono" }, String(b.edit_count ?? 0)),
|
||||
el("td", { class: "col-created muted" }, fmtTime(b.created_at)),
|
||||
|
||||
Reference in New Issue
Block a user