Skip to content

best way to save what you love

api/cookies: log message to confirm successful file load

jjb434b0b45e25
diff --git a/api/src/processing/cookie/manager.js b/api/src/processing/cookie/manager.js
index 3afb4bfd..060f8695 100644
--- a/api/src/processing/cookie/manager.js
+++ b/api/src/processing/cookie/manager.js
@@ -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() {