new backend

This commit is contained in:
Flummi
2021-12-04 12:19:47 +01:00
parent d885dd8e4e
commit 43665884f6
42 changed files with 946 additions and 1226 deletions

View File

@ -1,14 +0,0 @@
import router from "../router.mjs";
import cfg from "../../../config.json";
router.get(/^\/theme\//, async (req, res) => {
let theme = req.url.split[1] ?? cfg.websrv.themes[0];
if(!cfg.websrv.themes.includes(theme))
theme = cfg.websrv.themes[0];
return res.writeHead(301, {
"Cache-Control": "no-cache, public",
"Set-Cookie": `theme=${theme}; Path=/`,
"Location": req.headers.referer ?? "/"
}).end();
});