eslint cfg update
This commit is contained in:
parent
3c0e4c48f2
commit
212a4592d2
11 changed files with 35 additions and 36 deletions
|
|
@ -21,5 +21,5 @@ module.exports = {
|
||||||
SUCCESS_COOLDOWN,
|
SUCCESS_COOLDOWN,
|
||||||
IP_REFRESH_INTERVAL,
|
IP_REFRESH_INTERVAL,
|
||||||
REPORT_TO_SEFINEK_API,
|
REPORT_TO_SEFINEK_API,
|
||||||
SEFINEK_API_INTERVAL
|
SEFINEK_API_INTERVAL,
|
||||||
};
|
};
|
||||||
|
|
@ -27,7 +27,7 @@ module.exports = {
|
||||||
|
|
||||||
// Environment variables
|
// Environment variables
|
||||||
env: {
|
env: {
|
||||||
NODE_ENV: 'production'
|
NODE_ENV: 'production',
|
||||||
}
|
},
|
||||||
}]
|
}],
|
||||||
};
|
};
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import js from '@eslint/js';
|
import js from '@eslint/js';
|
||||||
import globals from 'globals';
|
import globals from 'globals';
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
|
||||||
export default [
|
export default [
|
||||||
js.configs.recommended,
|
js.configs.recommended,
|
||||||
{
|
{
|
||||||
|
|
@ -9,13 +8,13 @@ export default [
|
||||||
ecmaVersion: 2024,
|
ecmaVersion: 2024,
|
||||||
globals: {
|
globals: {
|
||||||
...globals.node,
|
...globals.node,
|
||||||
...globals.es2024
|
...globals.es2024,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'arrow-spacing': ['warn', { before: true, after: true }],
|
'arrow-spacing': ['warn', { before: true, after: true }],
|
||||||
'comma-dangle': ['error'],
|
'comma-dangle': ['warn', { arrays: 'always-multiline', objects: 'always-multiline' }],
|
||||||
'comma-spacing': 'error',
|
'comma-spacing': 'warn',
|
||||||
'comma-style': 'error',
|
'comma-style': 'error',
|
||||||
'curly': ['error', 'multi-line', 'consistent'],
|
'curly': ['error', 'multi-line', 'consistent'],
|
||||||
'dot-location': ['error', 'property'],
|
'dot-location': ['error', 'property'],
|
||||||
|
|
@ -26,31 +25,31 @@ export default [
|
||||||
'max-statements-per-line': ['error', { max: 2 }],
|
'max-statements-per-line': ['error', { max: 2 }],
|
||||||
'no-console': 'off',
|
'no-console': 'off',
|
||||||
'no-empty': 'warn',
|
'no-empty': 'warn',
|
||||||
'no-empty-function': 'error',
|
'no-empty-function': 'warn',
|
||||||
'no-floating-decimal': 'error',
|
'no-floating-decimal': 'error',
|
||||||
'no-lonely-if': 'error',
|
'no-lonely-if': 'warn',
|
||||||
'no-multi-spaces': 'warn',
|
'no-multi-spaces': 'warn',
|
||||||
'no-multiple-empty-lines': ['warn', { max: 4, maxEOF: 1, maxBOF: 0 }],
|
'no-multiple-empty-lines': ['warn', { max: 3, maxEOF: 1, maxBOF: 0 }],
|
||||||
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
|
'no-shadow': ['error', { allow: ['err', 'resolve', 'reject'] }],
|
||||||
'no-trailing-spaces': ['warn'],
|
'no-trailing-spaces': 'warn',
|
||||||
'no-unreachable': 'warn',
|
'no-unreachable': 'warn',
|
||||||
'no-unused-vars': 'warn',
|
'no-unused-vars': 'warn',
|
||||||
'no-use-before-define': ['error', { functions: false, classes: true }],
|
'no-use-before-define': ['error', { functions: false, classes: true }],
|
||||||
'no-var': 'error',
|
'no-var': 'error',
|
||||||
'object-curly-spacing': ['error', 'always'],
|
'object-curly-spacing': ['warn', 'always'],
|
||||||
'prefer-const': 'error',
|
'prefer-const': 'error',
|
||||||
'quotes': ['warn', 'single'],
|
'quotes': ['warn', 'single'],
|
||||||
'semi': ['warn', 'always'],
|
'semi': ['warn', 'always'],
|
||||||
'sort-vars': 'warn',
|
'sort-vars': 'warn',
|
||||||
'space-before-blocks': 'error',
|
'space-before-blocks': 'warn',
|
||||||
'space-before-function-paren': ['error', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
|
'space-before-function-paren': ['warn', { anonymous: 'never', named: 'never', asyncArrow: 'always' }],
|
||||||
'space-in-parens': 'error',
|
'space-in-parens': 'warn',
|
||||||
'space-infix-ops': 'error',
|
'space-infix-ops': 'warn',
|
||||||
'space-unary-ops': 'error',
|
'space-unary-ops': 'warn',
|
||||||
'spaced-comment': 'warn',
|
'spaced-comment': 'warn',
|
||||||
'wrap-regex': 'error',
|
'wrap-regex': 'warn',
|
||||||
'yoda': 'error'
|
'yoda': 'error',
|
||||||
},
|
},
|
||||||
ignores: ['node_modules', 'public/js/bootstrap.bundle.min.js']
|
ignores: ['node_modules', '*min.js', '*bundle*', 'build/*', 'dist/*'],
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
2
index.js
2
index.js
|
|
@ -73,7 +73,7 @@ const reportIP = async (event, uri, country, hostname, endpoint, cycleErrorCount
|
||||||
await axios.post('https://api.abuseipdb.com/api/v2/report', {
|
await axios.post('https://api.abuseipdb.com/api/v2/report', {
|
||||||
ip: event.clientIP,
|
ip: event.clientIP,
|
||||||
categories: '19',
|
categories: '19',
|
||||||
comment: generateComment(event)
|
comment: generateComment(event),
|
||||||
}, { headers: headers.ABUSEIPDB });
|
}, { headers: headers.ABUSEIPDB });
|
||||||
|
|
||||||
logToCSV(event.rayName, event.clientIP, country, hostname, endpoint, event.userAgent, event.action, 'REPORTED');
|
logToCSV(event.rayName, event.clientIP, country, hostname, endpoint, event.userAgent, event.action, 'REPORTED');
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ const readReportedIPs = () => {
|
||||||
useragent: parts[6].replace(/(^"|"$)/g, ''),
|
useragent: parts[6].replace(/(^"|"$)/g, ''),
|
||||||
action: parts[7],
|
action: parts[7],
|
||||||
status: parts[8],
|
status: parts[8],
|
||||||
sefinekAPI: parts[9] === 'true'
|
sefinekAPI: parts[9] === 'true',
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
.filter(item => item !== null);
|
.filter(item => item !== null);
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ module.exports = it => {
|
||||||
{ label: 'Timestamp', value: it.datetime },
|
{ label: 'Timestamp', value: it.datetime },
|
||||||
{ label: 'Ray ID', value: it.rayName },
|
{ label: 'Ray ID', value: it.rayName },
|
||||||
{ label: 'Rule ID', value: it.ruleId },
|
{ label: 'Rule ID', value: it.ruleId },
|
||||||
{ label: 'UA', value: it.userAgent || 'Empty string' }
|
{ label: 'UA', value: it.userAgent || 'Empty string' },
|
||||||
];
|
];
|
||||||
|
|
||||||
const reportLines = fields
|
const reportLines = fields
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,13 @@ const CLOUDFLARE = {
|
||||||
'User-Agent': userAgent,
|
'User-Agent': userAgent,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Authorization': `Bearer ${process.env.CLOUDFLARE_API_KEY}`,
|
'Authorization': `Bearer ${process.env.CLOUDFLARE_API_KEY}`,
|
||||||
'X-Auth-Email': process.env.CLOUDFLARE_EMAIL
|
'X-Auth-Email': process.env.CLOUDFLARE_EMAIL,
|
||||||
};
|
};
|
||||||
|
|
||||||
const ABUSEIPDB = {
|
const ABUSEIPDB = {
|
||||||
'User-Agent': userAgent,
|
'User-Agent': userAgent,
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Key': process.env.ABUSEIPDB_API_KEY
|
'Key': process.env.ABUSEIPDB_API_KEY,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = { CLOUDFLARE, ABUSEIPDB };
|
module.exports = { CLOUDFLARE, ABUSEIPDB };
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
const levels = {
|
const levels = {
|
||||||
log: '[INFO]',
|
log: '[INFO]',
|
||||||
warn: '[WARN]',
|
warn: '[WARN]',
|
||||||
error: '[FAIL]'
|
error: '[FAIL]',
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = (level, msg) => console[level](`${levels[level]} ${msg}`);
|
module.exports = (level, msg) => console[level](`${levels[level]} ${msg}`);
|
||||||
|
|
@ -44,9 +44,9 @@ module.exports = () => {
|
||||||
{ action_neq: 'managed_challenge_skipped' },
|
{ action_neq: 'managed_challenge_skipped' },
|
||||||
{ action_neq: 'managed_challenge_non_interactive_solved' },
|
{ action_neq: 'managed_challenge_non_interactive_solved' },
|
||||||
{ action_neq: 'managed_challenge_interactive_solved' },
|
{ action_neq: 'managed_challenge_interactive_solved' },
|
||||||
{ action_neq: 'managed_challenge_bypassed' }
|
{ action_neq: 'managed_challenge_bypassed' },
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
return { query, variables };
|
return { query, variables };
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,10 @@ module.exports = async () => {
|
||||||
useragent: ip.useragent.replace(/"/g, ''),
|
useragent: ip.useragent.replace(/"/g, ''),
|
||||||
action: ip.action,
|
action: ip.action,
|
||||||
country: ip.country,
|
country: ip.country,
|
||||||
timestamp: ip.timestamp
|
timestamp: ip.timestamp,
|
||||||
}))
|
})),
|
||||||
}, {
|
}, {
|
||||||
headers: { 'Authorization': process.env.SEFINEK_API_SECRET }
|
headers: { 'Authorization': process.env.SEFINEK_API_SECRET },
|
||||||
});
|
});
|
||||||
|
|
||||||
log('log', `Successfully sent ${uniqueLogs.length} logs to Sefinek API. Status: ${res.status}`);
|
log('log', `Successfully sent ${uniqueLogs.length} logs to Sefinek API. Status: ${res.status}`);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
module.exports = [
|
module.exports = [
|
||||||
'/weryfikacja',
|
'/weryfikacja',
|
||||||
'/verification',
|
'/verification',
|
||||||
'/download'
|
'/download',
|
||||||
];
|
];
|
||||||
Loading…
Add table
Reference in a new issue