@charape/baileys 1.0.7 → 1.0.8

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.
@@ -2,7 +2,7 @@ import { proto } from '../../WAProto/index.js';
2
2
  import { makeLibSignalRepository } from '../Signal/libsignal.js';
3
3
  import { Browsers } from '../Utils/browser-utils.js';
4
4
  import logger from '../Utils/logger.js';
5
- const version = [2, 3000, 1043857760];
5
+ const version = [2, 3000, 1054303363];
6
6
  export const UNAUTHORIZED_CODES = [401, 403, 419];
7
7
  export const DEFAULT_ORIGIN = 'https://web.whatsapp.com';
8
8
  export const CALL_VIDEO_PREFIX = 'https://call.whatsapp.com/video/';
@@ -1,7 +1,7 @@
1
1
  import { Boom } from '@hapi/boom';
2
2
  import { createHash, randomBytes } from 'crypto';
3
3
  import { proto } from '../../WAProto/index.js';
4
- const baileysVersion = [2, 3000, 1035194821];
4
+ const baileysVersion = [2, 3000, 1054303363];
5
5
  import { DisconnectReason } from '../Types/index.js';
6
6
  import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
7
7
  import { sha256 } from './crypto.js';
@@ -187,6 +187,13 @@ export const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, 'connect
187
187
  * Use to ensure your WA connection is always on the latest version
188
188
  */
189
189
  export const fetchLatestBaileysVersion = async (options = {}) => {
190
+ try {
191
+ const waWeb = await fetchLatestWaWebVersion(options);
192
+ if (waWeb && waWeb.isLatest && Array.isArray(waWeb.version)) {
193
+ return waWeb;
194
+ }
195
+ } catch {}
196
+
190
197
  const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts';
191
198
  try {
192
199
  const response = await fetch(URL, {
@@ -198,10 +205,9 @@ export const fetchLatestBaileysVersion = async (options = {}) => {
198
205
  throw new Boom(`Failed to fetch latest Baileys version: ${response.statusText}`, { statusCode: response.status });
199
206
  }
200
207
  const text = await response.text();
201
- // Extract version from line 7 (const version = [...])
202
208
  const lines = text.split('\n');
203
- const versionLine = lines[6]; // Line 7 (0-indexed)
204
- const versionMatch = versionLine.match(/const version = \[(\d+),\s*(\d+),\s*(\d+)\]/);
209
+ const versionLine = lines.find(l => l.includes('const version = ['));
210
+ const versionMatch = versionLine ? versionLine.match(/const version = \[(\d+),\s*(\d+),\s*(\d+)\]/) : null;
205
211
  if (versionMatch) {
206
212
  const version = [parseInt(versionMatch[1]), parseInt(versionMatch[2]), parseInt(versionMatch[3])];
207
213
  return {
package/lib/index.cjs CHANGED
@@ -153116,7 +153116,7 @@ async function derivePairingCodeKey(pairingCode, salt) {
153116
153116
  }
153117
153117
 
153118
153118
  // lib/Utils/generics.js
153119
- var baileysVersion = [2, 3e3, 1035194821];
153119
+ var baileysVersion = [2, 3e3, 1054303363];
153120
153120
  var BufferJSON = {
153121
153121
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
153122
153122
  replacer: (k, value) => {
@@ -153288,6 +153288,13 @@ var generateAndroMessageID = () => {
153288
153288
  };
153289
153289
  var bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, "connection.update");
153290
153290
  var fetchLatestBaileysVersion = async (options = {}) => {
153291
+ try {
153292
+ const waWeb = await fetchLatestWaWebVersion(options);
153293
+ if (waWeb && waWeb.isLatest && Array.isArray(waWeb.version)) {
153294
+ return waWeb;
153295
+ }
153296
+ } catch {
153297
+ }
153291
153298
  const URL4 = "https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts";
153292
153299
  try {
153293
153300
  const response = await fetch(URL4, {
@@ -153300,8 +153307,8 @@ var fetchLatestBaileysVersion = async (options = {}) => {
153300
153307
  }
153301
153308
  const text = await response.text();
153302
153309
  const lines = text.split("\n");
153303
- const versionLine = lines[6];
153304
- const versionMatch = versionLine.match(/const version = \[(\d+),\s*(\d+),\s*(\d+)\]/);
153310
+ const versionLine = lines.find((l) => l.includes("const version = ["));
153311
+ const versionMatch = versionLine ? versionLine.match(/const version = \[(\d+),\s*(\d+),\s*(\d+)\]/) : null;
153305
153312
  if (versionMatch) {
153306
153313
  const version2 = [parseInt(versionMatch[1]), parseInt(versionMatch[2]), parseInt(versionMatch[3])];
153307
153314
  return {
@@ -165182,7 +165189,7 @@ var import_pino = __toESM(require("pino"), 1);
165182
165189
  var logger_default = (0, import_pino.default)({ timestamp: () => `,"time":"${(/* @__PURE__ */ new Date()).toJSON()}"` });
165183
165190
 
165184
165191
  // lib/Defaults/index.js
165185
- var version = [2, 3e3, 1043857760];
165192
+ var version = [2, 3e3, 1054303363];
165186
165193
  var UNAUTHORIZED_CODES = [401, 403, 419];
165187
165194
  var DEFAULT_ORIGIN = "https://web.whatsapp.com";
165188
165195
  var CALL_VIDEO_PREFIX = "https://call.whatsapp.com/video/";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@charape/baileys",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Enterprise-grade WhatsApp Web Baileys library and multi-bot runner supervisor with session crash guard.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.cjs",