feat: serve React dashboard from public/app when available

Check for public/app/index.html before falling back to the old
public/index.html so the React moderation dashboard is served at
the root in production while preserving the legacy frontend during
the transition period.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-05-14 21:16:03 +07:00
co-authored by Claude Opus 4.7
parent a812182218
commit 196ca1b784
+7 -1
View File
@@ -1,5 +1,6 @@
import type { Client } from "discord.js-selfbot-v13";
import express from "express";
import fs from "fs";
import helmet from "helmet";
import http from "http";
import path from "path";
@@ -151,7 +152,12 @@ export async function startWebserver(
app.use(express.static(path.join(__dirname, "../public")));
app.get("/", (_req, res) => {
res.sendFile(path.join(__dirname, "../public/index.html"));
const reactIndex = path.join(__dirname, "../public/app/index.html");
if (fs.existsSync(reactIndex)) {
res.sendFile(reactIndex);
} else {
res.sendFile(path.join(__dirname, "../public/index.html"));
}
});
// Health check endpoint