@neelegirly/baileys 2.2.31 → 2.2.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
@@ -15,7 +15,7 @@
15
15
  <img src="https://files.catbox.moe/5bqumy.jpeg" width="780" alt="@neelegirly/baileys Hero" />
16
16
  </p>
17
17
 
18
- <p align="center"><sub>2026 Glow-Up Edition · self-healing QR/Pairing · Companion-Stack auf <strong>2.2.31 / 1.8.14 / 1.0.33</strong></sub></p>
18
+ <p align="center"><sub>2026 Glow-Up Edition · self-healing QR/Pairing · Companion-Stack auf <strong>2.2.32 / 1.8.14 / 1.0.33</strong></sub></p>
19
19
 
20
20
  [**Installation**](#-installation) · [**Quickstart**](#-quickstart) · [**Was ist dieser Fork?**](#-was-ist-dieser-fork) · [**Versionsschema**](#-versionsschema) · [**Message-ID**](#-message-id-anpassung-neele) · [**Release Notes**](#-release-notes-2230)
21
21
 
@@ -79,7 +79,7 @@ Wichtig zu verstehen — hier laufen **zwei voneinander unabhängige** Versionsn
79
79
 
80
80
  | Nummer | Beispiel | Bedeutung |
81
81
  | --- | --- | --- |
82
- | **Fork-Version** | `2.2.31` | Die npm-Version *dieses Pakets*. Eigenes semver-Schema von Neelegirly – **nicht** identisch mit der Upstream-Baileys-Versionsnummer. |
82
+ | **Fork-Version** | `2.2.32` | Die npm-Version *dieses Pakets*. Eigenes semver-Schema von Neelegirly – **nicht** identisch mit der Upstream-Baileys-Versionsnummer. |
83
83
  | **WhatsApp-Web-Baseline** | `2.3000.1043857760` | Die Client-Version, die im Handshake an WhatsApp gemeldet wird. Wird zur Laufzeit aktuell gehalten (self-healing). |
84
84
 
85
85
  Die Fork-Version `2.2.x` ist also reines Paket-Versioning. Welche WhatsApp-Web-Version tatsächlich verbunden wird, zeigt der Boot-Banner und `fetchLatestBaileysVersion()`.
@@ -102,11 +102,11 @@ generateMessageID() // → z. B. "3AC18D8ANEELE3B14420"
102
102
  ## 🚀 Installation
103
103
 
104
104
  ```bash
105
- npm install @neelegirly/baileys@2.2.31 @neelegirly/libsignal@1.0.33 --save-exact
105
+ npm install @neelegirly/baileys@2.2.32 @neelegirly/libsignal@1.0.33 --save-exact
106
106
  ```
107
107
 
108
108
  ```bash
109
- yarn add @neelegirly/baileys@2.2.31 @neelegirly/libsignal@1.0.33 --exact
109
+ yarn add @neelegirly/baileys@2.2.32 @neelegirly/libsignal@1.0.33 --exact
110
110
  ```
111
111
 
112
112
  > Für den kompletten Stack passt dazu `@neelegirly/wa-api@1.8.13`.
@@ -164,7 +164,7 @@ start().catch(console.error)
164
164
 
165
165
  | Paket | Version | Rolle |
166
166
  |------|---------|-------|
167
- | `@neelegirly/baileys` | `2.2.31` | Socket, Events, Messaging |
167
+ | `@neelegirly/baileys` | `2.2.32` | Socket, Events, Messaging |
168
168
  | `@neelegirly/libsignal` | `1.0.33` | Signal-Protokoll-Komponente |
169
169
  | `@neelegirly/wa-api` | `1.8.13` | Lifecycle-, Session- und Update-Wrapper |
170
170
 
@@ -185,6 +185,29 @@ Beim QR-Scan werden Markenzeilen ober- und unterhalb des QR-Codes ausgegeben. Ve
185
185
 
186
186
  ---
187
187
 
188
+ ## 📝 Release Notes `2.2.32`
189
+
190
+ `prepareInteractiveMessageForMd(message)` ergänzt für eine interaktive Karte
191
+ genau einen Multi-Device-Umschlag mit `deviceListMetadataVersion: 2`. Ein
192
+ vorhandener View-once-Umschlag bleibt erhalten. GIF/Video im Header, Text,
193
+ Knöpfe und Zitat bleiben gemeinsam in einer Nachricht. Der Helper sendet
194
+ nichts selbst und verändert weder Socket-Verbindungen noch Konten.
195
+
196
+ ```js
197
+ const { prepareInteractiveMessageForMd, generateWAMessageFromContent } = require('@neelegirly/baileys')
198
+ // card: vorhandenes { interactiveMessage: { header, body, footer, nativeFlowMessage } }
199
+ const msg = generateWAMessageFromContent(jid, prepareInteractiveMessageForMd(card), {
200
+ userJid: sock.user.id
201
+ })
202
+ await sock.relayMessage(jid, msg.message, { messageId: msg.key.id })
203
+ ```
204
+
205
+ Für eine GIF-Karte mit direkten Auswahlknöpfen `quick_reply` verwenden.
206
+ `single_select` ist ein anderer Knopftyp; der Helper macht ihn nicht durch
207
+ einen Umschlag automatisch auf jedem iOS-/Android-Client sichtbar. Die
208
+ Darstellung muss auf den verwendeten WhatsApp-Clients geprüft werden.
209
+ Es gibt keine automatische Umstellung vorhandener Nachrichten.
210
+
188
211
  ## 📝 Release Notes `2.2.31`
189
212
 
190
213
  - 🔐 **„Warte auf diese Nachricht“: Gerät beim Entschlüsseln erhalten.** Sessions von Zweitgeräten (WhatsApp Web/Desktop) landeten im Datensatz des Handys, der Bot verschlüsselte ans Handy danach mit dem falschen Schlüssel.
@@ -1,6 +1,7 @@
1
1
  export * from './generics'
2
2
  export * from './decode-wa-message'
3
3
  export * from './messages'
4
+ export * from './interactive-envelope'
4
5
  export * from './messages-media'
5
6
  export * from './validate-connection'
6
7
  export * from './crypto'
@@ -21,6 +21,7 @@ Object.defineProperty(exports, "__esModule", { value: true })
21
21
  __exportStar(require("./generics"), exports)
22
22
  __exportStar(require("./decode-wa-message"), exports)
23
23
  __exportStar(require("./messages"), exports)
24
+ __exportStar(require("./interactive-envelope"), exports)
24
25
  __exportStar(require("./messages-media"), exports)
25
26
  __exportStar(require("./validate-connection"), exports)
26
27
  __exportStar(require("./crypto"), exports)
@@ -0,0 +1,4 @@
1
+ import { proto } from '../../WAProto';
2
+
3
+ /** Prepare one interactive/media card for MD delivery without sending or splitting it. */
4
+ export declare function prepareInteractiveMessageForMd<T extends proto.IMessage>(message: T): proto.IMessage;
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ const WRAPPERS = ['viewOnceMessage', 'viewOnceMessageV2', 'viewOnceMessageV2Extension'];
4
+
5
+ /**
6
+ * Prepare one interactive card for multi-device delivery. Media stays in its
7
+ * header; this helper never sends, uploads, splits messages or switches buttons.
8
+ * A matching WhatsApp client still decides which button types it can display.
9
+ */
10
+ function prepareInteractiveMessageForMd(message) {
11
+ if (!message || typeof message !== 'object') return message;
12
+ if (message.ephemeralMessage?.message) {
13
+ const inner = prepareInteractiveMessageForMd(message.ephemeralMessage.message);
14
+ return inner === message.ephemeralMessage.message ? message : {
15
+ ...message, ephemeralMessage: { ...message.ephemeralMessage, message: inner }
16
+ };
17
+ }
18
+ const existing = WRAPPERS.find(name => message[name]?.message);
19
+ const inner = existing ? message[existing].message : message;
20
+ if (!inner.interactiveMessage) return message;
21
+ const context = inner.messageContextInfo;
22
+ if (existing && context?.deviceListMetadataVersion === 2 && context.deviceListMetadata != null) return message;
23
+ const content = {
24
+ ...inner,
25
+ interactiveMessage: { ...inner.interactiveMessage },
26
+ messageContextInfo: {
27
+ ...(context || {}),
28
+ deviceListMetadataVersion: 2,
29
+ deviceListMetadata: context?.deviceListMetadata || {}
30
+ }
31
+ };
32
+ return existing ? {
33
+ ...message, [existing]: { ...message[existing], message: content }
34
+ } : { viewOnceMessageV2Extension: { message: content } };
35
+ }
36
+
37
+ module.exports = { prepareInteractiveMessageForMd };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirly/baileys",
3
- "version": "2.2.31",
3
+ "version": "2.2.32",
4
4
  "description": "Eigenstaendiger Baileys-Fork von Neele Girl (NICHT WhiskeySockets/Baileys) — multi-device WhatsApp Web API fuer Node.js, mit Multi-Button-Support, QR-/Pairing-Stabilitaet und self-healing WA-Web-Version.",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -32,7 +32,8 @@
32
32
  "WAProto/**/*",
33
33
  "tsconfig.json",
34
34
  "README.md",
35
- "LICENSE"
35
+ "LICENSE",
36
+ "tests/interactive-envelope.test.cjs"
36
37
  ],
