enable/disable headless via .env
This commit is contained in:
parent
8a1597a6c8
commit
0b5ce37af8
@ -7,7 +7,15 @@
|
|||||||
* [x] JS (not TS)
|
* [x] JS (not TS)
|
||||||
* [x] commonjs
|
* [x] commonjs
|
||||||
|
|
||||||
|
### Docs
|
||||||
|
|
||||||
|
#### Alby Event numbers and their meanings
|
||||||
|
|
||||||
|
Action 0: heartbeat
|
||||||
|
Action 4:
|
||||||
|
Action 10: Presence?
|
||||||
|
Action 11:
|
||||||
|
Action 15: Broadcast
|
||||||
|
|
||||||
### Ideas
|
### Ideas
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "vitest --watch",
|
||||||
"start": "bash -x watchdog.sh"
|
"start": "bash -x watchdog.sh"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
"license": "ISC",
|
"license": "Unlicense",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@dotenvx/dotenvx": "^1.44.1",
|
"@dotenvx/dotenvx": "^1.44.1",
|
||||||
"pino": "^9.7.0",
|
"pino": "^9.7.0",
|
||||||
|
@ -47,7 +47,7 @@ function createWebSocketIterator() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
(async () => {
|
(async () => {
|
||||||
const browser = await puppeteer.launch();
|
const browser = await puppeteer.launch({ headless: env.HEADLESS });
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
|
|
||||||
const client = await page.target().createCDPSession();
|
const client = await page.target().createCDPSession();
|
||||||
@ -62,7 +62,7 @@ function createWebSocketIterator() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
client.on('Network.webSocketFrameReceived', ({ requestId, timestamp, response }) => {
|
client.on('Network.webSocketFrameReceived', ({ requestId, timestamp, response }) => {
|
||||||
// logger.debug('FrameReceived:', response.payloadData);
|
logger.debug('FrameReceived:', response.payloadData);
|
||||||
push(response.payloadData);
|
push(response.payloadData);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -79,7 +79,7 @@ function createWebSocketIterator() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
})().catch((err) => {
|
})().catch((err) => {
|
||||||
logger.error('Fatal error:', err);
|
logger.error(`Fatal error: ${err}`);
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ const EnvSchema = z.object({
|
|||||||
CB_ROOM: z.string(),
|
CB_ROOM: z.string(),
|
||||||
NODE_ENV: z.enum(['development', 'production', 'test']),
|
NODE_ENV: z.enum(['development', 'production', 'test']),
|
||||||
LOG_LEVEL: z.enum(['debug', 'info']).optional(),
|
LOG_LEVEL: z.enum(['debug', 'info']).optional(),
|
||||||
|
HEADLESS: z.coerce.boolean().default(false),
|
||||||
});
|
});
|
||||||
|
|
||||||
const parsed = EnvSchema.safeParse(process.env);
|
const parsed = EnvSchema.safeParse(process.env);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user