diff --git a/scripts/csv.js b/scripts/csv.js index 5eb0405..dfe68a0 100644 --- a/scripts/csv.js +++ b/scripts/csv.js @@ -30,7 +30,7 @@ const logToCSV = (rayId, ip, hostname, endpoint, useragent, action, country, sef const readReportedIPs = () => { if (!fs.existsSync(CSV_FILE_PATH)) return []; - const content = fs.readFileSync(CSV_FILE_PATH, 'utf8'); + const content = fs.readFileSync(CSV_FILE_PATH, 'utf-8'); return content .split('\n') .slice(1) @@ -60,7 +60,7 @@ const updateSefinekAPIInCSV = (rayId, reportedToSefinekAPI) => { return; } - const content = fs.readFileSync(CSV_FILE_PATH, 'utf8'); + const content = fs.readFileSync(CSV_FILE_PATH, 'utf-8'); const lines = content.split('\n'); const updatedLines = lines.map(line => { diff --git a/scripts/sefinekAPI.js b/scripts/sefinekAPI.js index de26b36..a1be03f 100644 --- a/scripts/sefinekAPI.js +++ b/scripts/sefinekAPI.js @@ -7,8 +7,7 @@ const SEFINEK_API_URL = `${process.env.NODE_ENV === 'production' ? 'https://api. module.exports = async () => { const reportedIPs = readReportedIPs().filter(ip => ip.action === 'Reported' && ip.sefinekAPI === 'false'); if (reportedIPs.length === 0) { - log('info', 'No reported IPs with action "Reported" and SefinekAPI false to send to Sefinek API.'); - return; + return log('info', 'No reported IPs with action "Reported" and SefinekAPI false to send to Sefinek API'); } const uniqueLogs = reportedIPs.reduce((acc, ip) => { @@ -19,10 +18,7 @@ module.exports = async () => { return acc; }, { seen: new Set(), logs: [] }).logs; - if (uniqueLogs.length === 0) { - log('info', 'No unique IPs to send.'); - return; - } + if (uniqueLogs.length === 0) return log('info', 'No unique IPs to send'); try { const res = await axios.post(SEFINEK_API_URL, {