init f0ckm

This commit is contained in:
2026-04-25 19:51:52 +02:00
commit b646107eb7
241 changed files with 70364 additions and 0 deletions

31
src/inc/routes/theme.mjs Normal file
View File

@@ -0,0 +1,31 @@
import cfg from "../config.mjs";
import lib from "../lib.mjs";
export default (router, tpl) => {
router.get(/^\/theme\//, async (req, res) => {
let theme = req.url.pathname.split('/')[2] ?? 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}; ${lib.getCookieOptions(null, false)}`,
"Location": req.headers.referer ?? "/"
}).end();
});
router.get(/^\/tfull\//, async (req, res) => {
let full = req.session.fullscreen;
if(full == 1)
full = 0;
else
full = 1;
return res.writeHead(301, {
"Cache-Control": "no-cache, public",
"Set-Cookie": `fullscreen=${full}; ${lib.getCookieOptions(null, false)}`,
"Location": req.headers.referer ?? "/"
}).end();
});
return router;
};