enable/disable headless via .env
This commit is contained in:
parent
8a1597a6c8
commit
0b5ce37af8
@ -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
|
||||
|
||||
|
@ -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",
|
||||
|
@ -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();
|
||||
});
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user