misc bugfixes

This commit is contained in:
Flummi 2022-05-17 09:40:43 +00:00 committed by schrumpel
parent 9fc920c1d2
commit d7abc4e797
2 changed files with 4 additions and 5 deletions

View File

@ -2,13 +2,10 @@ import db from '../src/inc/sql.mjs';
import lib from '../src/inc/lib.mjs'; import lib from '../src/inc/lib.mjs';
import readline from 'node:readline/promises'; 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 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 password = await rl.question('password: ');
const level = +(await rl.question('level (0-100): ')); const level = +(await rl.question('level (0-100): '));

View File

@ -61,7 +61,7 @@ import flummpress from "flummpress";
req.session = false; req.session = false;
if(req.url.pathname.match(/^\/(s|b|t|ca)\//)) if(req.url.pathname.match(/^\/(s|b|t|ca)\//))
return; return;
req.theme = req.cookies.theme ?? 'f0ck'; req.theme = req.cookies.theme || 'f0ck';
if(req.cookies.session) { if(req.cookies.session) {
const user = await db` const user = await db`
@ -95,6 +95,8 @@ import flummpress from "flummpress";
where id = ${+user[0].sess_id} where id = ${+user[0].sess_id}
`; `;
req.session.theme = req.cookies.theme;
// update userprofile // update userprofile
await db` await db`
insert into "user_options" ${ insert into "user_options" ${