fixed browser, made payload optional

This commit is contained in:
Boki 2025-06-20 22:16:13 -04:00
parent 917f91715a
commit cde67db271
9 changed files with 10 additions and 12 deletions

View file

@ -171,10 +171,15 @@ class BrowserSingleton {
if (proxy) {
const [protocol, rest] = proxy.split('://');
if (!rest) {
throw new Error('Invalid proxy format. Expected protocol://host:port or protocol://user:pass@host:port');
}
const [auth, hostPort] = rest.includes('@') ? rest.split('@') : [null, rest];
const [host, port] = hostPort.split(':');
const finalHostPort = hostPort || rest;
const [host, port] = finalHostPort.split(':');
contextOptions.proxy = {
contextOptions['proxy'] = {
server: `${protocol}://${host}:${port}`,
username: auth?.split(':')[0] || '',
password: auth?.split(':')[1] || '',