Move imgExtensions
This commit is contained in:
parent
644f0977a7
commit
a69569cbd4
2 changed files with 4 additions and 3 deletions
3
index.js
3
index.js
|
|
@ -8,7 +8,6 @@ const formatDelay = require('./utils/formatDelay.js');
|
||||||
const fetchServerIP = require('./services/fetchServerIP.js');
|
const fetchServerIP = require('./services/fetchServerIP.js');
|
||||||
const whitelist = require('./utils/whitelist.js');
|
const whitelist = require('./utils/whitelist.js');
|
||||||
const log = require('./utils/log.js');
|
const log = require('./utils/log.js');
|
||||||
const imgExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.svg', '.webp'];
|
|
||||||
|
|
||||||
const fetchBlockedIPs = async () => {
|
const fetchBlockedIPs = async () => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -17,7 +16,7 @@ const fetchBlockedIPs = async () => {
|
||||||
if (events) {
|
if (events) {
|
||||||
const filtered = events.filter(x =>
|
const filtered = events.filter(x =>
|
||||||
x.ip !== fetchServerIP() &&
|
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.domains.some(subdomain => x.clientRequestHTTPHost?.includes(subdomain)) &&
|
||||||
!whitelist.endpoints.some(endpoint => x.clientRequestPath?.includes(endpoint))
|
!whitelist.endpoints.some(endpoint => x.clientRequestPath?.includes(endpoint))
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -23,4 +23,6 @@ const endpoints = [
|
||||||
'crossdomain.xml',
|
'crossdomain.xml',
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = { domains, endpoints };
|
const imgExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.bmp', '.svg', '.webp'];
|
||||||
|
|
||||||
|
module.exports = { domains, endpoints, imgExtensions };
|
||||||
Loading…
Add table
Reference in a new issue