From 76dbe9fcf962977f0ac51dc6a09bb6027efd3944 Mon Sep 17 00:00:00 2001 From: gor_down Date: Sun, 12 Jan 2025 05:08:55 -0300 Subject: [PATCH] anti spam --- src/router/indexRouter.js | 3 +++ views/home.hbs | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/router/indexRouter.js b/src/router/indexRouter.js index 6096eda..d58ea74 100644 --- a/src/router/indexRouter.js +++ b/src/router/indexRouter.js @@ -60,6 +60,9 @@ router.get('/', (_req, res) => { const recent_posters = [] router.post('/comment', (req, res) => { + if (req.body.checkbox === "on"){ + return res.redirect('/home#visitor_table') + } const ip = req.header('x-forwarded-for') || req.connection.remoteAddress; if(recent_posters.some( poster => poster.ip === ip)){ console.log("spammer, " + ip) diff --git a/views/home.hbs b/views/home.hbs index 9574eb4..133f72e 100644 --- a/views/home.hbs +++ b/views/home.hbs @@ -327,6 +327,9 @@

+ +
+