bios, crude post editing

This commit is contained in:
biglyderv 2025-03-04 20:26:00 -05:00
parent ef68abe802
commit 091fba6910
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5
4 changed files with 32 additions and 4 deletions

View file

@ -12,7 +12,7 @@ const maxChar = 2048;
router.post('/', async (req, res, next) => {
let { username } = res.auth;
let { post, type, id } = req.body;
let { post, type, id, edit } = req.body;
if (!username) {
apiStat(res, next, 'Log in to chat with the community.')
@ -34,6 +34,15 @@ router.post('/', async (req, res, next) => {
post += `\nfile::${req.file.path}`;
}
if (edit == 'edit') {
await db.run('UPDATE comment SET content = ? WHERE username = ? AND id = ?', [
post,
username,
id
]);
return;
}
await db.run('INSERT INTO comment (username, date, content, id) VALUES (?,?,?,?)', [
username,
(+new Date),