From ba7a89c4bf60f08188109c6bc22e2e383faa8350 Mon Sep 17 00:00:00 2001 From: IMvision12 Date: Fri, 27 Feb 2026 14:17:51 -0800 Subject: [PATCH] Fix whatsapp connection --- package-lock.json | 89 +++++++++------------------------------- src/cli/commands/auth.ts | 12 +++++- 2 files changed, 30 insertions(+), 71 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba2fa3f..89effa7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,13 +1,13 @@ { - "name": "txtcode", + "name": "txtcode-ai", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "txtcode", + "name": "txtcode-ai", "version": "0.1.0", - "license": "MIT", + "license": "Apache-2.0", "dependencies": { "@anthropic-ai/sdk": "^0.74.0", "@google/generative-ai": "^0.24.1", @@ -18,9 +18,7 @@ "chalk": "^4.1.2", "discord.js": "^14.25.1", "dotenv": "^16.3.1", - "gradient-string": "^3.0.0", "keytar": "^7.9.0", - "link-preview-js": "^3.2.0", "openai": "^6.19.0", "qrcode-terminal": "^0.12.0", "telegraf": "^4.15.0" @@ -37,8 +35,7 @@ "vitest": "^4.0.18" }, "engines": { - "node": ">=20.0.0", - "npm": ">=10.0.0" + "node": ">=20.0.0" } }, "node_modules/@anthropic-ai/sdk": { @@ -2919,12 +2916,6 @@ "@types/node": "*" } }, - "node_modules/@types/tinycolor2": { - "version": "1.4.6", - "resolved": "https://registry.npmjs.org/@types/tinycolor2/-/tinycolor2-1.4.6.tgz", - "integrity": "sha512-iEN8J0BoMnsWBqjVbWH/c0G0Hh7O21lpR2/+PrvAVgWdzL7eexIFm4JN/Wn10PTcmNdtS6U67r499mlWMXOxNw==", - "license": "MIT" - }, "node_modules/@types/ws": { "version": "8.18.1", "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.1.tgz", @@ -3318,7 +3309,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "license": "ISC" + "license": "ISC", + "optional": true }, "node_modules/botbuilder": { "version": "4.23.3", @@ -3656,6 +3648,7 @@ "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.11.tgz", "integrity": "sha512-bQwNaDIBKID5ts/DsdhxrjqFXYfLw4ste+wMKqWA8DyKcS4qwsPP4Bk8ZNaTJjvpiX/qW3BT4sU7d6Bh5i+dag==", "license": "MIT", + "optional": true, "dependencies": { "cheerio-select": "^2.1.0", "dom-serializer": "^2.0.0", @@ -3678,6 +3671,7 @@ "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", "license": "BSD-2-Clause", + "optional": true, "dependencies": { "boolbase": "^1.0.0", "css-select": "^5.1.0", @@ -3811,6 +3805,7 @@ "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz", "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==", "license": "BSD-2-Clause", + "optional": true, "dependencies": { "boolbase": "^1.0.0", "css-what": "^6.1.0", @@ -3827,6 +3822,7 @@ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==", "license": "BSD-2-Clause", + "optional": true, "engines": { "node": ">= 6" }, @@ -4647,31 +4643,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "license": "ISC" }, - "node_modules/gradient-string": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/gradient-string/-/gradient-string-3.0.0.tgz", - "integrity": "sha512-frdKI4Qi8Ihp4C6wZNB565de/THpIaw3DjP5ku87M+N9rNSGmPTjfkq61SdRXB7eCaL8O1hkKDvf6CDMtOzIAg==", - "license": "MIT", - "dependencies": { - "chalk": "^5.3.0", - "tinygradient": "^1.1.5" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/gradient-string/node_modules/chalk": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", - "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", - "license": "MIT", - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4760,6 +4731,7 @@ } ], "license": "MIT", + "optional": true, "dependencies": { "domelementtype": "^2.3.0", "domhandler": "^5.0.3", @@ -5115,20 +5087,6 @@ "pbts": "bin/pbts" } }, - "node_modules/link-preview-js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/link-preview-js/-/link-preview-js-3.2.0.tgz", - "integrity": "sha512-FvrLltjOPGbTzt+RugbzM7g8XuUNLPO2U/INSLczrYdAA32E7nZVUrVL1gr61DGOArGJA2QkPGMEvNMLLsXREA==", - "license": "MIT", - "peer": true, - "dependencies": { - "cheerio": "1.0.0-rc.11", - "url": "0.11.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/lodash": { "version": "4.17.23", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.23.tgz", @@ -5410,6 +5368,7 @@ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", "license": "BSD-2-Clause", + "optional": true, "dependencies": { "boolbase": "^1.0.0" }, @@ -5673,6 +5632,7 @@ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz", "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==", "license": "MIT", + "optional": true, "dependencies": { "entities": "^6.0.0" }, @@ -5685,6 +5645,7 @@ "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.1.0.tgz", "integrity": "sha512-ruw5xyKs6lrpo9x9rCZqZZnIUntICjQAd0Wsmp396Ul9lN/h+ifgVV1x1gZHi8euej6wTfpqX8j+BFQxF0NS/g==", "license": "MIT", + "optional": true, "dependencies": { "domhandler": "^5.0.3", "parse5": "^7.0.0" @@ -5698,6 +5659,7 @@ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz", "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==", "license": "BSD-2-Clause", + "optional": true, "engines": { "node": ">=0.12" }, @@ -5936,7 +5898,8 @@ "version": "1.3.2", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==", - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/qified": { "version": "0.6.0", @@ -5978,6 +5941,7 @@ "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", + "optional": true, "engines": { "node": ">=0.4.x" } @@ -6616,12 +6580,6 @@ "dev": true, "license": "MIT" }, - "node_modules/tinycolor2": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz", - "integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw==", - "license": "MIT" - }, "node_modules/tinyexec": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", @@ -6649,16 +6607,6 @@ "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tinygradient": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/tinygradient/-/tinygradient-1.1.5.tgz", - "integrity": "sha512-8nIfc2vgQ4TeLnk2lFj4tRLvvJwEfQuabdsmvDdQPT0xlk9TaNtpGd6nNRxXoK6vQhN6RSzj+Cnp5tTQmpxmbw==", - "license": "MIT", - "dependencies": { - "@types/tinycolor2": "^1.4.0", - "tinycolor2": "^1.0.0" - } - }, "node_modules/tinypool": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-2.1.0.tgz", @@ -6829,6 +6777,7 @@ "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", "integrity": "sha512-kbailJa29QrtXnxgq+DdCEGlbTeYM2eJUxsz6vjZavrCYPMIFHMKQmSKYAIuUK2i7hgPm28a8piX5NTUtM/LKQ==", "license": "MIT", + "optional": true, "dependencies": { "punycode": "1.3.2", "querystring": "0.2.0" diff --git a/src/cli/commands/auth.ts b/src/cli/commands/auth.ts index ff084ff..1f7654e 100644 --- a/src/cli/commands/auth.ts +++ b/src/cli/commands/auth.ts @@ -191,11 +191,21 @@ function authenticateWhatsApp(): Promise { closeSock(sock); + await new Promise((r) => setTimeout(r, 2000)); + const { state: newState, saveCreds: newSaveCreds } = await useMultiFileAuthState(WA_AUTH_DIR); + const retryVersion = await fetchLatestBaileysVersion(); const retrySock = makeWASocket({ - auth: newState, + auth: { + creds: newState.creds, + keys: makeCacheableSignalKeyStore(newState.keys, silentLogger), + }, + version: retryVersion.version, printQRInTerminal: false, + browser: ["txtcode", "CLI", "0.1.0"], + syncFullHistory: false, + markOnlineOnConnect: false, logger: silentLogger, });