mirror of
https://github.com/imputnet/cobalt.git
synced 2024-12-29 11:06:10 +00:00
api/cookies: log message to confirm successful file load
This commit is contained in:
parent
5a5a65b373
commit
b434b0b45e
|
@ -1,6 +1,7 @@
|
||||||
import Cookie from './cookie.js';
|
import Cookie from './cookie.js';
|
||||||
import { readFile, writeFile } from 'fs/promises';
|
import { readFile, writeFile } from 'fs/promises';
|
||||||
import { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser';
|
import { parse as parseSetCookie, splitCookiesString } from 'set-cookie-parser';
|
||||||
|
import { Green, Yellow } from '../../misc/console-text.js';
|
||||||
|
|
||||||
const WRITE_INTERVAL = 60000,
|
const WRITE_INTERVAL = 60000,
|
||||||
COUNTER = Symbol('counter');
|
COUNTER = Symbol('counter');
|
||||||
|
@ -12,7 +13,11 @@ export const setup = async (cookiePath) => {
|
||||||
cookies = await readFile(cookiePath, 'utf8');
|
cookies = await readFile(cookiePath, 'utf8');
|
||||||
cookies = JSON.parse(cookies);
|
cookies = JSON.parse(cookies);
|
||||||
intervalId = setInterval(writeChanges, WRITE_INTERVAL);
|
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() {
|
function writeChanges() {
|
||||||
|
|
Loading…
Reference in a new issue