From 23ebfd2a0db3c8b5b53b7ab77c0e9b2f6e679709 Mon Sep 17 00:00:00 2001 From: Jeff Emmett Date: Tue, 24 Feb 2026 15:34:36 -0800 Subject: [PATCH] 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 --- server/index.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/index.ts b/server/index.ts index 6f473c6..fce8d89 100644 --- a/server/index.ts +++ b/server/index.ts @@ -524,6 +524,12 @@ const server = Bun.serve({ 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);