api/cookies: log message to confirm successful file load

This commit is contained in:
jj 2024-10-27 18:12:01 +00:00
parent 5a5a65b373
commit b434b0b45e
No known key found for this signature in database

View file

@ -1,6 +1,7 @@
import Cookie from './cookie.js';
import { readFile, writeFile } from 'fs/promises';
import { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser';
import { Green, Yellow } from '../../misc/console-text.js';
const WRITE_INTERVAL = 60000,
COUNTER = Symbol('counter');
@ -12,7 +13,11 @@ export const setup = async (cookiePath) => {
cookies = await readFile(cookiePath, 'utf8');
cookies = JSON.parse(cookies);
intervalId = setInterval(writeChanges, WRITE_INTERVAL);
} catch { /* no cookies for you */ }
console.log(`${Green('[✓]')} cookies loaded successfully!`)
} catch(e) {
console.error(`${Yellow('[!]')} failed to load cookies.`);
console.error('error:', e);
}
}
function writeChanges() {