comments and captcha stuff

This commit is contained in:
biglyderv 2024-11-25 14:12:44 -05:00
parent e2ef83ec0c
commit 42aaebbd69
8 changed files with 25 additions and 28 deletions

View file

@ -2,16 +2,11 @@ import Route from "../route.js";
import initDb from "../db.js";
import { randomUUID } from 'node:crypto';
import auth from "../form/auth.js";
import captcha from "./captcha.js";
let db = await initDb();
// TODO: rewrite
let main = new Route([auth,captcha], async function (req, res, input) {
let { captchaMatch} = input;
if (!captchaMatch) return { 'success': false, 'message': 'Captcha is incorrect' };
let main = new Route([auth], async function (req, res, input) {
let { username } = input;
let id = randomUUID();
@ -28,7 +23,7 @@ let main = new Route([auth,captcha], async function (req, res, input) {
id
]);
res.send({ redir: `?` });
res.send({ 'message': 'Comment sent', redirect: `/client/${targetType}?id=${targetId}` });
});
export default main;

View file

@ -1,6 +1,5 @@
import Route from "../route.js";
import initDb from "../db.js";
import { randomUUID } from 'node:crypto';
import auth from "../form/auth.js";
let db = await initDb();