fix(all): Fixing #294.
This commit is contained in:
parent
21df92e280
commit
25ce766820
6 changed files with 817 additions and 27 deletions
795
package-lock.json
generated
795
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -53,18 +53,19 @@
|
|||
"@azure/cognitiveservices-computervision": "8.2.0",
|
||||
"@azure/keyvault-keys": "4.6.0",
|
||||
"@azure/ms-rest-js": "2.6.2",
|
||||
"@azure/msal-node": "1.14.3",
|
||||
"@azure/search-documents": "^11.3.1",
|
||||
"@google-cloud/pubsub": "3.2.1",
|
||||
"@google-cloud/translate": "7.0.4",
|
||||
"@hubspot/api-client": "7.1.2",
|
||||
"@microsoft/microsoft-graph-client": "3.0.4",
|
||||
"@nosferatu500/textract": "3.1.2",
|
||||
"@semantic-release/changelog": "6.0.1",
|
||||
"@semantic-release/exec": "6.0.3",
|
||||
"@semantic-release/git": "10.0.1",
|
||||
"@sendgrid/mail": "7.7.0",
|
||||
"@types/node": "18.11.9",
|
||||
"@types/validator": "13.7.10",
|
||||
"@azure/msal-node": "1.14.3",
|
||||
"adm-zip": "0.5.9",
|
||||
"alasql": "2.1.6",
|
||||
"any-shell-escape": "0.1.1",
|
||||
|
@ -142,7 +143,6 @@
|
|||
"swagger-client": "^3.18.5",
|
||||
"tabulator-tables": "5.4.2",
|
||||
"tedious": "15.1.2",
|
||||
"@nosferatu500/textract": "3.1.2",
|
||||
"twitter-api-v2": "1.12.9",
|
||||
"typescript": "4.9.3",
|
||||
"typescript-rest-rpc": "^1.0.7",
|
||||
|
@ -155,6 +155,7 @@
|
|||
"washyourmouthoutwithsoap": "1.0.2",
|
||||
"whatsapp-web.js": "1.18.3",
|
||||
"winston": "3.8.2",
|
||||
"winston-logs-display": "^1.0.0",
|
||||
"yarn": "^1.22.19"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -41,9 +41,7 @@ import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
|
|||
import { SecService } from '../../security.gbapp/services/SecService.js';
|
||||
import { SystemKeywords } from './SystemKeywords.js';
|
||||
import * as wpp from 'whatsapp-web.js';
|
||||
import { HubSpotServices } from '../../hubspot.gblib/services/HubSpotServices.js';
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
|
||||
import * as request from 'request-promise-native';
|
||||
import { Messages } from '../strings.js';
|
||||
import * as Fs from 'fs';
|
||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||
|
@ -678,11 +676,10 @@ export class DialogKeywords {
|
|||
} else {
|
||||
// arraybuffer is necessary for images
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'GET',
|
||||
encoding: 'binary'
|
||||
};
|
||||
response = await request.get(options);
|
||||
response = await fetch(url, options);
|
||||
}
|
||||
|
||||
Fs.writeFile(localFileName, response, fsError => {
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
import { GBDialogStep, GBLog, GBMinInstance } from 'botlib';
|
||||
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
||||
import { CollectionUtil } from 'pragmatismo-io-framework';
|
||||
import * as request from 'request-promise-native';
|
||||
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
|
||||
import { DialogKeywords } from './DialogKeywords.js';
|
||||
|
@ -360,12 +360,11 @@ export class SystemKeywords {
|
|||
*/
|
||||
public async getFileContents ({ url, headers }) {
|
||||
const options = {
|
||||
url: url,
|
||||
method: 'GET',
|
||||
encoding: 'binary',
|
||||
headers: headers
|
||||
};
|
||||
return await request(options); // TODO: Check this.
|
||||
return await fetch(url, options);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@ import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
|
|||
import { createBrowser } from '../../core.gbapp/services/GBSSR.js';
|
||||
import { GuaribasUser } from '../../security.gbapp/models/index.js';
|
||||
import { DialogKeywords } from './DialogKeywords.js';
|
||||
import * as request from 'request-promise-native';
|
||||
|
||||
import { GBDeployer } from '../../core.gbapp/services/GBDeployer.js';
|
||||
import urlJoin from 'url-join';
|
||||
import Fs from 'fs';
|
||||
|
@ -349,7 +349,8 @@ export class WebAutomationKeywords {
|
|||
if (local) {
|
||||
result = Fs.readFileSync(local);
|
||||
} else {
|
||||
result = await request.get(options);
|
||||
const res = await fetch(options.uri, options);
|
||||
result = Buffer.from(await res.arrayBuffer());
|
||||
}
|
||||
let { baseUrl, client } = await GBDeployer.internalGetDriveClient(this.min);
|
||||
const botId = this.min.instance.botId;
|
||||
|
|
|
@ -46,6 +46,8 @@ import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
|||
import * as wpp from 'whatsapp-web.js';
|
||||
import qrcode from 'qrcode-terminal';
|
||||
import express from 'express';
|
||||
import { DialogKeywords } from '../../basic.gblib/services/DialogKeywords.js';
|
||||
import { GBAdminService } from '../../admin.gbapp/services/GBAdminService.js';
|
||||
|
||||
/**
|
||||
* Support for Whatsapp.
|
||||
|
@ -187,19 +189,20 @@ export class WhatsappDirectLine extends GBService {
|
|||
|
||||
// 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 gbaiName = `${this.min.botId}.gbai`;
|
||||
// const localName = Path.join('work', gbaiName, 'cache', `qr${GBAdminService.getRndReadableIdentifier()}.png`);
|
||||
// Fs.writeFileSync(localName, qrBuf);
|
||||
// const url = urlJoin(
|
||||
// GBServer.globals.publicAddress,
|
||||
// this.min.botId,
|
||||
// 'cache',
|
||||
// Path.basename(localName)
|
||||
// );
|
||||
// GBServer.globals.minBoot.whatsAppDirectLine.sendFileToDevice(adminNumber, url, Path.basename(localName), msg);
|
||||
// s.sendEmail(adminEmail, `Check your WhatsApp for bot ${this.botId}`, msg);
|
||||
const s = new DialogKeywords(this.min, null, null);
|
||||
const qrBuf = await s.getQRCode(qr);
|
||||
const gbaiName = `${this.min.botId}.gbai`;
|
||||
const localName = Path.join('work', gbaiName, 'cache', `qr${GBAdminService.getRndReadableIdentifier()}.png`);
|
||||
Fs.writeFileSync(localName, qrBuf);
|
||||
const url = urlJoin(
|
||||
GBServer.globals.publicAddress,
|
||||
this.min.botId,
|
||||
'cache',
|
||||
Path.basename(localName)
|
||||
);
|
||||
GBServer.globals.minBoot.whatsAppDirectLine.sendFileToDevice(adminNumber, url, Path.basename(localName), msg);
|
||||
|
||||
s.sendEmail({to:adminEmail, subject:`Check your WhatsApp for bot ${this.botId}`, body:msg);
|
||||
}).bind(this)
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue