@raevon/n8n-nodes-whatsapp 1.0.6 → 1.0.7
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.
|
@@ -48,6 +48,7 @@ const baileys_1 = __importStar(require("@whiskeysockets/baileys"));
|
|
|
48
48
|
const p_queue_1 = __importDefault(require("p-queue"));
|
|
49
49
|
const node_path_1 = __importDefault(require("node:path"));
|
|
50
50
|
const node_fs_1 = __importDefault(require("node:fs"));
|
|
51
|
+
const qrcode_1 = __importDefault(require("qrcode"));
|
|
51
52
|
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
52
53
|
const randBetween = (min, max) => max > min ? min + Math.floor(Math.random() * (max - min + 1)) : min;
|
|
53
54
|
// Silent logger — Baileys expects pino-compatible logger with these methods
|
|
@@ -156,7 +157,7 @@ async function initSocket(cfg, authPath) {
|
|
|
156
157
|
console.error('[WhatsApp] Failed to save credentials:', err.message);
|
|
157
158
|
});
|
|
158
159
|
});
|
|
159
|
-
sock.ev.on('connection.update', (update) => {
|
|
160
|
+
sock.ev.on('connection.update', async (update) => {
|
|
160
161
|
var _a, _b;
|
|
161
162
|
if (gen !== generation)
|
|
162
163
|
return; // #10: Ignore stale connection events
|
|
@@ -164,10 +165,10 @@ async function initSocket(cfg, authPath) {
|
|
|
164
165
|
if (qr) {
|
|
165
166
|
latestQr = qr;
|
|
166
167
|
socketStatus = 'qr_ready';
|
|
167
|
-
//
|
|
168
|
+
// Generate QR locally using qrcode package — no external service
|
|
168
169
|
if (qrResolve) {
|
|
169
|
-
const
|
|
170
|
-
qrResolve({ qr, qrUrl });
|
|
170
|
+
const qrDataUrl = await qrcode_1.default.toDataURL(qr, { width: 300, margin: 2 });
|
|
171
|
+
qrResolve({ qr, qrUrl: qrDataUrl });
|
|
171
172
|
qrResolve = null;
|
|
172
173
|
}
|
|
173
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raevon/n8n-nodes-whatsapp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "n8n community node for WhatsApp — send and receive messages with anti-ban protection via the Baileys library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"n8n-community-node-package",
|
|
@@ -36,10 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@whiskeysockets/baileys": "^7.0.0-rc13",
|
|
39
|
-
"p-queue": "^8.0.1"
|
|
39
|
+
"p-queue": "^8.0.1",
|
|
40
|
+
"qrcode": "^1.5.4"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@types/node": "^20.19.39",
|
|
44
|
+
"@types/qrcode": "^1.5.6",
|
|
43
45
|
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
44
46
|
"@typescript-eslint/parser": "^6.21.0",
|
|
45
47
|
"eslint": "^8.57.1",
|