@open-wa/wa-automate 4.53.0 → 4.54.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1262,8 +1262,8 @@ class Client {
1262
1262
  if (this._currentlyBeingKilled)
1263
1263
  return;
1264
1264
  this._currentlyBeingKilled = true;
1265
- console.log('Killing client. Shutting Down');
1266
- logging_1.log.info('Killing client. Shutting Down');
1265
+ console.log(`Killing client. Shutting Down: ${reason}`);
1266
+ logging_1.log.info(`Killing client. Shutting Down: ${reason}`);
1267
1267
  const browser = yield ((_a = this === null || this === void 0 ? void 0 : this._page) === null || _a === void 0 ? void 0 : _a.browser());
1268
1268
  const pid = (browser === null || browser === void 0 ? void 0 : browser.process()) ? (_b = browser === null || browser === void 0 ? void 0 : browser.process()) === null || _b === void 0 ? void 0 : _b.pid : null;
1269
1269
  try {
@@ -1676,6 +1676,7 @@ class Client {
1676
1676
  }))(),
1677
1677
  (0, tools_1.assertFile)(file, filename, tools_1.FileOutputTypes.TEMP_FILE_PATH, requestConfig || {})
1678
1678
  ]);
1679
+ //@ts-ignore
1679
1680
  yield inputElement.uploadFile(fileAsLocalTemp);
1680
1681
  file = inputElementId;
1681
1682
  /**
@@ -2246,7 +2247,8 @@ class Client {
2246
2247
  */
2247
2248
  getTunnelCode() {
2248
2249
  return __awaiter(this, void 0, void 0, function* () {
2249
- return yield this.pup(() => WAPI.getTunnelCode());
2250
+ const sessionId = this.getSessionId();
2251
+ return yield this.pup(sessionId => WAPI.getTunnelCode(sessionId), sessionId);
2250
2252
  });
2251
2253
  }
2252
2254
  /**
package/dist/cli/index.js CHANGED
@@ -42,6 +42,8 @@ function start() {
42
42
  const { cliConfig, createConfig, PORT, spinner } = yield (0, setup_1.cli)();
43
43
  process.env.OWA_CLI = "true";
44
44
  spinner.start("Launching EASY API");
45
+ if (cliConfig.verbose)
46
+ index_1.log.info(`config: `, { cliConfig, createConfig, PORT });
45
47
  (0, server_1.setUpExpressApp)();
46
48
  if (cliConfig.cors)
47
49
  yield (0, server_1.enableCORSRequests)(cliConfig);
@@ -201,7 +203,7 @@ function start() {
201
203
  spinner.info(`\n• Setting up external tunnel`);
202
204
  const tunnel = yield (0, localtunnel_1.default)({
203
205
  port: PORT,
204
- host: "https://public.openwa.cloud",
206
+ host: process.env.WA_TUNNEL_SERVER || "https://public.openwa.cloud",
205
207
  subdomain: yield client.getTunnelCode()
206
208
  });
207
209
  cliConfig.apiHost = cliConfig.tunnel = tunnel.url;
@@ -311,6 +311,7 @@ const setupChatwootOutgoingMessageHandler = (cliConfig, client) => __awaiter(voi
311
311
  }
312
312
  });
313
313
  const sendConversationMessage = (content, contactId, message) => __awaiter(void 0, void 0, void 0, function* () {
314
+ __1.log.info(`INCOMING MESSAGE ${contactId}: ${content} ${message.id}`);
314
315
  try {
315
316
  const { data } = yield cwReq('post', `conversations/${convoReg[contactId]}/messages`, {
316
317
  content,
@@ -326,6 +327,7 @@ const setupChatwootOutgoingMessageHandler = (cliConfig, client) => __awaiter(voi
326
327
  const sendAttachmentMessage = (content, contactId, message) => __awaiter(void 0, void 0, void 0, function* () {
327
328
  // decrypt message
328
329
  const file = yield client.decryptMedia(message);
330
+ __1.log.info(`INCOMING MESSAGE ATTACHMENT ${contactId}: ${content} ${message.id}`);
329
331
  let formData = new form_data_1.default();
330
332
  formData.append('attachments[]', Buffer.from(file.split(',')[1], 'base64'), {
331
333
  knownLength: 1,
@@ -231,7 +231,7 @@ class QRManager {
231
231
  }
232
232
  if (!gotResult && (qrData === 'QR_CODE_SUCCESS' || qrData === md)) {
233
233
  gotResult = true;
234
- spinner === null || spinner === void 0 ? void 0 : spinner.succeed(qrData === md ? "Multi device support for this project is EXPERIMENTAL. Some things may not work...." : "QR code scanned. Loading session...");
234
+ spinner === null || spinner === void 0 ? void 0 : spinner.succeed("QR code scanned. Loading session...");
235
235
  return resolve(yield isInsideChat(waPage).toPromise());
236
236
  }
237
237
  if (!gotResult)
@@ -41,6 +41,7 @@ const fs = __importStar(require("fs/promises"));
41
41
  const death_1 = __importDefault(require("death"));
42
42
  // import puppeteer from 'puppeteer-extra';
43
43
  const puppeteer_config_1 = require("../config/puppeteer.config");
44
+ const puppeteer_1 = require("puppeteer");
44
45
  const events_1 = require("./events");
45
46
  const pico_s3_1 = require("pico-s3");
46
47
  // eslint-disable-next-line @typescript-eslint/no-var-requires
@@ -457,6 +458,11 @@ function initBrowser(sessionId, config = {}, spinner) {
457
458
  browserDownloadSpinner.succeed('Something went wrong while downloading the browser');
458
459
  }
459
460
  }
461
+ /**
462
+ * Explicit fallback due to pptr 19
463
+ */
464
+ if (!config.executablePath)
465
+ config.executablePath = (0, puppeteer_1.executablePath)();
460
466
  if (((_a = config === null || config === void 0 ? void 0 : config.proxyServerCredentials) === null || _a === void 0 ? void 0 : _a.address) && (config === null || config === void 0 ? void 0 : config.useNativeProxy))
