Need to do rotating offers for her some other time Reviewed-on: OpenWF/SpaceNinjaServer#1419 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
62 lines
1.9 KiB
TypeScript
62 lines
1.9 KiB
TypeScript
import express from "express";
|
|
import path from "path";
|
|
import { repoDir, rootDir } from "@/src/helpers/pathHelper";
|
|
|
|
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(rootDir, "static/webui/index.html"));
|
|
});
|
|
webuiRouter.get(/webui\/powersuit\/(.+)/, (_req, res) => {
|
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
|
});
|
|
webuiRouter.get("/webui/mods", (_req, res) => {
|
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
|
});
|
|
webuiRouter.get("/webui/settings", (_req, res) => {
|
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
|
});
|
|
webuiRouter.get("/webui/cheats", (_req, res) => {
|
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
|
});
|
|
webuiRouter.get("/webui/import", (_req, res) => {
|
|
res.sendFile(path.join(rootDir, "static/webui/index.html"));
|
|
});
|
|
|
|
// Serve static files
|
|
webuiRouter.use("/webui", express.static(path.join(rootDir, "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(rootDir, `static/webui/translations/${req.params.file}`));
|
|
});
|
|
|
|
export { webuiRouter };
|