new(all): Custom Domain support per bot.

This commit is contained in:
rodrigorodriguez 2022-10-02 14:25:11 -03:00
parent c29efe794c
commit 0aa358aa98
2 changed files with 19 additions and 17 deletions

View file

@ -81,22 +81,24 @@ const RENDER_CACHE = new Map();
async function createBrowser(profile): Promise<any> {
const gbaiName = `${this.min.botId}.gbai`;
let localName = Path.join('work', gbaiName, 'profile');
async function createBrowser(profilePath): Promise<any> {
let args = [
'--ignore-certificate-errors',
'--no-sandbox',
'--disable-setuid-sandbox',
'--window-size=1920,1080',
"--disable-accelerated-2d-canvas",
"--disable-gpu",
"--disable-features=site-per-process"
];
if (profilePath){
args.push(`--user-data-dir=${profilePath}`);
}
const browser = await puppeteer.launch({
args: [
'--ignore-certificate-errors',
'--no-sandbox',
'--disable-setuid-sandbox',
'--window-size=1920,1080',
"--disable-accelerated-2d-canvas",
"--disable-gpu",
"--disable-features=site-per-process",
`--user-data-dir=${localName}`
],
args: args,
ignoreHTTPSErrors: true,
headless: false,
});

View file

@ -136,10 +136,10 @@ export class WhatsappDirectLine extends GBService {
// Initialize the browser using a local profile for each bot.
const gbaiName = `${this.min.botId}.gbai`;
let localName = Path.join('work', gbaiName, 'profile');
const localName = Path.join('work', gbaiName, 'profile');
const browser = await createBrowser(null);
let client = this.customClient = new Client({
const browser = await createBrowser(localName);
const client = this.customClient = new Client({
authStrategy: new LocalAuth({
clientId: this.min.botId,
dataPath: localName