astrabail 1.1.0 → 1.1.1

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.
@@ -1,7 +1,50 @@
1
- const major = parseInt(process.versions.node.split('.')[0], 10);
2
- if (major < 20) {
3
- console.error(`\n❌ This package requires Node.js 20+ to run reliably.\n` +
4
- ` You are using Node.js ${process.versions.node}.\n` +
5
- ` Please upgrade to Node.js 20+ to proceed.\n`);
1
+ 'use strict';
2
+
3
+ const currentVersion = process.versions.node;
4
+ const majorVersion = parseInt(currentVersion.split('.')[0], 10);
5
+ const requiredVersion = 20;
6
+
7
+ if (majorVersion < requiredVersion) {
8
+ // Menggunakan ANSI Escape Codes murni agar tetap berfungsi meski dependencies belum diinstall
9
+ const colors = {
10
+ red: '\x1b[31m',
11
+ yellow: '\x1b[33m',
12
+ cyan: '\x1b[36m',
13
+ blue: '\x1b[34m',
14
+ reset: '\x1b[0m',
15
+ bold: '\x1b[1m'
16
+ };
17
+
18
+ const width = 60;
19
+
20
+ const printLine = (text, color = '') => {
21
+ // Hilangkan ANSI codes untuk menghitung panjang karakter asli
22
+ const plainText = text.replace(/\x1b\[[0-9;]*m/g, '');
23
+ const padLen = Math.max(0, width - 4 - plainText.length);
24
+ const padding = ' '.repeat(padLen);
25
+ console.error(`${colors.red}${colors.bold}│${colors.reset} ${color}${text}${colors.reset}${padding} ${colors.red}${colors.bold}│${colors.reset}`);
26
+ };
27
+
28
+ console.error('');
29
+ console.error(`${colors.red}${colors.bold}┌${'─'.repeat(width - 2)}┐${colors.reset}`);
30
+ console.error(`${colors.red}${colors.bold}│${' '.repeat(Math.floor((width - 32) / 2))}🔥 ASTRA ENGINE CRASHED 🔥${' '.repeat(Math.ceil((width - 32) / 2) - 2)}│${colors.reset}`);
31
+ console.error(`${colors.red}${colors.bold}├${'─'.repeat(width - 2)}┤${colors.reset}`);
32
+
33
+ printLine('');
34
+ printLine(`${colors.bold}AstraBail requires a modern Node.js environment.`, colors.yellow);
35
+ printLine('This library uses advanced multi-device capabilities', colors.yellow);
36
+ printLine('that are only supported on the latest V8 Engine.', colors.yellow);
37
+ printLine('');
38
+ printLine(`Required Node.js : ${colors.cyan}${colors.bold}>= v${requiredVersion}.0.0`);
39
+ printLine(`Current Node.js : ${colors.red}${colors.bold}v${currentVersion}`);
40
+ printLine('');
41
+ printLine(`Action Required:`, colors.cyan);
42
+ printLine(`Please upgrade your Node.js version to proceed.`);
43
+ printLine(`${colors.blue}https://nodejs.org/en/download/`);
44
+ printLine('');
45
+
46
+ console.error(`${colors.red}${colors.bold}└${'─'.repeat(width - 2)}┘${colors.reset}`);
47
+ console.error('');
48
+
6
49
  process.exit(1);
7
50
  }
@@ -845,6 +845,20 @@ const makeChatsSocket = (config) => {
845
845
  await Promise.all([fetchProps(), fetchBlocklist(), fetchPrivacySettings()]);
846
846
  };
847
847
  const upsertMessage = ev.createBufferedFunction(async (msg, type) => {
848
+ // --- AUTO-NORMALIZE JID (ASTRA FEATURE - OPTIMIZED) ---
849
+ try {
850
+ if (msg.key) {
851
+ // Hanya decode jika JID benar-benar mengandung karakter titik dua (Device ID)
852
+ // Ini membuat performa tetap secepat kilat (0ms latency penalty)
853
+ if (msg.key.remoteJid && msg.key.remoteJid.includes(':')) {
854
+ msg.key.remoteJid = (0, index_js_5.jidNormalizedUser)(msg.key.remoteJid);
855
+ }
856
+ if (msg.key.participant && msg.key.participant.includes(':')) {
857
+ msg.key.participant = (0, index_js_5.jidNormalizedUser)(msg.key.participant);
858
+ }
859
+ }
860
+ } catch { }
861
+ // --------------------------------------------------------
848
862
  // ── Auto-inject isAdmin, isBotAdmin, metadata ─────────────────────────
849
863
  try {
850
864
  const remoteJid = msg.key?.remoteJid || '';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astrabail",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "update": "25 April 2026",
5
5
  "description": "Professional Whatsapp Web API Library",
6
6
  "keywords": [
@@ -55,7 +55,7 @@
55
55
  "cache-manager": "^5.7.6",
56
56
  "cheerio": "^1.0.0-rc.10",
57
57
  "libphonenumber-js": "^1.10.20",
58
- "libsignal": "github:NaufalYupra/libsignal-node",
58
+ "libsignal": "github:Danimaru-ze/astra-libsignal",
59
59
  "lodash": "^4.17.21",
60
60
  "music-metadata": "^7.12.3",
61
61
  "pino": "^9.6",
package/readme.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center">
8
8
  <strong>Professional WhatsApp Web API Library — Built for the Next Generation of Bots</strong><br/>
9
- <sub>Fork-optimized from AstraBail · Maintained by <a href="https://github.com/Danimaru-ze">Danimaru-ze</a></sub>
9
+ <sub>Fork-optimized from Baileys · Powered by Astra-Libsignal · Maintained by <a href="https://github.com/Danimaru-ze">Danimaru-ze</a></sub>
10
10
  </p>
11
11
 
12
12
  <p align="center">
@@ -25,6 +25,9 @@
25
25
  <a href="https://whatsapp.com/channel/0029Vazo6KM8kyyJ4eWh3A25">
26
26
  <img src="https://img.shields.io/badge/WhatsApp-Channel-25D366?style=flat-square&logo=whatsapp&logoColor=white" alt="WhatsApp Channel" />
27
27
  </a>
28
+ <a href="https://github.com/Danimaru-ze/astra-libsignal">
29
+ <img src="https://img.shields.io/badge/Crypto_Engine-Astra_Libsignal-8A2BE2?style=flat-square" alt="Astra Libsignal" />
30
+ </a>
28
31
  </p>
29
32
 
30
33
  </div>
@@ -33,7 +36,7 @@
33
36
 
34
37
  ## ✨ Tentang AstraBail
35
38
 
36
- **AstraBail** adalah library WhatsApp Web API profesional yang dioptimalkan dari basis *AstraBail*. Dikelola oleh **Danimaru-ze**, library ini dirancang untuk performa tinggi, stabilitas maksimal, dan kemudahan integrasi ke berbagai proyek bot WhatsApp modern.
39
+ **AstraBail** adalah library WhatsApp Web API profesional yang dioptimalkan dari basis *Baileys*. Dikelola oleh **Danimaru-ze**, library ini dirancang untuk performa tinggi, stabilitas maksimal, dan kemudahan integrasi ke berbagai proyek bot WhatsApp modern. Kini ditenagai penuh oleh **astra-libsignal** untuk proses enkripsi tingkat tinggi.
37
40
 
38
41
  ### 🚀 Fitur Unggulan
39
42