comments and captcha stuff
This commit is contained in:
parent
e2ef83ec0c
commit
42aaebbd69
8 changed files with 25 additions and 28 deletions
|
@ -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;
|
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue