From 2ac70bc5201011b5165946403e223196a51f0095 Mon Sep 17 00:00:00 2001 From: teddit Date: Wed, 31 Mar 2021 19:48:15 +0200 Subject: [PATCH] =?UTF-8?q?in=20ratelimiting:=20return=20on=20=C2=B4next()?= =?UTF-8?q?=C2=B4s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routes.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/routes.js b/routes.js index 19dc109..1e23c9a 100644 --- a/routes.js +++ b/routes.js @@ -26,7 +26,7 @@ module.exports = (app, redis, fetch, RedditAPI) => { let ip = String(req.headers['x-forwarded-for'] || req.connection.remoteAddress || 'unknown') if(ip === 'unknown') { - next() + return next() } if(ratelimit_counts[ip] == undefined) { @@ -52,10 +52,10 @@ module.exports = (app, redis, fetch, RedditAPI) => { console.log(`RATE LIMITED IP ADDRESS: ${ip}`) return res.send(`Hold your horses! You have hit the request limit. You should be able to refresh this page in a couple of seconds. If you think you are wrongfully limited, create an issue at https://codeberg.org/teddit/teddit. Rate limiting is highly experimental feature.`) } else { - next() + return next() } } else { - next() + return next() } })