aunubaileys 1.0.24 β 1.0.25
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/index.js +3 -1
- package/lib/Socket/messages-recv.js +10 -1
- package/lib/Socket/socket.js +7 -0
- package/lib/Utils/lid-store.d.ts +2 -0
- package/lib/Utils/lid-store.js +15 -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.25 / Baru di 1.0.25
|
|
68
|
+
|
|
69
|
+
- πͺͺ **DM receipt status no longer gets stuck on LID addressing** β receipts increasingly arrive addressed to the peer's LID while consumers keyed the sent message by its phone-number JID (or the reverse), so the status update never matched and the message looked forever "sent". When the LID store knows the pair, DM `messages.update` events now carry the alternate form as `key.remoteJidAlt` (purely additive; `remoteJid` unchanged). Under the hood the LID store is now created once in the base socket layer, so the single instance the public `sock.aunuLid` learns into is the same one inner layers read β and the store gains a `getAltJid(jid)` helper.
|
|
70
|
+
|
|
67
71
|
### π What's new in 1.0.24 / Baru di 1.0.24
|
|
68
72
|
|
|
69
73
|
- πΌοΈ **`profilePictureUrl` no longer throws for βno pictureβ** β a contact with no photo (or one hidden by privacy settings) made the server answer 401/404 and upstream let the Boom crash every caller that forgot a try/catch. Those statuses now resolve to `undefined`, consistent with the existing empty-picture-node case; real failures (timeouts, 5xx) still throw.
|
package/lib/Socket/index.js
CHANGED
|
@@ -15,7 +15,9 @@ const makeWASocket = (config) => {
|
|
|
15
15
|
}
|
|
16
16
|
const sock = makeCommunitiesSocket(newConfig);
|
|
17
17
|
sock.aunuHandler = new AunuHandler(sock);
|
|
18
|
-
sock.aunuLid
|
|
18
|
+
if (!sock.aunuLid) {
|
|
19
|
+
sock.aunuLid = makeLIDStore();
|
|
20
|
+
}
|
|
19
21
|
sock.ev.on('messages.upsert', (upsert) => {
|
|
20
22
|
try {
|
|
21
23
|
sock.aunuLid.learnFromUpsert(upsert);
|
|
@@ -559,8 +559,17 @@ export const makeMessagesRecvSocket = (config) => {
|
|
|
559
559
|
}
|
|
560
560
|
}
|
|
561
561
|
else {
|
|
562
|
+
// AunuBaileys: DM receipts increasingly arrive
|
|
563
|
+
// addressed to the peer's LID while consumers
|
|
564
|
+
// keyed the sent message by its PN JID (or the
|
|
565
|
+
// reverse), so the status update never matches
|
|
566
|
+
// their store and the message looks stuck at
|
|
567
|
+
// "sent". Attach the alternate form as
|
|
568
|
+
// key.remoteJidAlt when the LID store knows the
|
|
569
|
+
// pair β purely additive, remoteJid unchanged.
|
|
570
|
+
const remoteJidAlt = sock.aunuLid?.getAltJid?.(remoteJid);
|
|
562
571
|
ev.emit('messages.update', ids.map(id => ({
|
|
563
|
-
key: { ...key, id },
|
|
572
|
+
key: { ...key, id, ...(remoteJidAlt ? { remoteJidAlt } : {}) },
|
|
564
573
|
update: { status }
|
|
565
574
|
})));
|
|
566
575
|
}
|
package/lib/Socket/socket.js
CHANGED
|
@@ -6,6 +6,7 @@ import { proto } from '../../WAProto/index.js';
|
|
|
6
6
|
import { DEF_CALLBACK_PREFIX, DEF_TAG_PREFIX, INITIAL_PREKEY_COUNT, MIN_PREKEY_COUNT, NOISE_WA_HEADER } from '../Defaults/index.js';
|
|
7
7
|
import { DisconnectReason } from '../Types/index.js'
|
|
8
8
|
import { executeWMexQuery } from './mex.js';
|
|
9
|
+
import { makeLIDStore } from '../Utils/lid-store.js';
|
|
9
10
|
import { QueryIds, XWAPaths } from '../Types/index.js';
|
|
10
11
|
import { addTransactionCapability, aesEncryptCTR, bindWaitForConnectionUpdate, bytesToCrockford, configureSuccessfulPairing, Curve, derivePairingCodeKey, generateLoginNode, generateMdTagPrefix, generateRegistrationNode, getCodeFromWSError, getErrorCodeFromStreamError, getNextPreKeysNode, getPlatformId, makeEventBuffer, makeNoiseHandler, promiseTimeout } from '../Utils/index.js';
|
|
11
12
|
import { assertNodeErrorFree, binaryNodeToString, encodeBinaryNode, getBinaryNodeChild, getBinaryNodeChildren, jidEncode, S_WHATSAPP_NET } from '../WABinary/index.js';
|
|
@@ -688,6 +689,12 @@ export const makeSocket = (config) => {
|
|
|
688
689
|
ws,
|
|
689
690
|
ev,
|
|
690
691
|
authState: { creds, keys },
|
|
692
|
+
// AunuBaileys: the LID identity store is created HERE, in the base
|
|
693
|
+
// layer, so the same instance propagates through every layer's
|
|
694
|
+
// { ...sock } spread to the final socket β inner layers (receipt
|
|
695
|
+
// handling, presence, polls) read the store the public
|
|
696
|
+
// sock.aunuLid learns into, not a private copy.
|
|
697
|
+
aunuLid: makeLIDStore(),
|
|
691
698
|
signalRepository,
|
|
692
699
|
get user() {
|
|
693
700
|
return authState.creds.me;
|
package/lib/Utils/lid-store.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export interface LIDStore {
|
|
|
14
14
|
learnFromUpsert(upsert: { messages?: WAMessage[] }): number;
|
|
15
15
|
getLIDForPN(pnJid: string): string | undefined;
|
|
16
16
|
getPNForLID(lidJid: string): string | undefined;
|
|
17
|
+
/** The alternate identity form of a known JID (PN for a known LID, LID for a known PN); undefined when unknown or not a user JID. */
|
|
18
|
+
getAltJid(jid: string): string | undefined;
|
|
17
19
|
hasPN(pnJid: string): boolean;
|
|
18
20
|
hasLID(lidJid: string): boolean;
|
|
19
21
|
deletePair(jid: string): boolean;
|
package/lib/Utils/lid-store.js
CHANGED
|
@@ -89,6 +89,21 @@ export const makeLIDStore = (options = {}) => {
|
|
|
89
89
|
learnFromUpsert,
|
|
90
90
|
getLIDForPN: (pnJid) => (pnJid ? pnToLid.get(jidNormalizedUser(pnJid)) : undefined),
|
|
91
91
|
getPNForLID: (lidJid) => (lidJid ? lidToPn.get(jidNormalizedUser(lidJid)) : undefined),
|
|
92
|
+
// the other identity form of a known JID: PN for a known LID,
|
|
93
|
+
// LID for a known PN; undefined for unknown or non-user JIDs
|
|
94
|
+
getAltJid: (jid) => {
|
|
95
|
+
if (!jid) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const norm = jidNormalizedUser(jid);
|
|
99
|
+
if (isLidUser(norm)) {
|
|
100
|
+
return lidToPn.get(norm);
|
|
101
|
+
}
|
|
102
|
+
if (isJidUser(norm)) {
|
|
103
|
+
return pnToLid.get(norm);
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
},
|
|
92
107
|
hasPN: (pnJid) => (pnJid ? pnToLid.has(jidNormalizedUser(pnJid)) : false),
|
|
93
108
|
hasLID: (lidJid) => (lidJid ? lidToPn.has(jidNormalizedUser(lidJid)) : false),
|
|
94
109
|
deletePair: (jid) => {
|
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.25",
|
|
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",
|