From a69569cbd497f3ea09d0bd61d1721e5320c396df Mon Sep 17 00:00:00 2001 From: Sefinek Date: Tue, 4 Feb 2025 17:16:19 +0100 Subject: [PATCH] Move `imgExtensions` --- index.js | 3 +-- utils/whitelist.js | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 3a25b6b..ec8b5bd 100644 --- a/index.js +++ b/index.js @@ -8,7 +8,6 @@ const formatDelay = require('./utils/formatDelay.js'); const fetchServerIP = require('./services/fetchServerIP.js'); const whitelist = require('./utils/whitelist.js'); const log = require('./utils/log.js'); -const imgExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.svg', '.webp']; const fetchBlockedIPs = async () => { try { @@ -17,7 +16,7 @@ const fetchBlockedIPs = async () => { if (events) { const filtered = events.filter(x => x.ip !== fetchServerIP() && - !imgExtensions.some(ext => x.clientRequestPath.endsWith(ext)) && + !whitelist.imgExtensions.some(ext => x.clientRequestPath.endsWith(ext)) && !whitelist.domains.some(subdomain => x.clientRequestHTTPHost?.includes(subdomain)) && !whitelist.endpoints.some(endpoint => x.clientRequestPath?.includes(endpoint)) ); diff --git a/utils/whitelist.js b/utils/whitelist.js index e65f1d2..94bcc67 100644 --- a/utils/whitelist.js +++ b/utils/whitelist.js @@ -23,4 +23,6 @@ const endpoints = [ 'crossdomain.xml', ]; -module.exports = { domains, endpoints }; \ No newline at end of file +const imgExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.svg', '.webp']; + +module.exports = { domains, endpoints, imgExtensions }; \ No newline at end of file