fix(admin): serve built SPA and include it in release builds

registerStaticSpa was never mounted, so production only exposed org-admin
APIs. Wire it after auth/API routes, fold admin:build into npm run build,
and install admin-web deps during deploy so admin-web/build ships with the
release for same-origin /admin/*.
This commit is contained in:
2026-07-14 23:54:47 +08:00
parent 153d74d033
commit 4e2699d0a5
4 changed files with 12 additions and 7 deletions
+3 -3
View File
@@ -70,9 +70,9 @@ export async function registerStaticSpa(app: FastifyInstance): Promise<void> {
}
});
// SPA client-side route fallback. `/admin/login` is registered earlier as a
// static route and takes precedence; everything else under /admin/* serves
// the index so SvelteKit's client-side router can resolve the view.
// SPA client-side route fallback. Auth registers `/admin/login` first so it
// takes precedence; everything else under /admin/* serves the index so
// SvelteKit's client-side router can resolve the view.
app.get("/admin", async (_request, reply) => {
return reply.type("text/html; charset=utf-8").send(indexHtml);
});