fix: serve /admin directly in fetch handler to bypass /:space catch-all
Hono's parameterized /:space route was capturing /admin before the explicit route. Move admin.html serving into the Bun.serve fetch handler so it runs before Hono routing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4cef36f450
commit
23ebfd2a0d
|
|
@ -524,6 +524,12 @@ const server = Bun.serve<WSData>({
|
|||
return new Response("WebSocket upgrade failed", { status: 400 });
|
||||
}
|
||||
|
||||
// ── Explicit page routes (before Hono, to avoid /:space catch-all) ──
|
||||
if (url.pathname === "/admin") {
|
||||
const adminHtml = await serveStatic("admin.html");
|
||||
if (adminHtml) return adminHtml;
|
||||
}
|
||||
|
||||
// ── Static assets (before Hono routing) ──
|
||||
if (url.pathname !== "/" && !url.pathname.startsWith("/api/") && !url.pathname.startsWith("/ws/")) {
|
||||
const assetPath = url.pathname.slice(1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue