1
0
mirror of https://github.com/KubaPro010/fm-dx-webserver.git synced 2026-02-26 14:11:59 +01:00

normalizedIp fix

This commit is contained in:
Marek Farkaš
2025-01-11 21:22:23 +01:00
parent 687fd642a1
commit 721293900f

View File

@@ -19,7 +19,8 @@ const { allPluginConfigs } = require('./plugins');
// Endpoints
router.get('/', (req, res) => {
let requestIp = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const normalizedIp = requestIp.replace(/^::ffff:/, '');
const normalizedIp = requestIp?.replace(/^::ffff:/, '');
const isBanned = serverConfig.webserver.banlist.some(banEntry => banEntry[0] === normalizedIp);
if (isBanned) {