enable/disable headless via .env
Some checks failed
ci / build (push) Failing after 1m40s
ci / Tests & Checks (push) Failing after 1s

This commit is contained in:
CJ_Clippy 2025-07-30 12:06:02 -08:00
parent 8a1597a6c8
commit 0b5ce37af8
4 changed files with 14 additions and 5 deletions

View File

@ -7,7 +7,15 @@
* [x] JS (not TS)
* [x] commonjs
### Docs
#### Alby Event numbers and their meanings
Action 0: heartbeat
Action 4:
Action 10: Presence?
Action 11:
Action 15: Broadcast
### Ideas

View File

@ -4,12 +4,12 @@
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "vitest --watch",
"start": "bash -x watchdog.sh"
},
"keywords": [],
"author": "",
"license": "ISC",
"license": "Unlicense",
"dependencies": {
"@dotenvx/dotenvx": "^1.44.1",
"pino": "^9.7.0",

View File

@ -47,7 +47,7 @@ function createWebSocketIterator() {
};
(async () => {
const browser = await puppeteer.launch();
const browser = await puppeteer.launch({ headless: env.HEADLESS });
const page = await browser.newPage();
const client = await page.target().createCDPSession();
@ -62,7 +62,7 @@ function createWebSocketIterator() {
});
client.on('Network.webSocketFrameReceived', ({ requestId, timestamp, response }) => {
// logger.debug('FrameReceived:', response.payloadData);
logger.debug('FrameReceived:', response.payloadData);
push(response.payloadData);
});
@ -79,7 +79,7 @@ function createWebSocketIterator() {
});
})().catch((err) => {
logger.error('Fatal error:', err);
logger.error(`Fatal error: ${err}`);
close();
});

View File

@ -7,6 +7,7 @@ const EnvSchema = z.object({
CB_ROOM: z.string(),
NODE_ENV: z.enum(['development', 'production', 'test']),
LOG_LEVEL: z.enum(['debug', 'info']).optional(),
HEADLESS: z.coerce.boolean().default(false),
});
const parsed = EnvSchema.safeParse(process.env);