new(all): Custom Domain support per bot.
This commit is contained in:
parent
c29efe794c
commit
0aa358aa98
2 changed files with 19 additions and 17 deletions
|
@ -81,22 +81,24 @@ const RENDER_CACHE = new Map();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
async function createBrowser(profile): Promise<any> {
|
async function createBrowser(profilePath): Promise<any> {
|
||||||
const gbaiName = `${this.min.botId}.gbai`;
|
|
||||||
let localName = Path.join('work', gbaiName, 'profile');
|
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({
|
const browser = await puppeteer.launch({
|
||||||
args: [
|
args: 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}`
|
|
||||||
|
|
||||||
],
|
|
||||||
ignoreHTTPSErrors: true,
|
ignoreHTTPSErrors: true,
|
||||||
headless: false,
|
headless: false,
|
||||||
});
|
});
|
||||||
|
|
|
@ -136,10 +136,10 @@ export class WhatsappDirectLine extends GBService {
|
||||||
|
|
||||||
// Initialize the browser using a local profile for each bot.
|
// Initialize the browser using a local profile for each bot.
|
||||||
const gbaiName = `${this.min.botId}.gbai`;
|
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);
|
const browser = await createBrowser(localName);
|
||||||
let client = this.customClient = new Client({
|
const client = this.customClient = new Client({
|
||||||
authStrategy: new LocalAuth({
|
authStrategy: new LocalAuth({
|
||||||
clientId: this.min.botId,
|
clientId: this.min.botId,
|
||||||
dataPath: localName
|
dataPath: localName
|
||||||
|
|
Loading…
Add table
Reference in a new issue