From 7ddf460928f46b77646512392e02420a825756c5 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 26 Jun 2023 13:16:00 +0200 Subject: [PATCH] Final part of run logs --- .gitignore | 3 ++- index.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 7935536..8f20f09 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ vpn/ accounts/ Microsoft-Rewards-bot/ node_modules/ -.env \ No newline at end of file +.env +batch_logs.json \ No newline at end of file diff --git a/index.js b/index.js index d26aa47..8393c2d 100644 --- a/index.js +++ b/index.js @@ -305,6 +305,11 @@ async function main() { logManager(`[${host}] Log file: batch_logs.json`, 'info'); for (const vpn of vpns) { + const currentDate = new Date(); + const formattedDate = `${currentDate.getDate()}-${currentDate.getMonth() + 1}-${currentDate.getFullYear()}`; + const logEntries = JSON.parse(fs.readFileSync('batch_logs.json', 'utf8')); + const entry = logEntries.find(entries => entries.accountName === vpn); + if (entry && entry.accountName === formattedDate) continue; logManager(`[${host}] Switching to VPN: [${vpn}]`, 'info'); const con = await vpnConnect(vpn); if (con) continue;