new(all): Custom Domain support per bot.

This commit is contained in:
rodrigorodriguez 2022-10-09 23:35:13 -03:00
parent 4cc95e8dbe
commit 6a7c2eb0f5

View file

@ -202,7 +202,7 @@ export class WhatsappDirectLine extends GBService {
client.on('authenticated', async () => { client.on('authenticated', async () => {
this.browserWSEndpoint = client.pupBrowser.wsEndpoint(); this.browserWSEndpoint = client.pupBrowser.wsEndpoint();
GBLog.info(`\nGBWhatsApp: QR Code authenticated for ${this.botId}.`); GBLog.verbose(`\nGBWhatsApp: QR Code authenticated for ${this.botId}.`);
}); });
client.on('ready', async () => { client.on('ready', async () => {
@ -212,7 +212,7 @@ export class WhatsappDirectLine extends GBService {
await (createClient.bind(this))(null); await (createClient.bind(this))(null);
}).bind(this)); }).bind(this));
GBLog.info(`\nGBWhatsApp: Emptying chat list for ${this.botId}...`); GBLog.verbose(`\nGBWhatsApp: Emptying chat list for ${this.botId}...`);
// Keeps the chat list cleaned. // Keeps the chat list cleaned.
@ -299,15 +299,11 @@ export class WhatsappDirectLine extends GBService {
} }
public async check() { public async check() {
GBLog.info(`GBWhatsapp: Checking server...`);
switch (this.provider) { switch (this.provider) {
case 'GeneralBots': case 'GeneralBots':
const info = await this.customClient.getState(); return true;
return info == "CONNECTED";
default: default:
GBLog.verbose(`GBWhatsapp: Checking server...`);
const options = { const options = {
url: urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`, url: urlJoin(this.whatsappServiceUrl, 'status') + `?token=${this.min.instance.whatsappServiceKey}`,
method: 'GET' method: 'GET'
@ -317,7 +313,6 @@ export class WhatsappDirectLine extends GBService {
const json = JSON.parse(res); const json = JSON.parse(res);
return json.accountStatus === 'authenticated'; return json.accountStatus === 'authenticated';
break;
} }
} }
@ -928,8 +923,7 @@ export class WhatsappDirectLine extends GBService {
switch (provider) { switch (provider) {
case "GeneralBots": case "GeneralBots":
if (req.type && req.type === 'e2e_notification') if (req.type && req.type === 'e2e_notification') {
{
return; return;
} }