@neelegirl/baileys 1.7.0 → 2.0.0

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
@@ -2,14 +2,15 @@
2
2
 
3
3
  # 🌸 @neelegirl/baileys 🌸
4
4
 
5
- ### *Die ultimative WhatsApp Web API für TypeScript/JavaScript*
6
- ### 💖 *Mit Magie, Intelligenz und kawaii Vibes* 💖
5
+ ### *Die WhatsApp Web API, die alles kann*
6
+ ### *Smart Queue · QR-Code · Message ID · LID · TypeScript*
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-1.7.0-pink?style=for-the-badge&logo=github)](https://github.com/neelegirl/baileys)
9
- [![npm](https://img.shields.io/npm/v/@neelegirl/baileys?style=for-the-badge&color=pink&logo=npm)](https://www.npmjs.com/package/@neelegirl/baileys)
10
- [![Downloads](https://img.shields.io/npm/dw/@neelegirl/baileys?style=for-the-badge&color=pink&logo=npm)](https://www.npmjs.com/package/@neelegirl/baileys)
11
- [![License](https://img.shields.io/github/license/neelegirl/baileys?style=for-the-badge&color=pink)](LICENSE)
12
- [![Stars](https://img.shields.io/github/stars/neelegirl/baileys?style=for-the-badge&color=pink&logo=github)](https://github.com/neelegirl/baileys)
8
+ [![Version](https://img.shields.io/badge/Version-2.0.0-ff69b4?style=for-the-badge&logo=github)](https://github.com/neelegirl/baileys)
9
+ [![Baileys API](https://img.shields.io/badge/Baileys_API-1.7.2-9b59b6?style=for-the-badge)](https://github.com/WhiskeySockets/Baileys)
10
+ [![npm](https://img.shields.io/npm/v/@neelegirl/baileys?style=for-the-badge&color=ff69b4&logo=npm)](https://www.npmjs.com/package/@neelegirl/baileys)
11
+ [![Downloads](https://img.shields.io/npm/dw/@neelegirl/baileys?style=for-the-badge&color=ff69b4&logo=npm)](https://www.npmjs.com/package/@neelegirl/baileys)
12
+ [![License](https://img.shields.io/github/license/neelegirl/baileys?style=for-the-badge&color=ff69b4)](LICENSE)
13
+ [![Node](https://img.shields.io/badge/Node-16+-green?style=for-the-badge&logo=node.js)](https://nodejs.org)
13
14
 
14
15
  ---
15
16
 
@@ -17,9 +18,13 @@
17
18
  <img src="https://files.catbox.moe/ru1msl.jpeg" width="720" alt="Neele Baileys Header" />
18
19
  </p>
19
20
 
20
- **🎀 Version 1.7.0 - Jetzt mit Smart Message Queue & noch mehr Magie! 🎀**
21
+ | 📦 Paket | 🎯 Baileys API | Highlights |
22
+ |----------|----------------|----------------|
23
+ | **@neelegirl/baileys v2.0.0** | **1.7.2** | Upstream-Updates · QR-Code · Message ID unverändert |
21
24
 
22
- [🚀 Installation](#-installation) [📖 Quickstart](#-quickstart-guide) [✨ Neue Features](#-neue-features-in-version-170) [📚 Dokumentation](#-dokumentation) [💬 Support](#-support--community)
25
+ **✨ v2.0.0** · Upstream aus Backup Baileys · Kompatibel mit Baileys **1.7.2** · QR & Message ID bleiben wie gewohnt
26
+
27
+ [**Installation**](#-installation) · [**Quickstart**](#-quickstart-guide) · [**Features**](#-neue-features-in-version-200) · [**Dokumentation**](#-dokumentation) · [**Support**](#-support--community)
23
28
 
24
29
  </div>
25
30
 
@@ -30,7 +35,7 @@
30
35
  - [✨ Warum @neelegirl/baileys?](#-warum-neelegirlbaileys)
31
36
  - [🚀 Installation](#-installation)
32
37
  - [📖 Quickstart Guide](#-quickstart-guide)
33
- - [✨ Neue Features in Version 1.7.0](#-neue-features-in-version-170)
38
+ - [✨ Neue Features in Version 2.0.0](#-neue-features-in-version-200)
34
39
  - [💡 Grundlegende Verwendung](#-grundlegende-verwendung)
35
40
  - [🎯 Erweiterte Features](#-erweiterte-features)
36
41
  - [📚 Dokumentation](#-dokumentation)
@@ -183,21 +188,24 @@ startBot().catch(console.error)
183
188
 
184
189
  ---
185
190
 
186
- ## ✨ Neue Features in Version 1.7.0
191
+ ## ✨ Neue Features in Version 2.0.0
187
192
 
188
193
  ### 🆕 **Was ist neu?**
194
+ **Kompatibel mit Baileys API 1.7.2** · Upstream aus **Backup Baileys** integriert · **Message ID & QR-Code unverändert**
189
195
 
190
196
  <div align="center">
191
197
 
192
198
  | 🎯 Feature | 📝 Beschreibung | 🚀 Status |
193
199
  |-----------|----------------|-----------|
194
- | **🚀 Smart Message Queue** | Intelligente Queue mit Auto-Retry & Prioritäten | ✅ **BRANDNEU!** |
195
- | **🔄 Auto-Update-Check** | Automatische Prüfung auf neue Versionen | ✅ |
196
- | **🎨 Verbesserte QR-Anzeige** | Schöne QR-Code-Box mit Version-Info | ✅ |
197
- | **🎯 Message ID System** | Verbesserte Message-ID-Generierung | ✅ |
198
- | **📦 WhatsApp Version** | Aktualisiert auf [2, 3000, 1032141294] | ✅ |
199
- | **🔐 Pre-Key Management** | Automatische Validierung & Rotation | ✅ Verbessert |
200
- | **⚡ Socket-Stabilität** | Verbesserte Verbindungsstabilität | ✅ Verbessert |
200
+ | **🔄 Upstream-Updates** | validate-connection, Defaults & Pairing aus Backup Baileys | ✅ **Neu** |
201
+ | **🔐 LID in Pairing** | Linked ID (lid) in configureSuccessfulPairing & me | ✅ **Neu** |
202
+ | **📤 historySyncConfig** | Vollständiges DeviceProps in generateRegistrationNode | ✅ **Neu** |
203
+ | **🌐 getWebInfo** | Desktop-Check für syncFullHistory (browser[1] === 'Desktop') | ✅ **Neu** |
204
+ | **⚙️ Defaults** | enableAutoSessionRecreation, enableRecentMessageCache, shouldSyncHistoryMessage | ✅ **Neu** |
205
+ | **🚀 Smart Message Queue** | Intelligente Queue mit Auto-Retry & Prioritäten | ✅ |
206
+ | **🎨 QR-Anzeige** | Schöne QR-Code-Box · unverändert | ✅ |
207
+ | **🎯 Message ID** | Message-ID-Generierung · unverändert | ✅ |
208
+ | **📦 WhatsApp Version** | [2, 3000, 1032141294] · Basiert auf @whiskeysockets/baileys 7.0.0-rc.9 | ✅ |
201
209
 
202
210
  </div>
203
211
 
@@ -852,15 +860,32 @@ const sock = makeWASocket({
852
860
 
853
861
  ## 📝 Changelog
854
862
 
855
- ### Version 1.7.0 (Aktuell) 🎉
863
+ ### Version 2.0.0 (Aktuell) 🎉
856
864
 
857
- - 🚀 **BRANDNEU: Smart Message Queue** - Intelligente Queue mit Auto-Retry, Prioritäten & Rate-Limiting
858
- - **Verbesserte Auto-Update-Prüfung** - Noch zuverlässiger
859
- - 🎨 **Verbesserte QR-Code-Anzeige** mit Version-Info
860
- - 🔄 **WhatsApp-Version** aktualisiert auf [2, 3000, 1032141294]
861
- - 🚀 **Basiert auf** @whiskeysockets/baileys 7.0.0-rc.9
862
- - 🛠️ **Verbesserte Socket-Stabilität**
863
- - 🔐 **Verbesserte Pre-Key-Verwaltung**
865
+ - 🔄 **Upstream aus Backup Baileys** validate-connection, Defaults & Pairing angeglichen
866
+ - 🔐 **LID in Pairing** lid in configureSuccessfulPairing, me.lid, createSignalIdentity(lid)
867
+ - 📤 **historySyncConfig** Vollständiges DeviceProps in generateRegistrationNode
868
+ - 🌐 **getWebInfo** Desktop-Check für syncFullHistory
869
+ - ⚙️ **Defaults** enableAutoSessionRecreation, enableRecentMessageCache, shouldSyncHistoryMessage
870
+ - 📖 **README Glow-Up** – Version 2.0.0, schick & aktuell
871
+ - 🎨 **QR-Code** & **Message ID** – unverändert (wie gewünscht)
872
+ - 🔄 **WhatsApp-Version** [2, 3000, 1032141294]
873
+
874
+ ### Version 1.1.2
875
+
876
+ - 📖 README Glow-Up, Baileys API 1.7.2 Badge
877
+ - 🚀 Smart Message Queue, Auto-Update-Prüfung
878
+ - 🎨 QR-Code-Anzeige · Message ID unverändert
879
+
880
+ ### Version 1.7.1
881
+
882
+ - 📖 README Glow-Up, Smart Message Queue, Auto-Update-Check
883
+ - 🎨 QR-Anzeige, Message ID System
884
+
885
+ ### Version 1.7.0
886
+
887
+ - 🚀 **Smart Message Queue** eingeführt
888
+ - ✨ Auto-Update-Check, QR-Anzeige, Message ID System
864
889
 
865
890
  ### Version 1.6.6
866
891
 
@@ -1,3 +1 @@
1
- {
2
- "version": [2, 3000, 1032141294]
3
- }
1
+ {"version":[2,3000,1032141294]}
@@ -84,11 +84,15 @@ exports.DEFAULT_CONNECTION_CONFIG = {
84
84
  markOnlineOnConnect: true,
85
85
  syncFullHistory: false,
86
86
  patchMessageBeforeSending: msg => msg,
87
- shouldSyncHistoryMessage: () => true,
87
+ shouldSyncHistoryMessage: ({ syncType }) => {
88
+ return syncType !== WAProto_1.proto.HistorySync.HistorySyncType.FULL
89
+ },
88
90
  shouldIgnoreJid: () => false,
89
91
  linkPreviewImageThumbnailWidth: 192,
90
92
  transactionOpts: { maxCommitRetries: 10, delayBetweenTriesMs: 3000 },
91
93
  generateHighQualityLinkPreview: false,
94
+ enableAutoSessionRecreation: true,
95
+ enableRecentMessageCache: true,
92
96
  options: {},
93
97
  appStateMacVerification: {
94
98
  patch: false,
@@ -18,120 +18,6 @@ const Client_1 = require("./Client")
18
18
  const package_json_1 = require("../../package.json")
19
19
  const CURRENT_VERSION = package_json_1.version
20
20
 
21
- // Versions-Info auslesen
22
- const createRequire = require('module').createRequire || require('module').createRequire;
23
- const _require = createRequire(require.main ? require.main.filename : __filename);
24
- const _path = require('path');
25
- const _fs = require('fs');
26
- const _dir = _path.dirname(__filename);
27
-
28
- function readVersion(pkgPath) {
29
- try {
30
- if (pkgPath && _fs.existsSync(pkgPath)) {
31
- const p = _require(pkgPath);
32
- return p && typeof p.version === 'string' ? p.version : null;
33
- }
34
- } catch (_) {}
35
- return null;
36
- }
37
-
38
- const cwd = typeof process !== 'undefined' && process.cwd ? process.cwd() : '';
39
- const rootBaileys = cwd ? _path.join(cwd, 'node_modules', '@neelegirl', 'baileys', 'package.json') : '';
40
- const rootWaApi = cwd ? _path.join(cwd, 'node_modules', '@neelegirl', 'wa-api', 'package.json') : '';
41
- const BAILEYS_VERSION = readVersion(rootBaileys) || CURRENT_VERSION || '1.6.0';
42
- const WA_API_VERSION = readVersion(rootWaApi) || '1.0.0';
43
-
44
- // Globale Flag um sicherzustellen, dass Version-Anzeige nur einmal pro Prozess angezeigt wird
45
- if (typeof global !== 'undefined' && !global.__baileysVersionShown) {
46
- global.__baileysVersionShown = false;
47
- }
48
-
49
- // Version-Anzeige-Funktion
50
- const showVersionInfo = () => {
51
- if (typeof global !== 'undefined' && global.__baileysVersionShown) {
52
- return; // Bereits angezeigt
53
- }
54
- const boxWidth = 64;
55
- const centerText = (text, width) => {
56
- const pad = Math.floor((width - text.length - 2) / 2);
57
- const extra = (width - text.length - 2) % 2;
58
- return '║' + ' '.repeat(pad) + text + ' '.repeat(pad + extra) + '║';
59
- };
60
- console.log('\n');
61
- console.log('╔' + '═'.repeat(boxWidth) + '╗');
62
- console.log(centerText(`🌸 OFFIZIELLE @NEELEGIRL/BAILEYS VERSION ${BAILEYS_VERSION} 🌸`, boxWidth));
63
- console.log(centerText(`🦋 @neelegirl/wa-api v${WA_API_VERSION} 🦋`, boxWidth));
64
- console.log('╠' + '═'.repeat(boxWidth) + '╣');
65
- console.log(centerText('✨ Powered By @neelegirl/baileys · wa-api 🦋 ✨', boxWidth));
66
- console.log('╚' + '═'.repeat(boxWidth) + '╝');
67
- console.log('');
68
- if (typeof global !== 'undefined') {
69
- global.__baileysVersionShown = true;
70
- }
71
- };
72
-
73
- // Versionsvergleichsfunktion
74
- const compareVersions = (v1, v2) => {
75
- const parts1 = v1.split('.').map(Number);
76
- const parts2 = v2.split('.').map(Number);
77
- for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
78
- const part1 = parts1[i] || 0;
79
- const part2 = parts2[i] || 0;
80
- if (part1 > part2) return 1;
81
- if (part1 < part2) return -1;
82
- }
83
- return 0;
84
- };
85
-
86
- // Update-Prüfungs-Funktion für beide Pakete
87
- const checkForUpdates = () => {
88
- // Prüfe nur einmal pro Prozess
89
- if (typeof global !== 'undefined' && global.__updateCheckDone) {
90
- return;
91
- }
92
-
93
- const https = require('https');
94
-
95
- // Prüfe @neelegirl/baileys
96
- Utils_1.checkNpmVersion('@neelegirl/baileys', BAILEYS_VERSION).then((versionInfo) => {
97
- if (versionInfo && versionInfo.hasUpdate) {
98
- const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUES UPDATE VERFÜGBAR! 🔔 ║\n╠════════════════════════════════════════╣\n║ @neelegirl/baileys ║\n║ Aktuelle Version: ${versionInfo.current.padEnd(20)} ║\n║ Neue Version: ${versionInfo.latest.padEnd(20)} ║\n║ ║\n║ Bitte aktualisiere: ║\n║ npm install @neelegirl/baileys@latest ║\n╚════════════════════════════════════════╝\n`;
99
- console.log(updateMessage);
100
- }
101
- }).catch(() => {
102
- // Silently fail
103
- });
104
-
105
- // Prüfe @neelegirl/wa-api
106
- const waApiUrl = `https://registry.npmjs.org/@neelegirl/wa-api/latest`;
107
- https.get(waApiUrl, { timeout: 5000 }, (res) => {
108
- let data = '';
109
- res.on('data', (chunk) => {
110
- data += chunk;
111
- });
112
- res.on('end', () => {
113
- try {
114
- const packageInfo = JSON.parse(data);
115
- const latestVersion = packageInfo.version;
116
- if (latestVersion && compareVersions(latestVersion, WA_API_VERSION) > 0) {
117
- const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUES UPDATE VERFÜGBAR! 🔔 ║\n╠════════════════════════════════════════╣\n║ @neelegirl/wa-api ║\n║ Aktuelle Version: ${WA_API_VERSION.padEnd(20)} ║\n║ Neue Version: ${latestVersion.padEnd(20)} ║\n║ ║\n║ Bitte aktualisiere: ║\n║ npm install @neelegirl/wa-api@latest ║\n╚════════════════════════════════════════╝\n`;
118
- console.log(updateMessage);
119
- }
120
- } catch (error) {
121
- // Silently fail
122
- }
123
- });
124
- }).on('error', () => {
125
- // Silently fail
126
- }).on('timeout', () => {
127
- // Silently fail
128
- });
129
-
130
- if (typeof global !== 'undefined') {
131
- global.__updateCheckDone = true;
132
- }
133
- };
134
-
135
21
  /**
136
22
  * Connects to WA servers and performs:
137
23
  * - simple queries (no retry mechanism, wait for connection establishment)
@@ -139,10 +25,6 @@ const checkForUpdates = () => {
139
25
  * - query phone connection
140
26
  */
141
27
  const makeSocket = (config) => {
142
- // Zeige Version-Info beim Start einmal an
143
- showVersionInfo();
144
- // Prüfe auf Updates bei beiden Paketen
145
- checkForUpdates();
146
28
  const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository } = config
147
29
 
148
30
  const url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl
@@ -911,8 +793,6 @@ const makeSocket = (config) => {
911
793
  clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try
912
794
  ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } })
913
795
  ev.emit('connection.update', { connection: 'open' })
914
- // Zeige Version-Info auch bei erfolgreicher Verbindung (falls noch nicht angezeigt)
915
- showVersionInfo()
916
796
  if (node.attrs.lid && authState.creds.me?.id) {
917
797
  const myLID = node.attrs.lid
918
798
  process.nextTick(async () => {
@@ -8,19 +8,6 @@ const https_1 = require("https");
8
8
  * @param currentVersion - The current version installed
9
9
  * @returns Promise with version info or null if check fails
10
10
  */
11
- // Version-Vergleichsfunktion (semantische Versionierung)
12
- const compareVersions = (v1, v2) => {
13
- const parts1 = v1.split('.').map(Number);
14
- const parts2 = v2.split('.').map(Number);
15
- for (let i = 0; i < Math.max(parts1.length, parts2.length); i++) {
16
- const part1 = parts1[i] || 0;
17
- const part2 = parts2[i] || 0;
18
- if (part1 > part2) return 1;
19
- if (part1 < part2) return -1;
20
- }
21
- return 0;
22
- };
23
-
24
11
  const checkNpmVersion = (packageName, currentVersion) => {
25
12
  return new Promise((resolve) => {
26
13
  const url = `https://registry.npmjs.org/${packageName}/latest`;
@@ -33,8 +20,7 @@ const checkNpmVersion = (packageName, currentVersion) => {
33
20
  try {
34
21
  const packageInfo = JSON.parse(data);
35
22
  const latestVersion = packageInfo.version;
36
- // Nur anzeigen wenn latestVersion wirklich NEUER ist als die aktuelle Version
37
- if (latestVersion && compareVersions(latestVersion, currentVersion) > 0) {
23
+ if (latestVersion && latestVersion !== currentVersion) {
38
24
  resolve({
39
25
  current: currentVersion,
40
26
  latest: latestVersion,
@@ -38,5 +38,4 @@ __exportStar(require("./link-preview"), exports)
38
38
  __exportStar(require("./event-buffer"), exports)
39
39
  __exportStar(require("./process-message"), exports)
40
40
  __exportStar(require("./message-retry-manager"), exports)
41
- __exportStar(require("./check-npm-version"), exports)
42
- __exportStar(require("./smart-message-queue"), exports)
41
+ __exportStar(require("./check-npm-version"), exports)
@@ -19,7 +19,7 @@ const getUserAgent = (config) => {
19
19
  tertiary: config.version[2],
20
20
  },
21
21
  platform: WAProto_1.proto.ClientPayload.UserAgent.Platform.WEB,
22
- releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.BETA,
22
+ releaseChannel: WAProto_1.proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
23
23
  osVersion: '0.1',
24
24
  device: 'Desktop',
25
25
  deviceType: WAProto_1.proto.ClientPayload.UserAgent.DeviceType.DESKTOP,
@@ -39,7 +39,11 @@ const PLATFORM_MAP = {
39
39
 
40
40
  const getWebInfo = (config) => {
41
41
  let webSubPlatform = WAProto_1.proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER
42
- if (config.syncFullHistory && PLATFORM_MAP[config.browser[0]]) {
42
+ if (
43
+ config.syncFullHistory &&
44
+ PLATFORM_MAP[config.browser[0]] &&
45
+ config.browser[1] === 'Desktop'
46
+ ) {
43
47
  webSubPlatform = PLATFORM_MAP[config.browser[0]]
44
48
  }
45
49
  return { webSubPlatform }
@@ -59,17 +63,21 @@ const generateLoginNode = (userJid, config) => {
59
63
  const { user, device } = WABinary_1.jidDecode(userJid)
60
64
  const payload = {
61
65
  ...getClientPayload(config),
62
- passive: false,
66
+ passive: true,
63
67
  pull: true,
64
68
  username: +user,
65
69
  device: device,
70
+ lidDbMigrated: false,
66
71
  }
67
72
  return WAProto_1.proto.ClientPayload.fromObject(payload)
68
73
  }
69
74
 
70
75
  const getPlatformType = (platform) => {
71
76
  const platformType = platform.toUpperCase()
72
- return WAProto_1.proto.DeviceProps.PlatformType[platformType] || WAProto_1.proto.DeviceProps.PlatformType.DESKTOP
77
+ return (
78
+ WAProto_1.proto.DeviceProps.PlatformType[platformType] ||
79
+ WAProto_1.proto.DeviceProps.PlatformType.CHROME
80
+ )
73
81
  }
74
82
 
75
83
  const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentityKey }, config) => {
@@ -82,6 +90,28 @@ const generateRegistrationNode = ({ registrationId, signedPreKey, signedIdentity
82
90
  os: config.browser[0],
83
91
  platformType: getPlatformType(config.browser[1]),
84
92
  requireFullSync: config.syncFullHistory,
93
+ historySyncConfig: {
94
+ storageQuotaMb: 10240,
95
+ inlineInitialPayloadInE2EeMsg: true,
96
+ recentSyncDaysLimit: undefined,
97
+ supportCallLogHistory: false,
98
+ supportBotUserAgentChatHistory: true,
99
+ supportCagReactionsAndPolls: true,
100
+ supportBizHostedMsg: true,
101
+ supportRecentSyncChunkMessageCountTuning: true,
102
+ supportHostedGroupMsg: true,
103
+ supportFbidBotChatHistory: true,
104
+ supportAddOnHistorySyncMigration: undefined,
105
+ supportMessageAssociation: true,
106
+ supportGroupHistory: false,
107
+ onDemandReady: undefined,
108
+ supportGuestChat: undefined,
109
+ },
110
+ version: {
111
+ primary: 10,
112
+ secondary: 15,
113
+ tertiary: 7,
114
+ },
85
115
  }
86
116
  const companionProto = WAProto_1.proto.DeviceProps.encode(companion).finish()
87
117
  const registerPayload = {
@@ -114,6 +144,7 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
114
144
  }
115
145
  const bizName = businessNode?.attrs?.name
116
146
  const jid = deviceNode.attrs.jid
147
+ const lid = deviceNode.attrs.lid
117
148
  const { details, hmac, accountType } = WAProto_1.proto.ADVSignedDeviceIdentityHMAC.decode(deviceIdentityNode.content)
118
149
  const isHostedAccount = accountType !== undefined && accountType === WAProto_1.proto.ADVEncryptionType.HOSTED
119
150
  const hmacPrefix = isHostedAccount ? Buffer.from([6, 5]) : Buffer.alloc(0)
@@ -130,7 +161,7 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
130
161
  const devicePrefix = isHostedAccount ? Buffer.from([6, 6]) : Buffer.from([6, 1])
131
162
  const deviceMsg = Buffer.concat([devicePrefix, deviceDetails, signedIdentityKey.public, accountSignatureKey])
132
163
  account.deviceSignature = crypto_2.Curve.sign(signedIdentityKey.private, deviceMsg)
133
- const identity = signal_1.createSignalIdentity(jid, accountSignatureKey)
164
+ const identity = signal_1.createSignalIdentity(lid || jid, accountSignatureKey)
134
165
  const accountEnc = encodeSignedDeviceIdentity(account, false)
135
166
  const deviceIdentity = WAProto_1.proto.ADVDeviceIdentity.decode(account.details)
136
167
  const reply = {
@@ -156,7 +187,7 @@ const configureSuccessfulPairing = (stanza, { advSecretKey, signedIdentityKey, s
156
187
  }
157
188
  const authUpdate = {
158
189
  account,
159
- me: { id: jid, name: bizName },
190
+ me: { id: jid, name: bizName, lid },
160
191
  signalIdentities: [
161
192
  ...(signalIdentities || []),
162
193
  identity
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirl/baileys",
3
- "version": "1.7.0",
3
+ "version": "2.0.0",
4
4
  "description": "WhatsApp API for wa-api, a multi-device WhatsApp Web API client",
5
5
  "keywords": [
6
6
  "whatsapp",
@@ -41,11 +41,9 @@
41
41
  "cache-manager": "4.0.1",
42
42
  "futoin-hkdf": "^1.5.1",
43
43
  "libphonenumber-js": "^1.10.20",
44
- "lru-cache": "^11.1.0",
45
- "music-metadata": "^11.7.0",
44
+ "music-metadata": "^7.12.3",
46
45
  "node-cache": "^5.1.2",
47
- "p-queue": "^9.0.0",
48
- "pino": "^9.6.0",
46
+ "pino": "^7.0.0",
49
47
  "protobufjs": "^7.2.4",
50
48
  "uuid": "^9.0.0",
51
49
  "ws": "^8.13.0"
@@ -1,87 +0,0 @@
1
- "use strict";
2
- /**
3
- * Smart Message Queue - Intelligente Nachrichten-Warteschlange
4
- *
5
- * Diese Funktion erstellt eine intelligente Queue für Nachrichten,
6
- * die automatisch Retries durchführt, Prioritäten verwaltet und
7
- * Rate-Limiting unterstützt.
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.createSmartMessageQueue = void 0;
11
- /**
12
- * Erstellt eine intelligente Nachrichten-Warteschlange
13
- */
14
- function createSmartMessageQueue(socket, options = {}) {
15
- const { maxRetries = 3, retryDelay = 1000, maxConcurrent = 5, onSuccess, onError } = options;
16
- const queue = [];
17
- let processing = 0;
18
- let paused = false;
19
- let failed = 0;
20
- const processQueue = async () => {
21
- if (paused || processing >= maxConcurrent || queue.length === 0) {
22
- return;
23
- }
24
- // Sortiere nach Priorität (high > normal > low)
25
- queue.sort((a, b) => {
26
- const priorityOrder = { high: 3, normal: 2, low: 1 };
27
- return (priorityOrder[b.priority || 'normal'] || 2) - (priorityOrder[a.priority || 'normal'] || 2);
28
- });
29
- const message = queue.shift();
30
- if (!message)
31
- return;
32
- processing++;
33
- try {
34
- await socket.sendMessage(message.jid, message.message, message.options);
35
- if (onSuccess) {
36
- onSuccess(message);
37
- }
38
- }
39
- catch (error) {
40
- const retries = (message.retries || 0) + 1;
41
- if (retries < maxRetries) {
42
- // Retry mit Exponential Backoff
43
- const delay = retryDelay * Math.pow(2, retries - 1);
44
- message.retries = retries;
45
- message.timestamp = Date.now() + delay;
46
- setTimeout(() => {
47
- queue.push(message);
48
- processQueue();
49
- }, delay);
50
- }
51
- else {
52
- failed++;
53
- if (onError) {
54
- onError(message, error);
55
- }
56
- }
57
- }
58
- finally {
59
- processing--;
60
- processQueue();
61
- }
62
- };
63
- return {
64
- add: async (message) => {
65
- message.timestamp = message.timestamp || Date.now();
66
- message.retries = message.retries || 0;
67
- queue.push(message);
68
- processQueue();
69
- },
70
- clear: () => {
71
- queue.length = 0;
72
- },
73
- getStats: () => ({
74
- pending: queue.length,
75
- processing,
76
- failed
77
- }),
78
- pause: () => {
79
- paused = true;
80
- },
81
- resume: () => {
82
- paused = false;
83
- processQueue();
84
- }
85
- };
86
- }
87
- exports.createSmartMessageQueue = createSmartMessageQueue;
@@ -1,148 +0,0 @@
1
- /**
2
- * Smart Message Queue - Intelligente Nachrichten-Warteschlange
3
- *
4
- * Diese Funktion erstellt eine intelligente Queue für Nachrichten,
5
- * die automatisch Retries durchführt, Prioritäten verwaltet und
6
- * Rate-Limiting unterstützt.
7
- *
8
- * @example
9
- * ```typescript
10
- * import { createSmartMessageQueue } from '@neelegirl/baileys'
11
- *
12
- * const queue = createSmartMessageQueue({
13
- * maxRetries: 3,
14
- * retryDelay: 1000,
15
- * maxConcurrent: 5
16
- * })
17
- *
18
- * await queue.add({
19
- * jid: '491234567890@s.whatsapp.net',
20
- * message: { text: 'Hallo!' },
21
- * priority: 'high'
22
- * })
23
- * ```
24
- */
25
-
26
- import type { AnyMessageContent, MiscMessageGenerationOptions, WAMessageKey } from '../../Types'
27
- import type { WASocket } from '../Socket'
28
-
29
- export interface QueueMessage {
30
- jid: string
31
- message: AnyMessageContent
32
- options?: MiscMessageGenerationOptions
33
- priority?: 'low' | 'normal' | 'high'
34
- retries?: number
35
- timestamp?: number
36
- }
37
-
38
- export interface SmartQueueOptions {
39
- maxRetries?: number
40
- retryDelay?: number
41
- maxConcurrent?: number
42
- onSuccess?: (message: QueueMessage) => void
43
- onError?: (message: QueueMessage, error: Error) => void
44
- }
45
-
46
- export interface SmartMessageQueue {
47
- add: (message: QueueMessage) => Promise<void>
48
- clear: () => void
49
- getStats: () => { pending: number; processing: number; failed: number }
50
- pause: () => void
51
- resume: () => void
52
- }
53
-
54
- /**
55
- * Erstellt eine intelligente Nachrichten-Warteschlange
56
- */
57
- export function createSmartMessageQueue(
58
- socket: WASocket,
59
- options: SmartQueueOptions = {}
60
- ): SmartMessageQueue {
61
- const {
62
- maxRetries = 3,
63
- retryDelay = 1000,
64
- maxConcurrent = 5,
65
- onSuccess,
66
- onError
67
- } = options
68
-
69
- const queue: QueueMessage[] = []
70
- let processing = 0
71
- let paused = false
72
- let failed = 0
73
-
74
- const processQueue = async () => {
75
- if (paused || processing >= maxConcurrent || queue.length === 0) {
76
- return
77
- }
78
-
79
- // Sortiere nach Priorität (high > normal > low)
80
- queue.sort((a, b) => {
81
- const priorityOrder = { high: 3, normal: 2, low: 1 }
82
- return (priorityOrder[b.priority || 'normal'] || 2) - (priorityOrder[a.priority || 'normal'] || 2)
83
- })
84
-
85
- const message = queue.shift()
86
- if (!message) return
87
-
88
- processing++
89
-
90
- try {
91
- await socket.sendMessage(message.jid, message.message, message.options)
92
-
93
- if (onSuccess) {
94
- onSuccess(message)
95
- }
96
- } catch (error) {
97
- const retries = (message.retries || 0) + 1
98
-
99
- if (retries < maxRetries) {
100
- // Retry mit Exponential Backoff
101
- const delay = retryDelay * Math.pow(2, retries - 1)
102
- message.retries = retries
103
- message.timestamp = Date.now() + delay
104
-
105
- setTimeout(() => {
106
- queue.push(message)
107
- processQueue()
108
- }, delay)
109
- } else {
110
- failed++
111
- if (onError) {
112
- onError(message, error as Error)
113
- }
114
- }
115
- } finally {
116
- processing--
117
- processQueue()
118
- }
119
- }
120
-
121
- return {
122
- add: async (message: QueueMessage) => {
123
- message.timestamp = message.timestamp || Date.now()
124
- message.retries = message.retries || 0
125
- queue.push(message)
126
- processQueue()
127
- },
128
-
129
- clear: () => {
130
- queue.length = 0
131
- },
132
-
133
- getStats: () => ({
134
- pending: queue.length,
135
- processing,
136
- failed
137
- }),
138
-
139
- pause: () => {
140
- paused = true
141
- },
142
-
143
- resume: () => {
144
- paused = false
145
- processQueue()
146
- }
147
- }
148
- }