37
38
  "exports": {
38
39
  ".": {
@@ -122,6 +123,6 @@
122
123
  "build:all": "tsc && typedoc",
123
124
  "build:docs": "typedoc",
124
125
  "build:tsc": "tsc",
125
- "test": "node --check lib/Socket/groups.js && node --check lib/Socket/messages-recv.js && node --check lib/Socket/messages-send.js && node --check lib/Socket/socket.js && node --check lib/Utils/auth-utils.js && node --check lib/Utils/decode-wa-message.js && node --check lib/Utils/process-message.js && node --check lib/Utils/link-preview.js && node -e \"const b=require('./'); if(typeof b.makeWASocket !== 'function' || b.NACK_REASONS.SenderReachoutTimelocked !== 463 || b.QueryIds.FOLLOW !== '24404358912487870') process.exit(1)\""
126
+ "test": "node --check lib/Socket/groups.js && node --check lib/Socket/messages-recv.js && node --check lib/Socket/messages-send.js && node --check lib/Socket/socket.js && node --check lib/Utils/auth-utils.js && node --check lib/Utils/decode-wa-message.js && node --check lib/Utils/process-message.js && node --check lib/Utils/link-preview.js && node -e \"const b=require('./'); if(typeof b.makeWASocket !== 'function' || b.NACK_REASONS.SenderReachoutTimelocked !== 463 || b.QueryIds.FOLLOW !== '24404358912487870') process.exit(1)\" && node --test tests/interactive-envelope.test.cjs"
126
127
  }
127
128
  }
