From 8a7dcb5198cff5493e3f09b3a8fc2a85e211932b Mon Sep 17 00:00:00 2001 From: Rodrigo Rodriguez Date: Tue, 26 Dec 2023 21:43:23 -0300 Subject: [PATCH] fix(core.gbapp): #387 adding /setupSecurity multiple tokens. Refresh token fix. @othonlima. --- packages/basic.gblib/services/GBVMService.ts | 4 ++-- packages/whatsapp.gblib/services/WhatsappDirectLine.ts | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/basic.gblib/services/GBVMService.ts b/packages/basic.gblib/services/GBVMService.ts index 954c05ea..795e1f99 100644 --- a/packages/basic.gblib/services/GBVMService.ts +++ b/packages/basic.gblib/services/GBVMService.ts @@ -620,8 +620,9 @@ export class GBVMService extends GBService { console.log(tokenName + ' updated.'); } - + console.log(i); if (i === 0) { + console.log('auth defined bear OK: ' + global[tokenName]); headers['Authorization'] = 'Bearer ' + global[tokenName]; } } @@ -965,7 +966,6 @@ export class GBVMService extends GBService { }); sandbox['tokens'] = tokensList.join(','); - console.log(sandbox['tokens']); sandbox['variables'] = variables; sandbox['id'] = sys.getRandomId(); sandbox['username'] = await dk.userName({ pid }); diff --git a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts index 69e4e8bd..e9bd58bd 100644 --- a/packages/whatsapp.gblib/services/WhatsappDirectLine.ts +++ b/packages/whatsapp.gblib/services/WhatsappDirectLine.ts @@ -155,9 +155,9 @@ export class WhatsappDirectLine extends GBService { const adminEmail = this.min.core.getParam(this.min.instance, 'Bot Admin E-mail', null); // Sends QR Code to boot bot admin. const msg = `Please, scan QR Code with for bot ${this.botId}.`; - GBLog.info(msg); qrcode.generate(qr, { small: true, scale: 0.5 }); - // While handling other bots uses boot instance of this class to send QR Codes. + + // TODO: While handling other bots uses boot instance of this class to send QR Codes. // const s = new DialogKeywords(min., null, null, null); // const qrBuf = await s.getQRCode(qr); // const localName = Path.join('work', gbaiName, 'cache', `qr${GBAdminService.getRndReadableIdentifier()}.png`); @@ -170,6 +170,7 @@ export class WhatsappDirectLine extends GBService { // ); // GBServer.globals.minBoot.whatsAppDirectLine.sendFileToDevice(adminNumber, url, Path.basename(localName), msg); // s.sendEmail(adminEmail, `Check your WhatsApp for bot ${this.botId}`, msg); + }).bind(this) ); client.on('authenticated', async () => {