AMelonInsideLemon d64531f4b2 feat(webui): guild view (#2752)
Also moves guild-specific cheats to a switch for each guild
Closes #1403

Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com>
Reviewed-on: OpenWF/SpaceNinjaServer#2752
Reviewed-by: Sainan <63328889+sainan@users.noreply.github.com>
Co-authored-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
Co-committed-by: AMelonInsideLemon <166175391+AMelonInsideLemon@users.noreply.github.com>
2025-09-09 23:55:10 -07:00

71 lines
2.2 KiB
TypeScript

import express from "express";
import path from "path";
import { repoDir, rootDir } from "../helpers/pathHelper.ts";
import { args } from "../helpers/commandLineArguments.ts";
const baseDir = args.dev ? repoDir : rootDir;
const webuiRouter = express.Router();
// Redirect / to /webui/
webuiRouter.get("/", (_req, res) => {
res.redirect("/webui/");
});
// Redirect /webui to /webui/
webuiRouter.use("/webui", (req, res, next) => {
if (req.originalUrl === "/") {
return res.redirect("/webui/");
}
next();
});
// Serve virtual routes
webuiRouter.get("/webui/inventory", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/detailedView", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/mods", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/settings", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/quests", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/cheats", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/import", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
webuiRouter.get("/webui/guildView", (_req, res) => {
res.sendFile(path.join(baseDir, "static/webui/index.html"));
});
// Serve static files
webuiRouter.use("/webui", express.static(path.join(baseDir, "static/webui")));
// Serve favicon
webuiRouter.get("/favicon.ico", (_req, res) => {
res.sendFile(path.join(repoDir, "static/fixed_responses/favicon.ico"));
});
// Serve warframe-riven-info
webuiRouter.get("/webui/riven-tool/", (_req, res) => {
res.sendFile(path.join(repoDir, "node_modules/warframe-riven-info/index.html"));
});
webuiRouter.get("/webui/riven-tool/RivenParser.js", (_req, res) => {
res.sendFile(path.join(repoDir, "node_modules/warframe-riven-info/RivenParser.js"));
});
// Serve translations
webuiRouter.get("/translations/:file", (req, res) => {
res.sendFile(path.join(baseDir, `static/webui/translations/${req.params.file}`));
});
export { webuiRouter };