@@ -0,0 +1,43 @@
1
+ const {test}=require('node:test');
2
+ const assert=require('node:assert/strict');
3
+ const {proto,generateWAMessageFromContent,prepareInteractiveMessageForMd}=require('../lib');
4
+
5
+ const card={interactiveMessage:{
6
+ header:{title:'Onimai',hasMediaAttachment:true,videoMessage:{gifPlayback:true,mimetype:'video/mp4',url:'https://example.invalid/menu.mp4'}},
7
+ body:{text:'Profil und Kategorien'},footer:{text:'Onimai'},
8
+ contextInfo:{stanzaId:'quoted',participant:'12345@s.whatsapp.net'},
9
+ nativeFlowMessage:{messageVersion:1,buttons:Array.from({length:10},(_,i)=>({name:'quick_reply',buttonParamsJson:JSON.stringify({display_text:'Kategorie '+i,id:'!menu kategorie '+i})}))}
10
+ }};
11
+
12
+ test('Eine MD-Hülle erhält GIF, alle Knöpfe, Text, IDs und Zitat im echten Protobuf',()=>{
13
+ const original=JSON.stringify(card),wrapped=prepareInteractiveMessageForMd(card);
14
+ assert.deepEqual(wrapped.viewOnceMessageV2Extension.message.interactiveMessage,card.interactiveMessage);
15
+ assert.equal(prepareInteractiveMessageForMd(wrapped),wrapped);
16
+ const generated=generateWAMessageFromContent('12345@s.whatsapp.net',wrapped,{userJid:'67890@s.whatsapp.net',messageId:'one-card'});
17
+ const decoded=proto.Message.decode(proto.Message.encode(generated.message).finish());
18
+ const inner=decoded.viewOnceMessageV2Extension.message;
19
+ assert.equal(inner.messageContextInfo.deviceListMetadataVersion,2);
20
+ assert.equal(inner.interactiveMessage.header.videoMessage.gifPlayback,true);
21
+ assert.equal(inner.interactiveMessage.nativeFlowMessage.buttons.length,10);
22
+ assert.equal(inner.interactiveMessage.contextInfo.stanzaId,'quoted');
23
+ assert.equal(generated.key.id,'one-card');assert.equal(JSON.stringify(card),original);
24
+ });
25
+
26
+ test('Vorhandene Hüllen werden ergänzt, nicht verdoppelt; Metadaten bleiben erhalten',()=>{
27
+ for(const name of ['viewOnceMessage','viewOnceMessageV2','viewOnceMessageV2Extension']){
28
+ const input={[name]:{message:{...card,messageContextInfo:{messageSecret:Buffer.from([1,2,3])}}}};
29
+ const output=prepareInteractiveMessageForMd(input),inner=output[name].message;
30
+ assert.deepEqual(inner.messageContextInfo.messageSecret,Buffer.from([1,2,3]));
31
+ assert.equal(inner.messageContextInfo.deviceListMetadataVersion,2);
32
+ for(const other of ['viewOnceMessage','viewOnceMessageV2','viewOnceMessageV2Extension'])assert.equal(inner[other],undefined);
33
+ assert.equal(input[name].message.messageContextInfo.deviceListMetadataVersion,undefined);
34
+ }
35
+ });
36
+
37
+ test('Ephemeral-Verpackung und Nicht-Karten bleiben erhalten',()=>{
38
+ const text={conversation:'Hallo'};assert.equal(prepareInteractiveMessageForMd(text),text);
39
+ assert.equal(prepareInteractiveMessageForMd(null),null);
40
+ const input={ephemeralMessage:{message:card}},output=prepareInteractiveMessageForMd(input);
41
+ assert.deepEqual(output.ephemeralMessage.message.viewOnceMessageV2Extension.message.interactiveMessage,card.interactiveMessage);
42
+ assert.equal(prepareInteractiveMessageForMd(output),output);
43
+ });