kage-baileys 25.0.4 → 25.0.5
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/lib/Defaults/index.js +22 -18
- package/lib/Socket/index.js +59 -62
- package/package.json +1 -1
package/lib/Defaults/index.js
CHANGED
|
@@ -29,15 +29,17 @@ exports.URL_REGEX = /https:\/\/(?![^:@\/\s]+:[^:@\/\s]+@)[a-zA-Z0-9.-]+\.[a-zA-Z
|
|
|
29
29
|
exports.WA_CERT_DETAILS = {
|
|
30
30
|
SERIAL: 0
|
|
31
31
|
};
|
|
32
|
-
exports.PROCESSABLE_HISTORY_TYPES =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
32
|
+
exports.PROCESSABLE_HISTORY_TYPES = (function() {
|
|
33
|
+
const p = require("../../WAProto").proto || {};
|
|
34
|
+
const H = (p.HistorySync && p.HistorySync.HistorySyncType) ||
|
|
35
|
+
(p.Message && p.Message.HistorySyncType) ||
|
|
36
|
+
(p.HistorySync && p.HistorySync.HistorySync && p.HistorySync.HistorySync.HistorySyncType) ||
|
|
37
|
+
{};
|
|
38
|
+
return [
|
|
39
|
+
H.INITIAL_BOOTSTRAP, H.PUSH_NAME, H.RECENT, H.FULL,
|
|
40
|
+
H.ON_DEMAND, H.NON_BLOCKING_DATA, H.INITIAL_STATUS_V3
|
|
41
|
+
].filter(v => v !== undefined);
|
|
42
|
+
})();
|
|
41
43
|
exports.DEFAULT_CONNECTION_CONFIG = {
|
|
42
44
|
version: exports.version,
|
|
43
45
|
browser: (0, browser_utils_1.Browsers)('Chrome'),
|
|
@@ -220,15 +222,17 @@ exports.WA_CERT_DETAILS = {
|
|
|
220
222
|
ISSUER: 'WhatsAppLongTerm1',
|
|
221
223
|
PUBLIC_KEY: Buffer.from('142375574d0a587166aae71ebe516437c4a28b73e3695c6ce1f7f9545da8ee6b', 'hex')
|
|
222
224
|
};
|
|
223
|
-
exports.PROCESSABLE_HISTORY_TYPES =
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
225
|
+
exports.PROCESSABLE_HISTORY_TYPES = (function() {
|
|
226
|
+
const p = require("../../WAProto").proto || {};
|
|
227
|
+
const H = (p.HistorySync && p.HistorySync.HistorySyncType) ||
|
|
228
|
+
(p.Message && p.Message.HistorySyncType) ||
|
|
229
|
+
(p.HistorySync && p.HistorySync.HistorySync && p.HistorySync.HistorySync.HistorySyncType) ||
|
|
230
|
+
{};
|
|
231
|
+
return [
|
|
232
|
+
H.INITIAL_BOOTSTRAP, H.PUSH_NAME, H.RECENT, H.FULL,
|
|
233
|
+
H.ON_DEMAND, H.NON_BLOCKING_DATA, H.INITIAL_STATUS_V3
|
|
234
|
+
].filter(v => v !== undefined);
|
|
235
|
+
})();
|
|
232
236
|
exports.DEFAULT_CACHE_TTLS = {
|
|
233
237
|
SIGNAL_STORE: 5 * 60,
|
|
234
238
|
MSG_RETRY: 60 * 60,
|
package/lib/Socket/index.js
CHANGED
|
@@ -1,84 +1,81 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
|
|
3
4
|
const Defaults_1 = require("../Defaults");
|
|
4
5
|
const business_1 = require("./communities");
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Clean makeWASocket – fixed:
|
|
9
|
+
* - Removed corrupted __kageModule wrappers
|
|
10
|
+
* - Fixed "Cannot add property MessageBuilder, object is not extensible"
|
|
11
|
+
* (bound functions are not extensible; we no longer try to attach .MessageBuilder to them)
|
|
12
|
+
*/
|
|
6
13
|
const makeWASocket = (config = {}) => {
|
|
7
14
|
try {
|
|
8
15
|
if (!(config && config.silentBanner)) {
|
|
9
16
|
require('../Utils/banner/startup-banner').printBanner({ silent: !!(config && config.silentBanner) });
|
|
10
17
|
}
|
|
11
18
|
} catch (_) {}
|
|
12
|
-
|
|
19
|
+
|
|
20
|
+
const finalConfig = {
|
|
13
21
|
...Defaults_1.DEFAULT_CONNECTION_CONFIG,
|
|
14
22
|
...config
|
|
15
|
-
});
|
|
16
|
-
require('../Extensions').installExtensions(socket, { ...Defaults_1.DEFAULT_CONNECTION_CONFIG, ...config });
|
|
17
|
-
require('../Utils/interactive-compat').installKageInteractiveTools(socket);
|
|
18
|
-
require('../Utils/profile-tools').installProfileTools(socket, config);
|
|
19
|
-
socket.messageBuilder = require('../Modded/message_builder').bind(socket);
|
|
20
|
-
socket.createMessageBuilder = () => new (require('../Utils/message-builder').MessageBuilder)(socket);
|
|
21
|
-
socket.messageBuilder.MessageBuilder = class extends require('../Utils/message-builder').MessageBuilder {
|
|
22
|
-
constructor() { super(socket); }
|
|
23
23
|
};
|
|
24
|
-
return require('../Utils/automation-tools').installKageTools(socket, config.kageTools || {});
|
|
25
|
-
};
|
|
26
|
-
exports.default = makeWASocket;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const __kageModule28 = (() => {
|
|
30
|
-
const module = { exports: {} }; const exports = module.exports;
|
|
31
|
-
"use strict"
|
|
32
24
|
|
|
33
|
-
|
|
25
|
+
// Default history sync behaviour if not provided
|
|
26
|
+
if (config.shouldSyncHistoryMessage === undefined) {
|
|
27
|
+
finalConfig.shouldSyncHistoryMessage = () => !!finalConfig.syncFullHistory;
|
|
28
|
+
}
|
|
34
29
|
|
|
35
|
-
const
|
|
36
|
-
const { makeCommunitiesSocket } = require("./community")
|
|
30
|
+
const socket = (0, business_1.makeCommunitiesSocket)(finalConfig);
|
|
37
31
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
...config
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (config.shouldSyncHistoryMessage === undefined) {
|
|
49
|
-
newConfig.shouldSyncHistoryMessage = () => !!newConfig.syncFullHistory
|
|
32
|
+
// Install Kage extensions safely
|
|
33
|
+
try {
|
|
34
|
+
require('../Extensions').installExtensions(socket, finalConfig);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
// non-fatal
|
|
50
37
|
}
|
|
51
38
|
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
try {
|
|
40
|
+
require('../Utils/interactive-compat').installKageInteractiveTools(socket);
|
|
41
|
+
} catch (_) {}
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
for (const key of Object.keys(__kageModule28)) {
|
|
59
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule28[key]});
|
|
60
|
-
}
|
|
43
|
+
try {
|
|
44
|
+
require('../Utils/profile-tools').installProfileTools(socket, config);
|
|
45
|
+
} catch (_) {}
|
|
61
46
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
47
|
+
// MessageBuilder helpers – do NOT try to add properties to a bound function
|
|
48
|
+
try {
|
|
49
|
+
const modded = require('../Modded/message_builder');
|
|
50
|
+
// Prefer a plain function reference; if it's already bound, just assign it
|
|
51
|
+
socket.messageBuilder = typeof modded === 'function' ? modded.bind(socket) : modded;
|
|
52
|
+
} catch (_) {
|
|
53
|
+
// fallback
|
|
54
|
+
try {
|
|
55
|
+
const { MessageBuilder } = require('../Utils/message-builder');
|
|
56
|
+
socket.messageBuilder = function (...args) {
|
|
57
|
+
return new MessageBuilder(socket, ...args);
|
|
58
|
+
};
|
|
59
|
+
} catch (_) {}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
const { MessageBuilder } = require('../Utils/message-builder');
|
|
64
|
+
socket.createMessageBuilder = () => new MessageBuilder(socket);
|
|
65
|
+
// Expose the class itself on the socket (safe)
|
|
66
|
+
socket.MessageBuilder = MessageBuilder;
|
|
67
|
+
} catch (_) {}
|
|
68
|
+
|
|
69
|
+
// Final Kage tools
|
|
70
|
+
try {
|
|
71
|
+
return require('../Utils/automation-tools').installKageTools(socket, config.kageTools || {});
|
|
72
|
+
} catch (_) {
|
|
73
|
+
return socket;
|
|
74
|
+
}
|
|
76
75
|
};
|
|
77
|
-
exports.default = makeWASocket;
|
|
78
76
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
Object.defineProperty(exports, Symbol.for('kage.advanced'), {value:__kageModule134, configurable:true});
|
|
77
|
+
exports.default = makeWASocket;
|
|
78
|
+
exports.makeWASocket = makeWASocket;
|
|
79
|
+
module.exports = makeWASocket;
|
|
80
|
+
module.exports.default = makeWASocket;
|
|
81
|
+
module.exports.makeWASocket = makeWASocket;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kage-baileys",
|
|
3
|
-
"version": "25.0.
|
|
3
|
+
"version": "25.0.5",
|
|
4
4
|
"description": "Kage Baileys completo — API WhatsApp Web con MessageBuilder extendido, Native Flows, review_and_pay, módulos proto, miniaturas base64/Buffer, rich UI, VoIP, canales, comunidades y más.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"kage-baileys",
|