From d7abc4e7971080b74b3c3115ce179fddc98ccc76 Mon Sep 17 00:00:00 2001 From: Flummi Date: Tue, 17 May 2022 09:40:43 +0000 Subject: [PATCH] misc bugfixes --- debug/adduser.mjs | 5 +---- src/index.mjs | 4 +++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/debug/adduser.mjs b/debug/adduser.mjs index 271dedb..8991d16 100644 --- a/debug/adduser.mjs +++ b/debug/adduser.mjs @@ -2,13 +2,10 @@ import db from '../src/inc/sql.mjs'; import lib from '../src/inc/lib.mjs'; import readline from 'node:readline/promises'; -import stream from 'stream'; - -const _args = process.argv[2]; const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); -const newuser = _args?.length ? _args : await rl.question('username: '); +const newuser = process.argv[2]?.length ? process.argv[2] : await rl.question('username: '); const password = await rl.question('password: '); const level = +(await rl.question('level (0-100): ')); diff --git a/src/index.mjs b/src/index.mjs index 48a8e36..5a7ba5d 100644 --- a/src/index.mjs +++ b/src/index.mjs @@ -61,7 +61,7 @@ import flummpress from "flummpress"; req.session = false; if(req.url.pathname.match(/^\/(s|b|t|ca)\//)) return; - req.theme = req.cookies.theme ?? 'f0ck'; + req.theme = req.cookies.theme || 'f0ck'; if(req.cookies.session) { const user = await db` @@ -95,6 +95,8 @@ import flummpress from "flummpress"; where id = ${+user[0].sess_id} `; + req.session.theme = req.cookies.theme; + // update userprofile await db` insert into "user_options" ${