@raevon/n8n-nodes-whatsapp 2.0.7 → 2.0.8
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.
|
@@ -380,6 +380,16 @@ async function ensureServerRunning(cfg) {
|
|
|
380
380
|
}
|
|
381
381
|
async function stopServer(cfg) {
|
|
382
382
|
const port = getPort(cfg);
|
|
383
|
+
// First try to shut down gracefully via the server's own /signout endpoint
|
|
384
|
+
try {
|
|
385
|
+
const res = await fetch(`http://127.0.0.1:${port}/signout`, { method: 'POST', signal: AbortSignal.timeout(3000) });
|
|
386
|
+
if (res.ok) {
|
|
387
|
+
servers.delete(port);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
catch { }
|
|
392
|
+
// If that fails, clean up in-memory state
|
|
383
393
|
const state = servers.get(port);
|
|
384
394
|
if (state) {
|
|
385
395
|
if (state.socket) {
|
|
@@ -396,17 +406,6 @@ async function stopServer(cfg) {
|
|
|
396
406
|
}
|
|
397
407
|
servers.delete(port);
|
|
398
408
|
}
|
|
399
|
-
// Also try to kill any process on the port
|
|
400
|
-
try {
|
|
401
|
-
const out = (0, node_child_process_1.execSync)(`cat /proc/net/tcp | awk '{if(NR>1){split($2,a,\":\");if(strtonum("0x"a[2])==${port})print $10}}'`, { encoding: 'utf-8' }).trim();
|
|
402
|
-
if (out) {
|
|
403
|
-
const inode = out;
|
|
404
|
-
const pidOut = (0, node_child_process_1.execSync)(`for p in /proc/[0-9]*/fd/*; do if readlink "$p" 2>/dev/null | grep -q "socket:\\[${inode}]"; then echo "$p" | cut -d/ -f3; break; fi; done`, { encoding: 'utf-8' }).trim();
|
|
405
|
-
if (pidOut)
|
|
406
|
-
(0, node_child_process_1.execSync)(`kill -9 ${pidOut}`);
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
catch { }
|
|
410
409
|
}
|
|
411
410
|
async function disconnect() { }
|
|
412
411
|
async function getWhatsAppCredentials(credentials) {
|
package/package.json
CHANGED