aunubaileys 1.0.30 → 1.0.32

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 CHANGED
@@ -64,6 +64,14 @@ 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.32 / Baru di 1.0.32
68
+
69
+ - 👥 **Group senders that arrive LID-only are now identifiable by phone number** — in groups, `key.participant` is increasingly a LID while `participantPn` is only sometimes included by the server, leaving phone-number-based sender identification blind. When the LID store knows the pair, the missing `participantPn` / `participantLid` is now filled in on the upsert path before the event reaches consumers. `key.participant` itself is NEVER rewritten — it is the E2E addressing identity the session/sender-key state is keyed by.
70
+
71
+ ### 🆕 What's new in 1.0.31 / Baru di 1.0.31
72
+
73
+ - 📜 **History-sync record list no longer grows without bound in creds** — every history-sync notification appended an entry to `creds.processedHistoryMessages`, yet nothing anywhere reads those entries (the single read is an emptiness check for `isLatest`). The list lives in creds, so each entry bloated creds.json and was spread-copied and re-serialized on every save for the life of the account. Only the most recent 50 entries are now kept; `isLatest` semantics are unchanged.
74
+
67
75
  ### 🆕 What's new in 1.0.30 / Baru di 1.0.30
68
76
 
69
77
  - 🟢 **Presence no longer vanishes across the LID/PN identity split** — presence stanzas increasingly arrive LID-addressed while consumers keyed the participant by phone-number JID (or the reverse), so their lookup missed and the contact looked permanently offline / never typing. When the LID store knows the pair, `presence.update` now also carries the presence under the alternate participant form; the original entry is unchanged.
@@ -7,7 +7,7 @@ import { SyncState } from '../Types/State.js';
7
7
  import { chatModificationToAppPatch, decodePatches, decodeSyncdSnapshot, encodeSyncdPatch, extractSyncdPatches, generateProfilePicture, getHistoryMsg, newLTHashState, processSyncAction } from '../Utils/index.js';
8
8
  import { makeMutex } from '../Utils/make-mutex.js';
9
9
  import processMessage from '../Utils/process-message.js';
10
- import { getBinaryNodeChild, getBinaryNodeChildren, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
10
+ import { getBinaryNodeChild, getBinaryNodeChildren, isJidUser, isLidUser, jidDecode, jidNormalizedUser, reduceBinaryNodeToDictionary, S_WHATSAPP_NET } from '../WABinary/index.js';
11
11
  import { USyncQuery, USyncUser } from '../WAUSync/index.js';
12
12
  import { makeUSyncSocket } from './usync.js';
13
13
  const MAX_SYNC_ATTEMPTS = 2;
@@ -794,6 +794,22 @@ export const makeChatsSocket = (config) => {
794
794
  await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
795
795
  };
796
796
  const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
797
+ // AunuBaileys: fill the alternate identity forms on the key from
798
+ // the LID store when the stanza did not carry them. Consumers
799
+ // identifying group senders by phone number read participantPn,
800
+ // which the server only sometimes includes; without it a
801
+ // LID-addressed participant is unidentifiable to them.
802
+ // key.participant itself is NEVER rewritten — it is the E2E
803
+ // addressing identity the session/sender-key state is keyed by.
804
+ const aunuKey = msg?.key;
805
+ if (aunuKey?.participant && sock.aunuLid) {
806
+ if (!aunuKey.participantPn && isLidUser(aunuKey.participant)) {
807
+ aunuKey.participantPn = sock.aunuLid.getPNForLID(aunuKey.participant) || aunuKey.participantPn;
808
+ }
809
+ if (!aunuKey.participantLid && isJidUser(aunuKey.participant)) {
810
+ aunuKey.participantLid = sock.aunuLid.getLIDForPN(aunuKey.participant) || aunuKey.participantLid;
811
+ }
812
+ }
797
813
  ev.emit('messages.upsert', { messages: [msg], type });
798
814
  if (!!msg.pushName) {
799
815
  let jid = msg.key.fromMe ? authState.creds.me.id : msg.key.participant || msg.key.remoteJid;
@@ -160,9 +160,17 @@ const processMessage = async (message, { shouldProcessHistoryMsg, placeholderRes
160
160
  }, 'got history notification');
161
161
  if (process) {
162
162
  if (histNotification.syncType !== proto.HistorySync.HistorySyncType.ON_DEMAND) {
163
+ // AunuBaileys: keep only the most recent 50 entries.
164
+ // Upstream appended forever, and nothing anywhere
165
+ // reads the entries — the single read is the
166
+ // emptiness check for `isLatest` above. The list
167
+ // lives in creds, so every entry also bloats
168
+ // creds.json and is re-serialized (and spread-copied
169
+ // here) on every save for the life of the account.
170
+ const prevProcessed = creds.processedHistoryMessages || [];
163
171
  ev.emit('creds.update', {
164
172
  processedHistoryMessages: [
165
- ...(creds.processedHistoryMessages || []),
173
+ ...prevProcessed.slice(-49),
166
174
  { key: message.key, messageTimestamp: message.messageTimestamp }
167
175
  ]
168
176
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "aunubaileys",
3
3
  "type": "module",
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
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",