Move imgExtensions

This commit is contained in:
Sefinek 2025-02-04 17:16:19 +01:00
parent 644f0977a7
commit a69569cbd4
2 changed files with 4 additions and 3 deletions

View file

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

View file

@ -23,4 +23,6 @@ const endpoints = [
'crossdomain.xml',
];
module.exports = { domains, endpoints };
const imgExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.svg', '.webp'];
module.exports = { domains, endpoints, imgExtensions };