kage-baileys 25.0.3 → 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/WAProto/index.js +44 -7
- package/lib/Defaults/history.js +27 -46
- package/lib/Defaults/index.js +22 -18
- package/lib/Socket/index.js +59 -62
- package/licenses/whiskeysockets-MIT.txt +21 -0
- package/package.json +1 -1
package/WAProto/index.js
CHANGED
|
@@ -1,10 +1,47 @@
|
|
|
1
1
|
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Fixed WAProto entrypoint for kage-baileys.
|
|
4
|
+
* Missing generated index.js + shape differences between the old monolithic
|
|
5
|
+
* WAProto and the new split protos under extras/WAProto.
|
|
6
|
+
*/
|
|
7
|
+
const raw = require('../extras/WAProto');
|
|
8
|
+
let proto = raw.proto || raw;
|
|
9
|
+
|
|
10
|
+
// ---------- Normalize namespaces so legacy Baileys code keeps working ----------
|
|
11
|
+
|
|
12
|
+
// 1. Message lives under E2E in the new protos
|
|
13
|
+
if (proto.E2E && proto.E2E.Message && !proto.Message) {
|
|
14
|
+
proto.Message = proto.E2E.Message;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// 2. HistorySyncType location differs
|
|
18
|
+
const histType =
|
|
19
|
+
(proto.HistorySync && proto.HistorySync.HistorySync && proto.HistorySync.HistorySync.HistorySyncType) ||
|
|
20
|
+
(proto.HistorySync && proto.HistorySync.HistorySyncType) ||
|
|
21
|
+
(proto.Message && proto.Message.HistorySyncNotification && proto.Message.HistorySyncNotification.HistorySyncType) ||
|
|
22
|
+
(proto.E2E && proto.E2E.Message && proto.E2E.Message.HistorySyncNotification && proto.E2E.Message.HistorySyncNotification.HistorySyncType);
|
|
23
|
+
|
|
24
|
+
if (histType) {
|
|
25
|
+
if (proto.HistorySync && !proto.HistorySync.HistorySyncType) {
|
|
26
|
+
proto.HistorySync.HistorySyncType = histType;
|
|
27
|
+
}
|
|
28
|
+
if (proto.Message && !proto.Message.HistorySyncType) {
|
|
29
|
+
proto.Message.HistorySyncType = histType;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// 3. Common other aliases that appear in Baileys code
|
|
34
|
+
if (proto.E2E) {
|
|
35
|
+
// Some code does proto.WebMessageInfo etc.
|
|
36
|
+
if (proto.E2E.WebMessageInfo && !proto.WebMessageInfo) {
|
|
37
|
+
proto.WebMessageInfo = proto.E2E.WebMessageInfo;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Apply original field-name compatibility patches
|
|
42
|
+
try {
|
|
43
|
+
require('./compat.cjs')(proto);
|
|
44
|
+
} catch (_) {}
|
|
45
|
+
|
|
7
46
|
module.exports = { proto };
|
|
8
|
-
// also re-export everything for __exportStar compatibility
|
|
9
47
|
module.exports.proto = proto;
|
|
10
|
-
Object.assign(module.exports, { proto });
|
package/lib/Defaults/history.js
CHANGED
|
@@ -1,46 +1,27 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
-
|
|
5
|
-
const { proto } = require("../../WAProto")
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const PROCESSABLE_HISTORY_TYPES = [
|
|
30
|
-
proto.Message.HistorySyncType.INITIAL_BOOTSTRAP,
|
|
31
|
-
proto.Message.HistorySyncType.PUSH_NAME,
|
|
32
|
-
proto.Message.HistorySyncType.RECENT,
|
|
33
|
-
proto.Message.HistorySyncType.FULL,
|
|
34
|
-
proto.Message.HistorySyncType.ON_DEMAND,
|
|
35
|
-
proto.HistorySync.HistorySyncType.NON_BLOCKING_DATA,
|
|
36
|
-
proto.HistorySync.HistorySyncType.INITIAL_STATUS_V3
|
|
37
|
-
]
|
|
38
|
-
|
|
39
|
-
module.exports = {
|
|
40
|
-
PROCESSABLE_HISTORY_TYPES
|
|
41
|
-
}
|
|
42
|
-
return module.exports;
|
|
43
|
-
})();
|
|
44
|
-
for (const key of Object.keys(__kageModule3)) {
|
|
45
|
-
if (key !== '__esModule' && !Object.prototype.hasOwnProperty.call(exports,key)) Object.defineProperty(exports,key,{enumerable:true,configurable:true,get:()=>__kageModule3[key]});
|
|
46
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
|
|
5
|
+
const { proto } = require("../../WAProto");
|
|
6
|
+
|
|
7
|
+
// Safe access – works with both old single-file and new split protos
|
|
8
|
+
const HistorySyncType =
|
|
9
|
+
(proto.Message && proto.Message.HistorySyncType) ||
|
|
10
|
+
(proto.HistorySync && proto.HistorySync.HistorySyncType) ||
|
|
11
|
+
(proto.HistorySync && proto.HistorySync.HistorySync && proto.HistorySync.HistorySync.HistorySyncType) ||
|
|
12
|
+
(proto.Message && proto.Message.HistorySyncNotification && proto.Message.HistorySyncNotification.HistorySyncType) ||
|
|
13
|
+
{};
|
|
14
|
+
|
|
15
|
+
const PROCESSABLE_HISTORY_TYPES = [
|
|
16
|
+
HistorySyncType.INITIAL_BOOTSTRAP,
|
|
17
|
+
HistorySyncType.PUSH_NAME,
|
|
18
|
+
HistorySyncType.RECENT,
|
|
19
|
+
HistorySyncType.FULL,
|
|
20
|
+
HistorySyncType.ON_DEMAND,
|
|
21
|
+
HistorySyncType.NON_BLOCKING_DATA,
|
|
22
|
+
HistorySyncType.INITIAL_STATUS_V3
|
|
23
|
+
].filter(v => v !== undefined);
|
|
24
|
+
|
|
25
|
+
module.exports = {
|
|
26
|
+
PROCESSABLE_HISTORY_TYPES
|
|
27
|
+
};
|
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;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rajeh Taher/WhiskeySockets
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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",
|