aunubaileys 1.0.27 → 1.0.28
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/README.md +4 -0
- package/lib/Socket/messages-recv.js +16 -2
- package/lib/Socket/messages-send.js +5 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -64,6 +64,10 @@ Everything else is pure upstream. When upstream moves, we rebase the patch layer
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
|
|
67
|
+
### 🆕 What's new in 1.0.28 / Baru di 1.0.28
|
|
68
|
+
|
|
69
|
+
- 📱 **Device lists no longer go stale after a device is linked or unlinked** — the server pushes a `devices` notification on such changes, but upstream only logged its own list and ignored everyone else's, so sends kept encrypting for the cached device set until the 5-minute TTL expired: a newly linked device received nothing and a removed device kept getting ciphertext. The notification now invalidates that user's cached entry, so the next send re-queries USync for the fresh list. The cache is also exposed as `sock.userDevicesCache` for explicit invalidation.
|
|
70
|
+
|
|
67
71
|
### 🆕 What's new in 1.0.27 / Baru di 1.0.27
|
|
68
72
|
|
|
69
73
|
- ⏱️ **New `getReconnectDelay(attempt, reason)` helper** — the companion to AunuAntiBan's `classifyDisconnect`: it turns a disconnect reason (Boom error, status code, or a classification result) into a suggested wait in milliseconds, or `null` when the connection must NOT be re-established automatically (logged out, replaced, bad session, 403). Server-requested restarts return 0; transient failures back off exponentially with Gaussian jitter (1s base, 60s cap); rate limits back off much longer (30s base, 15 min cap). `baseDelayMs` / `maxDelayMs` overrides available.
|
|
@@ -14,7 +14,7 @@ import { makeMessagesSocket } from './messages-send.js';
|
|
|
14
14
|
export const makeMessagesRecvSocket = (config) => {
|
|
15
15
|
const { logger, retryRequestDelayMs, maxMsgRetryCount, getMessage, shouldIgnoreJid } = config;
|
|
16
16
|
const sock = makeMessagesSocket(config);
|
|
17
|
-
const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, sendPeerDataOperationMessage } = sock;
|
|
17
|
+
const { ev, authState, ws, processingMutex, signalRepository, query, upsertMessage, resyncAppState, onUnexpectedError, assertSessions, sendNode, relayMessage, sendReceipt, uploadPreKeys, sendPeerDataOperationMessage, userDevicesCache } = sock;
|
|
18
18
|
/** AunuBaileys: consecutive decrypt failures per signal address.
|
|
19
19
|
* WhatsApp clients heal a rotten (Bad MAC) session by dropping it and
|
|
20
20
|
* letting the peer re-initiate from the key bundle in our retry receipt;
|
|
@@ -331,13 +331,27 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
331
331
|
case 'encrypt':
|
|
332
332
|
await handleEncryptNotification(node);
|
|
333
333
|
break;
|
|
334
|
-
case 'devices':
|
|
334
|
+
case 'devices': {
|
|
335
335
|
const devices = getBinaryNodeChildren(child, 'device');
|
|
336
336
|
if (areJidsSameUser(child.attrs.jid, authState.creds.me.id)) {
|
|
337
337
|
const deviceJids = devices.map(d => d.attrs.jid);
|
|
338
338
|
logger.info({ deviceJids }, 'got my own devices');
|
|
339
339
|
}
|
|
340
|
+
// AunuBaileys: this notification means a device list
|
|
341
|
+
// CHANGED (device linked or unlinked). Upstream logged
|
|
342
|
+
// its own list and ignored everyone else's, so the send
|
|
343
|
+
// path kept encrypting for the cached device set until
|
|
344
|
+
// the cache TTL (5 min) expired — a newly linked device
|
|
345
|
+
// received nothing meanwhile and a removed device kept
|
|
346
|
+
// getting ciphertext. Drop the cached entry so the next
|
|
347
|
+
// send re-queries USync for the fresh list.
|
|
348
|
+
const changedUser = jidDecode(child.attrs.jid)?.user;
|
|
349
|
+
if (changedUser) {
|
|
350
|
+
userDevicesCache?.del(changedUser);
|
|
351
|
+
logger.debug({ changedUser }, 'aunu: device cache invalidated on devices notification');
|
|
352
|
+
}
|
|
340
353
|
break;
|
|
354
|
+
}
|
|
341
355
|
case 'server_sync':
|
|
342
356
|
const update = getBinaryNodeChild(node, 'collection');
|
|
343
357
|
if (update) {
|
|
@@ -616,6 +616,11 @@ export const makeMessagesSocket = (config) => {
|
|
|
616
616
|
sendPeerDataOperationMessage,
|
|
617
617
|
createParticipantNodes,
|
|
618
618
|
getUSyncDevices,
|
|
619
|
+
// AunuBaileys: exposed so the notification layer can invalidate a
|
|
620
|
+
// user's entry when the server pushes a device-list change
|
|
621
|
+
// (upstream kept the cache private to this closure, so nothing
|
|
622
|
+
// could ever invalidate it before its TTL expired).
|
|
623
|
+
userDevicesCache,
|
|
619
624
|
updateMediaMessage: async (message) => {
|
|
620
625
|
const content = assertMediaContent(message.message);
|
|
621
626
|
const mediaKey = content.mediaKey;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aunubaileys",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.28",
|
|
5
5
|
"description": "AunuBaileys \u2014 a WhatsApp Web API for bots that never sleep. Full upstream power with the beloved in-memory store restored and pairing that just works. Forged by AunuCore.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"whatsapp",
|