fix reason

This commit is contained in:
2026-03-11 22:12:06 +01:00
parent c67d8f7311
commit b08a57a5e8
3 changed files with 15 additions and 14 deletions
+4 -3
View File
@@ -24,10 +24,11 @@ router.get('/', (req, res) => {
const normalizedIp = requestIp?.replace(/^::ffff:/, '');
const ipList = (normalizedIp || '').split(',').map(ip => ip.trim()).filter(Boolean); // in case there are multiple IPs (proxy), we need to check all of them
const isBanned = ipList.some(ip => serverConfig.webserver.banlist.some(banEntry => banEntry[0] === ip));
const banEntry = serverConfig.webserver.banlist.find(banEntry => ipList.includes(banEntry[0]));
if (isBanned) {
res.render('403');
if (banEntry) {
const reason = banEntry[3];
res.render('403', { reason });
logInfo(`Web client (${normalizedIp}) is banned`);
return;
}