@open-wa/wa-automate 4.44.5 → 4.44.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/api/Client.js
CHANGED
@@ -189,10 +189,11 @@ class Client {
|
|
189
189
|
this.middleware = (useSessionIdInPath = false) => (req, res, next) => __awaiter(this, void 0, void 0, function* () {
|
190
190
|
if (useSessionIdInPath && !req.path.includes(this._createConfig.sessionId) && this._createConfig.sessionId !== 'session')
|
191
191
|
return next();
|
192
|
+
const methodFromPath = this._createConfig.sessionId && this._createConfig.sessionId !== 'session' && req.path.includes(this._createConfig.sessionId) ? req.path.replace(`/${this._createConfig.sessionId}/`, '') : req.path.replace('/', '');
|
192
193
|
if (req.method === 'POST') {
|
193
194
|
const rb = (req === null || req === void 0 ? void 0 : req.body) || {};
|
194
195
|
let { args } = rb;
|
195
|
-
const m = (rb === null || rb === void 0 ? void 0 : rb.method) ||
|
196
|
+
const m = (rb === null || rb === void 0 ? void 0 : rb.method) || methodFromPath;
|
196
197
|
logging_1.log.info(`MDLWR - ${m} : ${JSON.stringify(rb || {})}`);
|
197
198
|
let methodRequiresArgs = false;
|
198
199
|
if (args && !Array.isArray(args)) {
|
@@ -231,6 +232,17 @@ class Client {
|
|
231
232
|
}
|
232
233
|
return res.status(404).send(`Cannot find method: ${m}`);
|
233
234
|
}
|
235
|
+
if (req.method === "GET") {
|
236
|
+
if (["snapshot", "getSnapshot"].includes(methodFromPath)) {
|
237
|
+
const snapshot = yield this.getSnapshot();
|
238
|
+
const snapshotBuffer = Buffer.from(snapshot.split(',')[1], 'base64');
|
239
|
+
res.writeHead(200, {
|
240
|
+
'Content-Type': 'image/png',
|
241
|
+
'Content-Length': snapshotBuffer.length
|
242
|
+
});
|
243
|
+
return res.end(snapshotBuffer);
|
244
|
+
}
|
245
|
+
}
|
234
246
|
return next();
|
235
247
|
});
|
236
248
|
this._page = page;
|
@@ -49,6 +49,7 @@ const puppeteerConfig = {
|
|
49
49
|
// '--no-zygote',
|
50
50
|
// '--renderer-process-limit=1',
|
51
51
|
// '--no-first-run'
|
52
|
+
'--disable-features=site-per-process',
|
52
53
|
'--disable-gl-drawing-for-tests',
|
53
54
|
//keep awake in all situations
|
54
55
|
'--disable-background-timer-throttling',
|
@@ -57,7 +58,7 @@ const puppeteerConfig = {
|
|
57
58
|
]
|
58
59
|
};
|
59
60
|
exports.puppeteerConfig = puppeteerConfig;
|
60
|
-
const createUserAgent = (waVersion) => `WhatsApp/${waVersion} Mozilla/5.0 (Macintosh; Intel Mac OS X
|
61
|
+
const createUserAgent = (waVersion) => `WhatsApp/${waVersion} Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36`;
|
61
62
|
exports.createUserAgent = createUserAgent;
|
62
63
|
exports.useragent = (0, exports.createUserAgent)('2.2147.16');
|
63
64
|
exports.width = puppeteerConfig.width;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@open-wa/wa-automate",
|
3
|
-
"version": "4.44.
|
3
|
+
"version": "4.44.6",
|
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",
|
@@ -114,6 +114,7 @@
|
|
114
114
|
"boxen": "^5.0.0",
|
115
115
|
"cfonts": "^2.8.5",
|
116
116
|
"change-case": "^4.1.2",
|
117
|
+
"chokidar": "^3.5.3",
|
117
118
|
"chrome-launcher": "^0.15.0",
|
118
119
|
"command-exists": "^1.2.9",
|
119
120
|
"command-line-usage": "^6.1.1",
|
@@ -155,7 +156,7 @@
|
|
155
156
|
"puppeteer-extra-plugin-block-resources": "^2.4.0",
|
156
157
|
"puppeteer-extra-plugin-devtools": "^2.4.0",
|
157
158
|
"puppeteer-extra-plugin-stealth": "^2.10.1",
|
158
|
-
"puppeteer-page-proxy": "
|
159
|
+
"puppeteer-page-proxy": "git+ssh://git@github.com:smashah/puppeteer-page-proxy#patch-1",
|
159
160
|
"qrcode-terminal": "^0.12.0",
|
160
161
|
"qs": "^6.10.1",
|
161
162
|
"rxjs": "^7.0.0",
|