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
+5 -1
View File
@@ -1,11 +1,12 @@
/**
* Registers org-admin HTTP surface: auth, org APIs, (later) static SPA.
* Registers org-admin HTTP surface: auth, org APIs, and the static SPA shell.
*/
import cookie from "@fastify/cookie";
import type { PrismaClient } from "@prisma/client";
import type { FastifyInstance } from "fastify";
import { registerAuthRoutes } from "./routes/authRoutes.js";
import { registerOrgRoutes } from "./routes/orgRoutes.js";
import { registerStaticSpa } from "./static.js";
import type { LocalSecretEnvelope } from "../security/secretEnvelope.js";
import type { ProviderReadinessProbe } from "../connections/providerReadiness.js";
import type { FeishuReadinessProbe } from "../connections/feishuReadiness.js";
@@ -62,4 +63,7 @@ export async function registerAdminPlugin(
? { feishuConnectionReadinessProbe: config.feishuConnectionReadinessProbe }
: {}),
});
// After API + /admin/login so SPA fallback does not shadow auth routes.
await registerStaticSpa(app);
}