From 05766144737af76c018f5ae7532a05b1a4f68474 Mon Sep 17 00:00:00 2001 From: adriano Date: Mon, 9 Jan 2023 20:09:17 -0300 Subject: [PATCH] =?UTF-8?q?Altera=C3=A7=C3=A3o=20na=20instacia=20do=20chro?= =?UTF-8?q?me?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/libs/wbot.ts | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/backend/src/libs/wbot.ts b/backend/src/libs/wbot.ts index 9c926fb..c024161 100644 --- a/backend/src/libs/wbot.ts +++ b/backend/src/libs/wbot.ts @@ -70,10 +70,24 @@ export const initWbot = async (whatsapp: Whatsapp, backupSessionRestore: boolean // }); // usando instancia do chrome + // const wbot: Session = new Client({ + // session: sessionCfg, authStrategy: new LocalAuth({ clientId: 'bd_' + whatsapp.id }), + // // puppeteer: { args: ['--no-sandbox', '--disable-setuid-sandbox'], executablePath: process.env.CHROME_BIN || undefined }, + // puppeteer: { args: ['--no-sandbox', '--disable-setuid-sandbox'], executablePath: process.env.CHROME_BIN || '/usr/bin/google-chrome-stable' }, + + // }); + + const args:String = process.env.CHROME_ARGS || ""; + const wbot: Session = new Client({ - session: sessionCfg, authStrategy: new LocalAuth({ clientId: 'bd_' + whatsapp.id }), - // puppeteer: { args: ['--no-sandbox', '--disable-setuid-sandbox'], executablePath: process.env.CHROME_BIN || undefined }, - puppeteer: { args: ['--no-sandbox', '--disable-setuid-sandbox'], executablePath: process.env.CHROME_BIN || '/usr/bin/google-chrome-stable' }, + session: sessionCfg, + authStrategy: new LocalAuth({ clientId: 'bd_' + whatsapp.id }), + puppeteer: { + executablePath: process.env.CHROME_BIN || undefined, + // @ts-ignore + browserWSEndpoint: process.env.CHROME_WS || undefined, + args: args.split(' ') + } });