anti spam

This commit is contained in:
simio 2025-01-12 05:08:55 -03:00
parent ee27f483c2
commit 76dbe9fcf9
2 changed files with 6 additions and 0 deletions

View File

@ -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)

View File

@ -327,6 +327,9 @@
<textarea placeholder="きき 機器 危機 聞き 気気 キキ 木木" name="comment"></textarea>
<br>
<br>
<input name="checkbox" checked class="checkbox" type="checkbox"><label>Don't check</label>
<br>
<br>
<button type="submit">Submit</button>
</form>
</div>