toggle fullscreen
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 32s

This commit is contained in:
Flummi
2023-05-06 06:54:09 +02:00
parent a753a3f27d
commit 84104b58bc
7 changed files with 57 additions and 3 deletions

View File

@ -67,6 +67,7 @@ process.on('unhandledRejection', err => {
if(req.url.pathname.match(/^\/(s|b|t|ca)\//))
return;
req.theme = req.cookies.theme || 'f0ck';
req.fullscreen = req.cookies.fullscreen || 0;
if(req.cookies.session) {
const user = await db`
@ -101,6 +102,7 @@ process.on('unhandledRejection', err => {
`;
req.session.theme = req.cookies.theme;
req.session.fullscreen = req.cookies.fullscreen;
// update userprofile
await db`
@ -108,12 +110,14 @@ process.on('unhandledRejection', err => {
db({
user_id: +user[0].id,
mode: user[0].mode ?? 0,
theme: req.session.theme ?? 'f0ck'
}, 'user_id', 'mode', 'theme')
theme: req.session.theme ?? 'f0ck',
fullscreen: req.session.fullscreen || 0
}, 'user_id', 'mode', 'theme', 'fullscreen')
}
on conflict ("user_id") do update set
mode = excluded.mode,
theme = excluded.theme,
fullscreen = excluded.fullscreen,
user_id = excluded.user_id
`;
}