@heylemon/lemonade 0.6.7 → 0.6.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.
- package/dist/build-info.json +3 -3
- package/dist/web/auto-reply/monitor.js +10 -2
- package/dist/web/login-qr.js +12 -0
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
|
@@ -16,7 +16,7 @@ import { resolveWhatsAppAccount } from "../accounts.js";
|
|
|
16
16
|
import { setActiveWebListener } from "../active-listener.js";
|
|
17
17
|
import { monitorWebInbox } from "../inbound.js";
|
|
18
18
|
import { computeBackoff, newConnectionId, resolveHeartbeatSeconds, resolveReconnectPolicy, sleepWithAbort, } from "../reconnect.js";
|
|
19
|
-
import { formatError, getStatusCode, getWebAuthAgeMs, readWebSelfId } from "../session.js";
|
|
19
|
+
import { formatError, getStatusCode, getWebAuthAgeMs, logoutWeb, readWebSelfId, } from "../session.js";
|
|
20
20
|
import { DEFAULT_WEB_MEDIA_BYTES } from "./constants.js";
|
|
21
21
|
import { whatsappHeartbeatLog, whatsappLog } from "./loggers.js";
|
|
22
22
|
import { buildMentionConfig } from "./mentions.js";
|
|
@@ -210,7 +210,15 @@ export async function monitorWebChannel(verbose, listenerFactory = monitorWebInb
|
|
|
210
210
|
reconnectAttempts,
|
|
211
211
|
maxAttempts: reconnectPolicy.maxAttempts,
|
|
212
212
|
}, "web reconnect: max attempts reached after connection failure");
|
|
213
|
-
|
|
213
|
+
// If 515 was seen, credentials are stale — clear them so the next
|
|
214
|
+
// gateway restart or manual re-link starts fresh.
|
|
215
|
+
if (has515Retried) {
|
|
216
|
+
await logoutWeb({ authDir: account.authDir, runtime });
|
|
217
|
+
runtime.error("WhatsApp session invalidated (repeated 515). Cleared credentials — re-link via QR to restore.");
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
runtime.error(`WhatsApp Web reconnect: max attempts reached (${reconnectAttempts}/${reconnectPolicy.maxAttempts}). Stopping web monitoring.`);
|
|
221
|
+
}
|
|
214
222
|
break;
|
|
215
223
|
}
|
|
216
224
|
const delay = computeBackoff(reconnectPolicy, reconnectAttempts);
|
package/dist/web/login-qr.js
CHANGED
|
@@ -210,6 +210,18 @@ export async function waitForWebLogin(opts = {}) {
|
|
|
210
210
|
if (restarted && isLoginFresh(login)) {
|
|
211
211
|
continue;
|
|
212
212
|
}
|
|
213
|
+
// 515 retry failed — credentials are stale. Clear them so the next
|
|
214
|
+
// pairing attempt starts completely fresh instead of reusing a
|
|
215
|
+
// broken session that WhatsApp's server has already invalidated.
|
|
216
|
+
await logoutWeb({
|
|
217
|
+
authDir: login.authDir,
|
|
218
|
+
isLegacyAuthDir: login.isLegacyAuthDir,
|
|
219
|
+
runtime,
|
|
220
|
+
});
|
|
221
|
+
const message = "WhatsApp pairing failed (code 515). Cleared session — please scan the QR code again.";
|
|
222
|
+
await resetActiveLogin(account.accountId, message);
|
|
223
|
+
runtime.log(danger(message));
|
|
224
|
+
return { connected: false, message };
|
|
213
225
|
}
|
|
214
226
|
const message = `WhatsApp login failed: ${login.error}`;
|
|
215
227
|
await resetActiveLogin(account.accountId, message);
|