fix front
All checks were successful
Build SMS Gateway / Build image (push) Successful in 16s

This commit is contained in:
2026-02-02 07:20:37 +07:00
parent f72f335807
commit d71d83a044
3 changed files with 18 additions and 5 deletions

View File

@@ -103,9 +103,16 @@ router.get("/balance", (req, res) => {
// Serve static files
router.use(express.static(path.join(__dirname, "public")));
// GET / - serve main page
// GET / - serve main page with injected credentials
router.get("/", (req, res) => {
res.sendFile(path.join(__dirname, "public", "index.html"));
const indexPath = path.join(__dirname, "public", "index.html");
let html = fs.readFileSync(indexPath, "utf8");
// Inject credentials for frontend
const configScript = `<script>window.SMS_CONFIG = { login: "${AUTH_LOGIN || ""}", psw: "${AUTH_PASSWORD || ""}" };</script>`;
html = html.replace("</head>", configScript + "</head>");
res.send(html);
});
// Mount router at BASE_PATH