@open-wa/wa-automate 4.35.9 → 4.35.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -75,7 +75,7 @@ exports.pkg = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../package.j
|
|
75
75
|
*/
|
76
76
|
//@ts-ignore
|
77
77
|
function create(config = {}) {
|
78
|
-
var _a, _b, _c;
|
78
|
+
var _a, _b, _c, _d;
|
79
79
|
return __awaiter(this, void 0, void 0, function* () {
|
80
80
|
const START_TIME = Date.now();
|
81
81
|
if (config.logging) {
|
@@ -151,6 +151,8 @@ function create(config = {}) {
|
|
151
151
|
const qrManager = new auth_1.QRManager(config);
|
152
152
|
const RAM_INFO = `Total: ${parseFloat(`${os.totalmem() / 1000000000}`).toFixed(2)} GB | Free: ${parseFloat(`${os.freemem() / 1000000000}`).toFixed(2)} GB`;
|
153
153
|
logging_1.log.info("RAM INFO", RAM_INFO);
|
154
|
+
const PPTR_VERSION = ((_a = (0, fs_extra_1.readJsonSync)(path.join(__dirname, '../../node_modules/puppeteer/package.json'), { throws: false })) === null || _a === void 0 ? void 0 : _a.version) || "UNKNOWN";
|
155
|
+
logging_1.log.info("PPTR VERSION INFO", PPTR_VERSION);
|
154
156
|
try {
|
155
157
|
if (typeof config === 'string')
|
156
158
|
console.error("AS OF VERSION 3+ YOU CAN NO LONGER SET THE SESSION ID AS THE FIRST PARAMETER OF CREATE. CREATE CAN ONLY TAKE A CONFIG OBJECT. IF YOU STILL HAVE CONFIGS AS A SECOND PARAMETER, THEY WILL HAVE NO EFFECT! PLEASE SEE DOCS.");
|
@@ -207,7 +209,8 @@ function create(config = {}) {
|
|
207
209
|
BROWSER_VERSION,
|
208
210
|
OS,
|
209
211
|
START_TS,
|
210
|
-
RAM_INFO
|
212
|
+
RAM_INFO,
|
213
|
+
PPTR_VERSION
|
211
214
|
};
|
212
215
|
if ((config === null || config === void 0 ? void 0 : config.logDebugInfoAsObject) || (config === null || config === void 0 ? void 0 : config.disableSpins))
|
213
216
|
spinner.succeed(`Debug info: ${JSON.stringify(debugInfo, null, 2)}`);
|
@@ -332,7 +335,7 @@ function create(config = {}) {
|
|
332
335
|
return JSON.stringify(window.localStorage);
|
333
336
|
}));
|
334
337
|
const stdSessionJsonPath = ((config === null || config === void 0 ? void 0 : config.sessionDataPath) && (config === null || config === void 0 ? void 0 : config.sessionDataPath.includes('.data.json'))) ? path.join(path.resolve(process.cwd(), (config === null || config === void 0 ? void 0 : config.sessionDataPath) || '')) : path.join(path.resolve(process.cwd(), (config === null || config === void 0 ? void 0 : config.sessionDataPath) || ''), `${sessionId || 'session'}.data.json`);
|
335
|
-
const altMainModulePath = ((
|
338
|
+
const altMainModulePath = ((_b = require === null || require === void 0 ? void 0 : require.main) === null || _b === void 0 ? void 0 : _b.path) || ((_c = process === null || process === void 0 ? void 0 : process.mainModule) === null || _c === void 0 ? void 0 : _c.path);
|
336
339
|
const altSessionJsonPath = !altMainModulePath ? null : ((config === null || config === void 0 ? void 0 : config.sessionDataPath) && (config === null || config === void 0 ? void 0 : config.sessionDataPath.includes('.data.json'))) ? path.join(path.resolve(altMainModulePath, (config === null || config === void 0 ? void 0 : config.sessionDataPath) || '')) : path.join(path.resolve(altMainModulePath, (config === null || config === void 0 ? void 0 : config.sessionDataPath) || ''), `${sessionId || 'session'}.data.json`);
|
337
340
|
const sessionjsonpath = altSessionJsonPath && fs.existsSync(altSessionJsonPath) ? altSessionJsonPath : stdSessionJsonPath;
|
338
341
|
const sessionData = {
|
@@ -454,7 +457,7 @@ function create(config = {}) {
|
|
454
457
|
console.error(error.stack);
|
455
458
|
}
|
456
459
|
yield (0, browser_1.kill)(waPage);
|
457
|
-
if (error.name === "ProtocolError" && ((
|
460
|
+
if (error.name === "ProtocolError" && ((_d = error.message) === null || _d === void 0 ? void 0 : _d.includes("Target closed"))) {
|
458
461
|
spinner.fail(error.message);
|
459
462
|
process.exit();
|
460
463
|
}
|
package/package.json
CHANGED