From 196ca1b7848b87e022a1a05b60554df894dc72b6 Mon Sep 17 00:00:00 2001 From: MythEclipse Date: Thu, 14 May 2026 21:16:03 +0700 Subject: [PATCH] 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 --- src/webserver.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/webserver.ts b/src/webserver.ts index 71a89aa..fd71d66 100644 --- a/src/webserver.ts +++ b/src/webserver.ts @@ -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