refactor: move routes under /tori/ prefix and add /api/obj mount

Routes now live at /tori/api, /ws/tori, and static files at /tori/.
Root / redirects to /tori/. Object storage mounted at /api/obj.
Dev proxy updated accordingly.
This commit is contained in:
Fam Zheng
2026-03-04 11:46:52 +00:00
parent 84779a0527
commit ae72e699f4
5 changed files with 40 additions and 7 deletions

View File

@@ -51,7 +51,8 @@ export type WsHandler = (msg: WsMessage) => void
export function connectWs(projectId: string, onMessage: WsHandler): { close: () => void } {
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:'
const url = `${proto}//${location.host}/ws/${projectId}`
const wsBase = import.meta.env.BASE_URL.replace(/\/$/, '')
const url = `${proto}//${location.host}/ws${wsBase}/${projectId}`
let ws: WebSocket | null = null
let reconnectTimer: ReturnType<typeof setTimeout> | null = null
let closed = false