Prepare Soundbox Ops deployment

This commit is contained in:
Wira Basalamah
2026-06-06 20:58:04 +07:00
parent 60b1537c4c
commit 00580a98fc
16 changed files with 3238 additions and 270 deletions

View File

@ -23,6 +23,26 @@ const app = express();
if (env.TRUST_PROXY === "true") {
app.set("trust proxy", 1);
}
const allowedPreviewOrigins = new Set([
"http://127.0.0.1:4173",
"http://localhost:4173"
]);
app.use((req, res, next) => {
const origin = req.header("origin");
if (origin && allowedPreviewOrigins.has(origin)) {
res.header("Access-Control-Allow-Origin", origin);
res.header("Vary", "Origin");
res.header("Access-Control-Allow-Headers", "authorization, content-type, x-request-id, idempotency-key");
res.header("Access-Control-Allow-Methods", "GET,POST,PATCH,PUT,DELETE,OPTIONS");
}
if (req.method === "OPTIONS") {
return res.sendStatus(204);
}
return next();
});
startNotificationOrchestrator();
startDynamicQrExpiryScheduler();
startExportJobWorker();
@ -105,8 +125,7 @@ function resolveUiPageFile(slug: string) {
}
app.get("/ui", (_req, res) => {
const filePath = path.resolve(process.cwd(), "ui/index.html");
res.sendFile(filePath);
res.redirect(302, "/ui/soundbox-ops");
});
app.get("/ui/hub", (_req, res) => {