@neelegirl/baileys 2.0.0 → 2.0.2

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
@@ -5,7 +5,7 @@
5
5
  ### *Die WhatsApp Web API, die alles kann*
6
6
  ### *Smart Queue · QR-Code · Message ID · LID · TypeScript*
7
7
 
8
- [![Version](https://img.shields.io/badge/Version-2.0.0-ff69b4?style=for-the-badge&logo=github)](https://github.com/neelegirl/baileys)
8
+ [![Version](https://img.shields.io/badge/Version-2.0.2-ff69b4?style=for-the-badge&logo=github)](https://github.com/neelegirl/baileys)
9
9
  [![Baileys API](https://img.shields.io/badge/Baileys_API-1.7.2-9b59b6?style=for-the-badge)](https://github.com/WhiskeySockets/Baileys)
10
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
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)
@@ -20,9 +20,9 @@
20
20
 
21
21
  | 📦 Paket | 🎯 Baileys API | ✨ Highlights |
22
22
  |----------|----------------|----------------|
23
- | **@neelegirl/baileys v2.0.0** | **1.7.2** | Upstream-Updates · QR-Code · Message ID unverändert |
23
+ | **@neelegirl/baileys v2.0.2** | **1.7.2** | Upstream-Updates · QR-Code · Message ID · Update-Check von npm |
24
24
 
25
- **✨ v2.0.0** · Upstream aus Backup Baileys · Kompatibel mit Baileys **1.7.2** · QR & Message ID bleiben wie gewohnt
25
+ **✨ v2.0.2** · README Glow-Up · Kompatibel mit Baileys **1.7.2** · QR & Message ID unverändert · Update-Prüfung via npm-Registry
26
26
 
27
27
  [**Installation**](#-installation) · [**Quickstart**](#-quickstart-guide) · [**Features**](#-neue-features-in-version-200) · [**Dokumentation**](#-dokumentation) · [**Support**](#-support--community)
28
28
 
@@ -35,7 +35,7 @@
35
35
  - [✨ Warum @neelegirl/baileys?](#-warum-neelegirlbaileys)
36
36
  - [🚀 Installation](#-installation)
37
37
  - [📖 Quickstart Guide](#-quickstart-guide)
38
- - [✨ Neue Features in Version 2.0.0](#-neue-features-in-version-200)
38
+ - [✨ Neue Features in Version 2.0.2](#-neue-features-in-version-202)
39
39
  - [💡 Grundlegende Verwendung](#-grundlegende-verwendung)
40
40
  - [🎯 Erweiterte Features](#-erweiterte-features)
41
41
  - [📚 Dokumentation](#-dokumentation)
@@ -188,10 +188,10 @@ startBot().catch(console.error)
188
188
 
189
189
  ---
190
190
 
191
- ## ✨ Neue Features in Version 2.0.0
191
+ ## ✨ Neue Features in Version 2.0.2
192
192
 
193
193
  ### 🆕 **Was ist neu?**
194
- **Kompatibel mit Baileys API 1.7.2** · Upstream aus **Backup Baileys** integriert · **Message ID & QR-Code unverändert**
194
+ **Kompatibel mit Baileys API 1.7.2** · **Update-Check von npm-Registry** (1× pro Prozess) · **Message ID & QR-Code unverändert**
195
195
 
196
196
  <div align="center">
197
197
 
@@ -860,16 +860,23 @@ const sock = makeWASocket({
860
860
 
861
861
  ## 📝 Changelog
862
862
 
863
- ### Version 2.0.0 (Aktuell) 🎉
863
+ ### Version 2.0.2 (Aktuell) 🎉
864
864
 
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]
865
+ - 📖 **README Glow-Up** – Version 2.0.2, Badges & Changelog
866
+ - 🔔 **Update-Check** – Liest Version von **npm-Registry** (registry.npmjs.org), nur 1× pro Prozess
867
+ - Semver-Vergleich für „Update verfügbar“ nur bei wirklich neuerer Version
868
+ - 🎨 **QR-Code** & **Message ID** – unverändert
869
+ - 🔄 Kompatibel mit **Baileys API 1.7.2**
870
+
871
+ ### Version 2.0.1
872
+
873
+ - 🔄 Upstream aus Backup Baileys · LID in Pairing · historySyncConfig · getWebInfo · Defaults
874
+
875
+ ### Version 2.0.0
876
+
877
+ - 🔄 Upstream aus Backup Baileys – validate-connection, Defaults & Pairing angeglichen
878
+ - 🔐 LID in Pairing · 📤 historySyncConfig · 🌐 getWebInfo · ⚙️ Defaults
879
+ - 🎨 QR-Code & Message ID unverändert · WhatsApp-Version [2, 3000, 1032141294]
873
880
 
874
881
  ### Version 1.1.2
875
882
 
@@ -17,6 +17,7 @@ const USyncUser_1 = require("../WAUSync/USyncUser")
17
17
  const Client_1 = require("./Client")
18
18
  const package_json_1 = require("../../package.json")
19
19
  const CURRENT_VERSION = package_json_1.version
20
+ let baileysUpdateCheckDone = false
20
21
 
21
22
  /**
22
23
  * Connects to WA servers and performs:
@@ -706,8 +707,7 @@ const makeSocket = (config) => {
706
707
  const advB64 = creds.advSecretKey
707
708
 
708
709
  let qrMs = qrTimeout || 60000 // time to let a QR live
709
- let versionChecked = false
710
-
710
+
711
711
  const genPairQR = () => {
712
712
  if (!ws.isOpen) {
713
713
  return
@@ -723,26 +723,20 @@ const makeSocket = (config) => {
723
723
  const ref = refNode.content.toString('utf-8')
724
724
  const qr = [ref, noiseKeyB64, identityKeyB64, advB64].join(',')
725
725
 
726
- // Check for NPM version update (only once, on first QR)
727
- if (!versionChecked) {
728
- versionChecked = true
726
+ // Check for NPM version update nur 1x pro Prozess
727
+ if (!baileysUpdateCheckDone) {
728
+ baileysUpdateCheckDone = true
729
729
  Utils_1.checkNpmVersion('@neelegirl/baileys', CURRENT_VERSION).then((versionInfo) => {
730
- if (versionInfo) {
730
+ if (versionInfo && printQRInTerminal) {
731
731
  if (versionInfo.hasUpdate) {
732
- const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUE VERSION VERFÜGBAR! 🔔 ║\n╠════════════════════════════════════════╣\n║ Aktuelle Version: ${versionInfo.current.padEnd(20)} ║\n║ Neue Version: ${versionInfo.latest.padEnd(20)} ║\n║ ║\n║ Bitte aktualisiere @neelegirl/baileys ║\n║ npm install @neelegirl/baileys@latest ║\n╚════════════════════════════════════════╝\n`
733
- if (printQRInTerminal) {
734
- logger.info(updateMessage)
735
- }
732
+ const updateMessage = `\n╔════════════════════════════════════════╗\n║ 🔔 NEUE VERSION 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`
733
+ console.log(updateMessage)
736
734
  } else {
737
- const currentVersionMessage = `\n╔════════════════════════════════════════╗\n║ ✅ Du nutzt gerade die aktuelle ║\n║ Version von @neelegirl/baileys ║\n║ ║\n║ Wir informieren dich, wenn es ein ║\n║ Update gibt. ║\n╚════════════════════════════════════════╝\n`
738
- if (printQRInTerminal) {
739
- logger.info(currentVersionMessage)
740
- }
735
+ const currentVersionMessage = `\n╔════════════════════════════════════════╗\n║ ✅ Du nutzt die aktuelle Version ║\n║ von @neelegirl/baileys ║\n╚════════════════════════════════════════╝\n`
736
+ console.log(currentVersionMessage)
741
737
  }
742
738
  }
743
- }).catch(() => {
744
- // Silently fail if version check fails
745
- })
739
+ }).catch(() => {})
746
740
  }
747
741
 
748
742
  ev.emit('connection.update', { qr })
@@ -2,14 +2,28 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.checkNpmVersion = void 0;
4
4
  const https_1 = require("https");
5
+
6
+ function isNewerVersion(latest, current) {
7
+ if (!latest || !current) return false;
8
+ const a = current.split('.').map((n) => parseInt(n, 10) || 0);
9
+ const b = latest.split('.').map((n) => parseInt(n, 10) || 0);
10
+ for (let i = 0; i < Math.max(a.length, b.length); i++) {
11
+ const x = a[i] || 0, y = b[i] || 0;
12
+ if (y > x) return true;
13
+ if (y < x) return false;
14
+ }
15
+ return false;
16
+ }
17
+
5
18
  /**
6
- * Check if a new version is available on NPM
7
- * @param packageName - The package name to check (e.g., '@neelegirl/baileys')
8
- * @param currentVersion - The current version installed
9
- * @returns Promise with version info or null if check fails
19
+ * Liest von der offiziellen npm-Registry (registry.npmjs.org), ob eine neuere Version existiert.
20
+ * @param packageName - Paketname (z.B. '@neelegirl/baileys')
21
+ * @param currentVersion - Aktuell installierte Version
22
+ * @returns Promise mit Version-Info oder null bei Fehler
10
23
  */
11
24
  const checkNpmVersion = (packageName, currentVersion) => {
12
25
  return new Promise((resolve) => {
26
+ // Offizielle npm-Registry: https://registry.npmjs.org/
13
27
  const url = `https://registry.npmjs.org/${packageName}/latest`;
14
28
  https_1.default.get(url, { timeout: 5000 }, (res) => {
15
29
  let data = '';
@@ -20,7 +34,7 @@ const checkNpmVersion = (packageName, currentVersion) => {
20
34
  try {
21
35
  const packageInfo = JSON.parse(data);
22
36
  const latestVersion = packageInfo.version;
23
- if (latestVersion && latestVersion !== currentVersion) {
37
+ if (latestVersion && isNewerVersion(latestVersion, currentVersion)) {
24
38
  resolve({
25
39
  current: currentVersion,
26
40
  latest: latestVersion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neelegirl/baileys",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "WhatsApp API for wa-api, a multi-device WhatsApp Web API client",
5
5
  "keywords": [
6
6
  "whatsapp",