461
467
  puppeteer_config_1.puppeteerConfig.chromiumArgs.push(`--proxy-server=${config.proxyServerCredentials.address}`);
462
468
  if (config === null || config === void 0 ? void 0 : config.browserWsEndpoint)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate",
3
- "version": "4.53.0",
3
+ "version": "4.54.1",
4
4
  "licenseCheckUrl": "https://funcs.openwa.dev/license-check",
5
5
  "brokenMethodReportUrl": "https://funcs.openwa.dev/report-bm",
6
6
  "patches": "https://cdn.openwa.dev/patches.json",
@@ -76,7 +76,7 @@
76
76
  "@types/marked": "^4.0.2",
77
77
  "@types/mime": "^3.0.1",
78
78
  "@types/node": "^18.7.6",
79
- "@types/puppeteer": "^5.4.0",
79
+ "@types/puppeteer": "^7.0.4",
80
80
  "@types/shelljs": "^0.8.5",
81
81
  "@types/winston-syslog": "^2.4.0",
82
82
  "@typescript-eslint/eslint-plugin": "^5.8.0",
@@ -154,17 +154,17 @@
154
154
  "pidtree": "^0.6.0",
155
155
  "pidusage": "^3.0.0",
156
156
  "postman-2-swagger": "^0.5.0",
157
- "puppeteer": "15.0.0",
158
- "puppeteer-extra": "^3.2.3",
159
- "puppeteer-extra-plugin-block-resources": "^2.4.0",
160
- "puppeteer-extra-plugin-devtools": "^2.4.0",
161
- "puppeteer-extra-plugin-stealth": "^2.10.1",
157
+ "puppeteer": "^19.4.1",
158
+ "puppeteer-extra": "^3.3.4",
159
+ "puppeteer-extra-plugin-block-resources": "^2.4.2",
160
+ "puppeteer-extra-plugin-devtools": "^2.4.4",
161
+ "puppeteer-extra-plugin-stealth": "^2.11.1",
162
162
  "qrcode-terminal": "^0.12.0",
163
163
  "qs": "^6.10.1",
164
164
  "rxjs": "^7.0.0",
165
165
  "smashah-puppeteer-page-proxy": "^1.2.8",
166
- "socket.io": "^4.4.1",
167
- "socket.io-client": "^4.1.1",
166
+ "socket.io": "^4.5.4",
167
+ "socket.io-client": "^4.5.4",
168
168
  "spinnies": "^0.5.1",
169
169
  "swagger-stats": "^0.99.1",
170
170
  "swagger-ui-dist": "^4.1.3",