jagproject 26.3.17 → 26.3.18

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.
@@ -9,7 +9,7 @@ const libsignal_1 = require("../Signal/libsignal");
9
9
  const browser_utils_1 = require("../Utils/browser-utils");
10
10
  const logger_1 = __importDefault(require("../Utils/logger"));
11
11
  const waVer = require("./wileys-version.json");
12
- exports.version = waVer?.version || [2, 3000, 1035230389];
12
+ exports.version = waVer?.version || [2, 3000, 1035247988];
13
13
  exports.UNAUTHORIZED_CODES = [401, 403, 419];
14
14
  exports.DEFAULT_ORIGIN = 'https://web.whatsapp.com';
15
15
  exports.CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -1,29 +1,71 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
3
 
4
+ const URL = 'https://wppconnect.io/whatsapp-versions/'
5
+
4
6
  async function main() {
5
7
  try {
6
- const res = await fetch('https://wppconnect.io/whatsapp-versions/')
8
+ const res = await fetch(URL, {
9
+ headers: {
10
+ 'user-agent': 'Mozilla/5.0'
11
+ }
12
+ })
13
+
14
+ if (!res.ok) {
15
+ throw new Error(`HTTP ${res.status} ${res.statusText}`)
16
+ }
17
+
7
18
  const html = await res.text()
8
19
 
9
- const match = html.match(/Current Version[\s\S]{0,800}?\b(\d+\.\d+\.\d+(?:-[a-zA-Z0-9]+)?)\b/)
20
+ const match = html.match(/Current Version[\s\S]{0,1200}?\b(\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?)\b/i)
10
21
 
11
22
  if (!match) {
12
23
  console.log('Skip update WA Web version: versi tidak ditemukan')
13
24
  process.exit(0)
14
25
  }
15
26
 
16
- const raw = match[1]
17
- const numeric = raw.split('-')[0].split('.').map(n => Number(n))
27
+ const rawWithSuffix = match[1].trim()
28
+
29
+ // buang suffix seperti -alpha, -beta, dll
30
+ const cleanRaw = rawWithSuffix.split('-')[0].trim()
31
+
32
+ const version = cleanRaw.split('.').map(Number)
33
+
34
+ if (version.length !== 3 || version.some(Number.isNaN)) {
35
+ throw new Error(`Format versi tidak valid: ${cleanRaw}`)
36
+ }
18
37
 
19
- const output = {
20
- version: numeric,
21
- raw
38
+ // 1) update wileys-version.json
39
+ const jsonPath = path.join(__dirname, 'wileys-version.json')
40
+ const jsonData = {
41
+ version,
42
+ raw: cleanRaw
22
43
  }
44
+ fs.writeFileSync(jsonPath, JSON.stringify(jsonData, null, 2) + '\n', 'utf8')
45
+
46
+ // 2) update lib/Defaults/index.js
47
+ const indexPath = path.join(__dirname, 'index.js')
48
+ let indexContent = fs.readFileSync(indexPath, 'utf8')
49
+
50
+ const newVersionArray = `[${version.join(', ')}]`
51
+
52
+ const pattern = /exports\.version\s*=\s*waVer\?\.version\s*\|\|\s*\[[^\]]+\];?/
53
+
54
+ if (!pattern.test(indexContent)) {
55
+ throw new Error('Baris exports.version tidak ditemukan di lib/Defaults/index.js')
56
+ }
57
+
58
+ indexContent = indexContent.replace(
59
+ pattern,
60
+ `exports.version = waVer?.version || ${newVersionArray};`
61
+ )
62
+
63
+ fs.writeFileSync(indexPath, indexContent, 'utf8')
23
64
 
24
- const outFile = path.join(__dirname, 'wileys-version.json')
25
- fs.writeFileSync(outFile, JSON.stringify(output, null, 2))
26
- console.log('WA version updated:', output)
65
+ console.log('WA version updated:', {
66
+ version,
67
+ raw: cleanRaw
68
+ })
27
69
  } catch (err) {
28
70
  console.error('Gagal update WA version:', err.message)
29
71
  process.exit(1)
@@ -4,5 +4,5 @@
4
4
  3000,
5
5
  1035247988
6
6
  ],
7
- "raw": "2.3000.1035247988-alpha"
8
- }
7
+ "raw": "2.3000.1035247988"
8
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jagproject",
3
- "version": "26.03.17",
3
+ "version": "26.03.18",
4
4
  "update": "17 Maret 2026",
5
5
  "description": "WhatsApp Web API Library",
6
6
  "keywords": [