@crysnovax/baileys 2.5.6 → 2.6.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.
- package/README.md +11 -0
- package/README.md[old] +1612 -0
- package/WAProto/index.js +14789 -3578
- package/lib/Defaults/index.js +14 -7
- package/lib/Signal/libsignal.js +40 -18
- package/lib/Socket/business.js +2 -1
- package/lib/Socket/chats.js +266 -92
- package/lib/Socket/chats.js[past] +1213 -0
- package/lib/Socket/communities.js +2 -1
- package/lib/Socket/groups.js +24 -5
- package/lib/Socket/messages-recv.js +617 -322
- package/lib/Socket/messages-send.js +160 -61
- package/lib/Socket/newsletter.js +4 -4
- package/lib/Socket/socket.js +49 -20
- package/lib/Types/{Newsletter.js → Mex.js} +10 -4
- package/lib/Types/State.js +37 -1
- package/lib/Types/index.js +1 -1
- package/lib/Utils/auth-utils.js +13 -1
- package/lib/Utils/chat-utils.js +81 -21
- package/lib/Utils/decode-wa-message.js +35 -1
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/messages-media.js +28 -16
- package/lib/Utils/messages-media.js[past] +842 -0
- package/lib/Utils/messages.js +325 -352
- package/lib/Utils/signal.js +43 -1
- package/lib/Utils/tc-token-utils.js +150 -5
- package/lib/Utils/use-sqlite-auth-state.js +108 -0
- package/lib/WABinary/constants.js +91 -0
- package/package.json +45 -10
package/lib/Utils/signal.js
CHANGED
|
@@ -55,6 +55,48 @@ export const xmppPreKey = (pair, id) => ({
|
|
|
55
55
|
{ tag: 'value', attrs: {}, content: pair.public }
|
|
56
56
|
]
|
|
57
57
|
});
|
|
58
|
+
const isValidUInt = (n) => typeof n === 'number' && Number.isInteger(n);
|
|
59
|
+
export const extractE2ESessionFromRetryReceipt = (receipt) => {
|
|
60
|
+
const keysNode = getBinaryNodeChild(receipt, 'keys');
|
|
61
|
+
if (!keysNode)
|
|
62
|
+
return null;
|
|
63
|
+
const typeBuf = getBinaryNodeChildBuffer(keysNode, 'type');
|
|
64
|
+
if (!typeBuf || typeBuf.length !== 1 || typeBuf[0] !== KEY_BUNDLE_TYPE[0])
|
|
65
|
+
return null;
|
|
66
|
+
const identity = getBinaryNodeChildBuffer(keysNode, 'identity');
|
|
67
|
+
const skey = getBinaryNodeChild(keysNode, 'skey');
|
|
68
|
+
if (!identity || identity.length !== 32 || !skey)
|
|
69
|
+
return null;
|
|
70
|
+
const registrationId = getBinaryNodeChildUInt(receipt, 'registration', 4);
|
|
71
|
+
if (!isValidUInt(registrationId))
|
|
72
|
+
return null;
|
|
73
|
+
const signedPubKey = getBinaryNodeChildBuffer(skey, 'value');
|
|
74
|
+
const signedSig = getBinaryNodeChildBuffer(skey, 'signature');
|
|
75
|
+
const signedKeyId = getBinaryNodeChildUInt(skey, 'id', 3);
|
|
76
|
+
if (!signedPubKey || signedPubKey.length !== 32 || !signedSig || !isValidUInt(signedKeyId)) {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
const preKeyNode = getBinaryNodeChild(keysNode, 'key');
|
|
80
|
+
let preKey;
|
|
81
|
+
if (preKeyNode) {
|
|
82
|
+
const preKeyPub = getBinaryNodeChildBuffer(preKeyNode, 'value');
|
|
83
|
+
const preKeyId = getBinaryNodeChildUInt(preKeyNode, 'id', 3);
|
|
84
|
+
if (!preKeyPub || preKeyPub.length !== 32 || !isValidUInt(preKeyId)) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
preKey = { keyId: preKeyId, publicKey: generateSignalPubKey(preKeyPub) };
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
registrationId,
|
|
91
|
+
identityKey: generateSignalPubKey(identity),
|
|
92
|
+
signedPreKey: {
|
|
93
|
+
keyId: signedKeyId,
|
|
94
|
+
publicKey: generateSignalPubKey(signedPubKey),
|
|
95
|
+
signature: signedSig
|
|
96
|
+
},
|
|
97
|
+
preKey
|
|
98
|
+
};
|
|
99
|
+
};
|
|
58
100
|
export const parseAndInjectE2ESessions = async (node, repository) => {
|
|
59
101
|
const extractKey = (key) => key
|
|
60
102
|
? {
|
|
@@ -155,4 +197,4 @@ export const getNextPreKeysNode = async (state, count) => {
|
|
|
155
197
|
]
|
|
156
198
|
};
|
|
157
199
|
return { update, node };
|
|
158
|
-
};
|
|
200
|
+
};
|
|
@@ -1,9 +1,119 @@
|
|
|
1
|
-
|
|
1
|
+
import { getBinaryNodeChild, getBinaryNodeChildren, isHostedLidUser, isHostedPnUser, isJidMetaAI, isLidUser, isPnUser, jidNormalizedUser } from '../WABinary/index.js';
|
|
2
|
+
// Same phone-number pattern as WABinary's isJidBot, applied against the user
|
|
3
|
+
// part so the check is invariant to @c.us ↔ @s.whatsapp.net normalization.
|
|
4
|
+
const BOT_PHONE_REGEX = /^1313555\d{4}$|^131655500\d{2}$/;
|
|
5
|
+
/**
|
|
6
|
+
* Mirrors WA Web's `Wid.isRegularUser()` (user ∧ ¬PSA ∧ ¬Bot). Used to gate tctoken
|
|
7
|
+
* storage against malformed notifications — WA Web filters server-side but we
|
|
8
|
+
* defend here for parity with `WAWebSetTcTokenChatAction.handleIncomingTcToken`.
|
|
9
|
+
* Works for both pre- and post-normalized JIDs (`@c.us` vs `@s.whatsapp.net`).
|
|
10
|
+
*/
|
|
11
|
+
function isRegularUser(jid) {
|
|
12
|
+
if (!jid)
|
|
13
|
+
return false;
|
|
14
|
+
const user = jid.split('@')[0] ?? '';
|
|
15
|
+
if (user === '0')
|
|
16
|
+
return false; // PSA
|
|
17
|
+
if (BOT_PHONE_REGEX.test(user))
|
|
18
|
+
return false; // Bot by phone pattern
|
|
19
|
+
if (isJidMetaAI(jid))
|
|
20
|
+
return false; // MetaAI (@bot server)
|
|
21
|
+
return !!(isPnUser(jid) || isLidUser(jid) || isHostedPnUser(jid) || isHostedLidUser(jid) || jid.endsWith('@c.us'));
|
|
22
|
+
}
|
|
23
|
+
const TC_TOKEN_BUCKET_DURATION = 604800; // 7 days
|
|
24
|
+
const TC_TOKEN_NUM_BUCKETS = 4; // ~28-day rolling window
|
|
25
|
+
/** Sentinel key under `tctoken` store holding a JSON array of tracked storage JIDs for cross-session pruning. */
|
|
26
|
+
export const TC_TOKEN_INDEX_KEY = '__index';
|
|
27
|
+
/** Read the persisted tctoken JID index and return its entries (never contains the sentinel key itself). */
|
|
28
|
+
export async function readTcTokenIndex(keys) {
|
|
29
|
+
const data = await keys.get('tctoken', [TC_TOKEN_INDEX_KEY]);
|
|
30
|
+
const entry = data[TC_TOKEN_INDEX_KEY];
|
|
31
|
+
if (!entry?.token?.length)
|
|
32
|
+
return [];
|
|
2
33
|
try {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
34
|
+
const parsed = JSON.parse(Buffer.from(entry.token).toString());
|
|
35
|
+
if (!Array.isArray(parsed))
|
|
36
|
+
return [];
|
|
37
|
+
return parsed.filter((j) => typeof j === 'string' && j.length > 0 && j !== TC_TOKEN_INDEX_KEY);
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/** Build a SignalDataSet fragment that writes the merged index (persisted ∪ added) under the sentinel key. */
|
|
44
|
+
export async function buildMergedTcTokenIndexWrite(keys, addedJids) {
|
|
45
|
+
const persisted = await readTcTokenIndex(keys);
|
|
46
|
+
const merged = new Set(persisted);
|
|
47
|
+
for (const jid of addedJids) {
|
|
48
|
+
if (jid && jid !== TC_TOKEN_INDEX_KEY)
|
|
49
|
+
merged.add(jid);
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
[TC_TOKEN_INDEX_KEY]: { token: Buffer.from(JSON.stringify([...merged])) }
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// WA Web has separate sender/receiver AB props for these but they're identical today
|
|
56
|
+
export function isTcTokenExpired(timestamp) {
|
|
57
|
+
if (timestamp === null || timestamp === undefined)
|
|
58
|
+
return true;
|
|
59
|
+
const ts = typeof timestamp === 'string' ? parseInt(timestamp) : timestamp;
|
|
60
|
+
if (isNaN(ts))
|
|
61
|
+
return true;
|
|
62
|
+
const now = Math.floor(Date.now() / 1000);
|
|
63
|
+
const currentBucket = Math.floor(now / TC_TOKEN_BUCKET_DURATION);
|
|
64
|
+
const cutoffBucket = currentBucket - (TC_TOKEN_NUM_BUCKETS - 1);
|
|
65
|
+
const cutoffTimestamp = cutoffBucket * TC_TOKEN_BUCKET_DURATION;
|
|
66
|
+
return ts < cutoffTimestamp;
|
|
67
|
+
}
|
|
68
|
+
export function shouldSendNewTcToken(senderTimestamp) {
|
|
69
|
+
if (senderTimestamp === undefined)
|
|
70
|
+
return true;
|
|
71
|
+
const now = Math.floor(Date.now() / 1000);
|
|
72
|
+
const currentBucket = Math.floor(now / TC_TOKEN_BUCKET_DURATION);
|
|
73
|
+
const senderBucket = Math.floor(senderTimestamp / TC_TOKEN_BUCKET_DURATION);
|
|
74
|
+
return currentBucket > senderBucket;
|
|
75
|
+
}
|
|
76
|
+
/** Resolve JID to LID for tctoken storage (WA Web stores under LID) */
|
|
77
|
+
export async function resolveTcTokenJid(jid, getLIDForPN) {
|
|
78
|
+
if (isLidUser(jid))
|
|
79
|
+
return jid;
|
|
80
|
+
const lid = await getLIDForPN(jid);
|
|
81
|
+
return lid ?? jid;
|
|
82
|
+
}
|
|
83
|
+
/** Resolve target JID for issuing privacy token based on AB prop 14303 */
|
|
84
|
+
export async function resolveIssuanceJid(jid, issueToLid, getLIDForPN, getPNForLID) {
|
|
85
|
+
if (issueToLid) {
|
|
86
|
+
if (isLidUser(jid))
|
|
87
|
+
return jid;
|
|
88
|
+
const lid = await getLIDForPN(jid);
|
|
89
|
+
return lid ?? jid;
|
|
90
|
+
}
|
|
91
|
+
if (!isLidUser(jid))
|
|
92
|
+
return jid;
|
|
93
|
+
if (getPNForLID) {
|
|
94
|
+
const pn = await getPNForLID(jid);
|
|
95
|
+
return pn ?? jid;
|
|
96
|
+
}
|
|
97
|
+
return jid;
|
|
98
|
+
}
|
|
99
|
+
export async function buildTcTokenFromJid({ authState, jid, baseContent = [], getLIDForPN }) {
|
|
100
|
+
try {
|
|
101
|
+
const storageJid = await resolveTcTokenJid(jid, getLIDForPN);
|
|
102
|
+
const tcTokenData = await authState.keys.get('tctoken', [storageJid]);
|
|
103
|
+
const entry = tcTokenData?.[storageJid];
|
|
104
|
+
const tcTokenBuffer = entry?.token;
|
|
105
|
+
if (!tcTokenBuffer?.length || isTcTokenExpired(entry?.timestamp)) {
|
|
106
|
+
if (tcTokenBuffer) {
|
|
107
|
+
// Preserve senderTimestamp so shouldSendNewTcToken() keeps its dedupe state
|
|
108
|
+
// after we drop the unusable peer token. Only wipe the record entirely when
|
|
109
|
+
// there's nothing worth keeping.
|
|
110
|
+
const cleared = entry?.senderTimestamp !== undefined
|
|
111
|
+
? { token: Buffer.alloc(0), senderTimestamp: entry.senderTimestamp }
|
|
112
|
+
: null;
|
|
113
|
+
await authState.keys.set({ tctoken: { [storageJid]: cleared } });
|
|
114
|
+
}
|
|
6
115
|
return baseContent.length > 0 ? baseContent : undefined;
|
|
116
|
+
}
|
|
7
117
|
baseContent.push({
|
|
8
118
|
tag: 'tctoken',
|
|
9
119
|
attrs: {},
|
|
@@ -14,4 +124,39 @@ export async function buildTcTokenFromJid({ authState, jid, baseContent = [] })
|
|
|
14
124
|
catch (error) {
|
|
15
125
|
return baseContent.length > 0 ? baseContent : undefined;
|
|
16
126
|
}
|
|
17
|
-
}
|
|
127
|
+
}
|
|
128
|
+
export async function storeTcTokensFromIqResult({ result, fallbackJid, keys, getLIDForPN, onNewJidStored }) {
|
|
129
|
+
const tokensNode = getBinaryNodeChild(result, 'tokens');
|
|
130
|
+
if (!tokensNode)
|
|
131
|
+
return;
|
|
132
|
+
const tokenNodes = getBinaryNodeChildren(tokensNode, 'token');
|
|
133
|
+
for (const tokenNode of tokenNodes) {
|
|
134
|
+
if (tokenNode.attrs.type !== 'trusted_contact' || !(tokenNode.content instanceof Uint8Array)) {
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
// In notifications tokenNode.attrs.jid is your own device JID, not the sender's
|
|
138
|
+
const rawJid = jidNormalizedUser(fallbackJid || tokenNode.attrs.jid);
|
|
139
|
+
if (!isRegularUser(rawJid))
|
|
140
|
+
continue;
|
|
141
|
+
const storageJid = await resolveTcTokenJid(rawJid, getLIDForPN);
|
|
142
|
+
const existingTcData = await keys.get('tctoken', [storageJid]);
|
|
143
|
+
const existingEntry = existingTcData[storageJid];
|
|
144
|
+
const existingTs = existingEntry?.timestamp ? Number(existingEntry.timestamp) : 0;
|
|
145
|
+
const incomingTs = tokenNode.attrs.t ? Number(tokenNode.attrs.t) : 0;
|
|
146
|
+
// timestamp-less tokens would be immediately expired
|
|
147
|
+
if (!incomingTs)
|
|
148
|
+
continue;
|
|
149
|
+
if (existingTs > 0 && existingTs > incomingTs)
|
|
150
|
+
continue;
|
|
151
|
+
await keys.set({
|
|
152
|
+
tctoken: {
|
|
153
|
+
[storageJid]: {
|
|
154
|
+
...existingEntry,
|
|
155
|
+
token: Buffer.from(tokenNode.content),
|
|
156
|
+
timestamp: tokenNode.attrs.t
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
onNewJidStored?.(storageJid);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { mkdir, readFile, stat, unlink, writeFile } from 'fs/promises';
|
|
2
|
+
import { join } from 'path';
|
|
3
|
+
import { proto } from '../../WAProto/index.js';
|
|
4
|
+
import { initAuthCreds } from './auth-utils.js';
|
|
5
|
+
import { BufferJSON } from './generics.js';
|
|
6
|
+
async function loadBetterSqlite3() {
|
|
7
|
+
try {
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
const mod = (await import('better-sqlite3'));
|
|
10
|
+
return mod.default ?? mod;
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
const helpful = new Error('`better-sqlite3` is required for `useSqliteAuthState`. Install it as a peer dependency: `npm install better-sqlite3` (or `yarn add better-sqlite3`).');
|
|
14
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
|
+
helpful.cause = err;
|
|
16
|
+
throw helpful;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const CREDS_ROW_KEY = '__creds__';
|
|
20
|
+
const CREATE_SCHEMA_SQL = `
|
|
21
|
+
CREATE TABLE IF NOT EXISTS creds (
|
|
22
|
+
key TEXT PRIMARY KEY,
|
|
23
|
+
value TEXT NOT NULL
|
|
24
|
+
);
|
|
25
|
+
CREATE TABLE IF NOT EXISTS signal_keys (
|
|
26
|
+
type TEXT NOT NULL,
|
|
27
|
+
id TEXT NOT NULL,
|
|
28
|
+
value TEXT NOT NULL,
|
|
29
|
+
PRIMARY KEY (type, id)
|
|
30
|
+
);
|
|
31
|
+
CREATE INDEX IF NOT EXISTS signal_keys_type_idx ON signal_keys(type);
|
|
32
|
+
`;
|
|
33
|
+
export async function useSqliteAuthState(opts) {
|
|
34
|
+
let db;
|
|
35
|
+
if (opts.database) {
|
|
36
|
+
db = opts.database;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const Database = await loadBetterSqlite3();
|
|
40
|
+
db = new Database(opts.dbPath);
|
|
41
|
+
}
|
|
42
|
+
// WAL mode allows concurrent reads alongside a single writer; matches
|
|
43
|
+
// what SQLite recommends for read-heavy workloads with sporadic writes.
|
|
44
|
+
db.pragma('journal_mode = WAL');
|
|
45
|
+
db.pragma('synchronous = NORMAL');
|
|
46
|
+
db.exec(CREATE_SCHEMA_SQL);
|
|
47
|
+
const stmts = {
|
|
48
|
+
credsSelect: db.prepare('SELECT value FROM creds WHERE key = ?'),
|
|
49
|
+
credsUpsert: db.prepare('INSERT INTO creds (key, value) VALUES (?, ?) ON CONFLICT(key) DO UPDATE SET value = excluded.value'),
|
|
50
|
+
keySelect: db.prepare('SELECT value FROM signal_keys WHERE type = ? AND id = ?'),
|
|
51
|
+
keyUpsert: db.prepare('INSERT INTO signal_keys (type, id, value) VALUES (?, ?, ?) ON CONFLICT(type, id) DO UPDATE SET value = excluded.value'),
|
|
52
|
+
keyDelete: db.prepare('DELETE FROM signal_keys WHERE type = ? AND id = ?'),
|
|
53
|
+
keyListIds: db.prepare('SELECT id FROM signal_keys WHERE type = ?'),
|
|
54
|
+
keyList: db.prepare('SELECT id, value FROM signal_keys WHERE type = ?'),
|
|
55
|
+
clearKeys: db.prepare('DELETE FROM signal_keys')
|
|
56
|
+
};
|
|
57
|
+
const loadCreds = () => {
|
|
58
|
+
const row = stmts.credsSelect.get(CREDS_ROW_KEY);
|
|
59
|
+
if (!row)
|
|
60
|
+
return initAuthCreds();
|
|
61
|
+
return JSON.parse(row.value, BufferJSON.reviver);
|
|
62
|
+
};
|
|
63
|
+
const persistCreds = (creds) => {
|
|
64
|
+
stmts.credsUpsert.run(CREDS_ROW_KEY, JSON.stringify(creds, BufferJSON.replacer));
|
|
65
|
+
};
|
|
66
|
+
const creds = loadCreds();
|
|
67
|
+
return {
|
|
68
|
+
state: {
|
|
69
|
+
creds,
|
|
70
|
+
keys: {
|
|
71
|
+
get: async (type, ids) => {
|
|
72
|
+
const data = {};
|
|
73
|
+
for (const id of ids) {
|
|
74
|
+
const row = stmts.keySelect.get(type, id);
|
|
75
|
+
if (row) {
|
|
76
|
+
let value = JSON.parse(row.value, BufferJSON.reviver);
|
|
77
|
+
if (type === 'app-state-sync-key' && value) {
|
|
78
|
+
value = proto.Message.AppStateSyncKeyData.fromObject(value);
|
|
79
|
+
}
|
|
80
|
+
data[id] = value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return data;
|
|
84
|
+
},
|
|
85
|
+
set: async (data) => {
|
|
86
|
+
const writeTx = db.transaction(() => {
|
|
87
|
+
for (const category in data) {
|
|
88
|
+
for (const id in data[category]) {
|
|
89
|
+
const value = data[category][id];
|
|
90
|
+
if (value) {
|
|
91
|
+
const stringified = JSON.stringify(value, BufferJSON.replacer);
|
|
92
|
+
stmts.keyUpsert.run(category, id, stringified);
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
stmts.keyDelete.run(category, id);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
writeTx();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
saveCreds: async () => {
|
|
105
|
+
persistCreds(creds);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
}
|
|
@@ -1354,6 +1354,86 @@ export const RUST_KEYWORDS = new Set([
|
|
|
1354
1354
|
'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final',
|
|
1355
1355
|
'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield'
|
|
1356
1356
|
]);
|
|
1357
|
+
export const C_KEYWORDS = new Set([
|
|
1358
|
+
'auto', 'break', 'case', 'char', 'const', 'continue',
|
|
1359
|
+
'default', 'do', 'double', 'else', 'enum', 'extern',
|
|
1360
|
+
'float', 'for', 'goto', 'if', 'inline', 'int',
|
|
1361
|
+
'long', 'register', 'restrict', 'return', 'short',
|
|
1362
|
+
'signed', 'sizeof', 'static', 'struct', 'switch',
|
|
1363
|
+
'typedef', 'union', 'unsigned', 'void', 'volatile',
|
|
1364
|
+
'while',
|
|
1365
|
+
'_Alignas', '_Alignof', '_Atomic', '_Bool',
|
|
1366
|
+
'_Complex', '_Generic', '_Imaginary',
|
|
1367
|
+
'_Noreturn', '_Static_assert', '_Thread_local'
|
|
1368
|
+
]);
|
|
1369
|
+
export const CSHARP_KEYWORDS = new Set([
|
|
1370
|
+
'abstract', 'as', 'base', 'bool', 'break', 'byte',
|
|
1371
|
+
'case', 'catch', 'char', 'checked', 'class',
|
|
1372
|
+
'const', 'continue', 'decimal', 'default',
|
|
1373
|
+
'delegate', 'do', 'double', 'else', 'enum',
|
|
1374
|
+
'event', 'explicit', 'extern', 'false', 'finally',
|
|
1375
|
+
'fixed', 'float', 'for', 'foreach', 'goto',
|
|
1376
|
+
'if', 'implicit', 'in', 'int', 'interface',
|
|
1377
|
+
'internal', 'is', 'lock', 'long', 'namespace',
|
|
1378
|
+
'new', 'null', 'object', 'operator', 'out',
|
|
1379
|
+
'override', 'params', 'private', 'protected',
|
|
1380
|
+
'public', 'readonly', 'ref', 'return', 'sbyte',
|
|
1381
|
+
'sealed', 'short', 'sizeof', 'stackalloc',
|
|
1382
|
+
'static', 'string', 'struct', 'switch',
|
|
1383
|
+
'this', 'throw', 'true', 'try', 'typeof',
|
|
1384
|
+
'uint', 'ulong', 'unchecked', 'unsafe',
|
|
1385
|
+
'ushort', 'using', 'virtual', 'void',
|
|
1386
|
+
'volatile', 'while',
|
|
1387
|
+
'async', 'await', 'record', 'init',
|
|
1388
|
+
'required', 'file', 'global', 'nameof',
|
|
1389
|
+
'var', 'dynamic', 'partial', 'yield',
|
|
1390
|
+
'from', 'where', 'select', 'group',
|
|
1391
|
+
'orderby', 'join', 'let', 'into',
|
|
1392
|
+
'equals', 'by', 'ascending', 'descending'
|
|
1393
|
+
]);
|
|
1394
|
+
export const BASH_KEYWORDS = new Set([
|
|
1395
|
+
'if', 'then', 'else', 'elif', 'fi',
|
|
1396
|
+
'case', 'esac', 'for', 'while',
|
|
1397
|
+
'until', 'do', 'done', 'in',
|
|
1398
|
+
'function', 'select', 'time',
|
|
1399
|
+
'coproc',
|
|
1400
|
+
'echo', 'printf', 'read', 'cd',
|
|
1401
|
+
'pwd', 'exit', 'export', 'unset',
|
|
1402
|
+
'alias', 'unalias', 'source',
|
|
1403
|
+
'exec', 'eval', 'test', 'shift',
|
|
1404
|
+
'trap', 'wait', 'jobs', 'kill',
|
|
1405
|
+
'bg', 'fg', 'history', 'type',
|
|
1406
|
+
'ulimit', 'umask', 'set',
|
|
1407
|
+
'true', 'false'
|
|
1408
|
+
]);
|
|
1409
|
+
export const CMD_KEYWORDS = new Set([
|
|
1410
|
+
'echo', 'set', 'if', 'else',
|
|
1411
|
+
'for', 'in', 'do', 'goto',
|
|
1412
|
+
'call', 'exit', 'shift',
|
|
1413
|
+
'pause', 'start', 'title',
|
|
1414
|
+
'cls', 'rem',
|
|
1415
|
+
'dir', 'copy', 'move', 'del',
|
|
1416
|
+
'mkdir', 'rmdir', 'type',
|
|
1417
|
+
'ren', 'tasklist', 'taskkill',
|
|
1418
|
+
'ping', 'ipconfig', 'netstat',
|
|
1419
|
+
'shutdown'
|
|
1420
|
+
]);
|
|
1421
|
+
export const POWERSHELL_KEYWORDS = new Set([
|
|
1422
|
+
'function', 'filter', 'param',
|
|
1423
|
+
'begin', 'process', 'end',
|
|
1424
|
+
'if', 'else', 'elseif',
|
|
1425
|
+
'switch', 'foreach', 'for',
|
|
1426
|
+
'while', 'do', 'until',
|
|
1427
|
+
'break', 'continue', 'return',
|
|
1428
|
+
'throw', 'trap', 'try',
|
|
1429
|
+
'catch', 'finally',
|
|
1430
|
+
'$true', '$false', '$null',
|
|
1431
|
+
'Write-Host', 'Write-Output',
|
|
1432
|
+
'Get-Item', 'Set-Item',
|
|
1433
|
+
'Get-ChildItem', 'Remove-Item',
|
|
1434
|
+
'Copy-Item', 'Move-Item',
|
|
1435
|
+
'Test-Path', 'Invoke-Command'
|
|
1436
|
+
]);
|
|
1357
1437
|
export const LANGUAGE_KEYWORDS = {
|
|
1358
1438
|
css: CSS_KEYWORDS,
|
|
1359
1439
|
html: HTML_KEYWORDS,
|
|
@@ -1369,4 +1449,15 @@ export const LANGUAGE_KEYWORDS = {
|
|
|
1369
1449
|
'c++': CPP_KEYWORDS,
|
|
1370
1450
|
rust: RUST_KEYWORDS,
|
|
1371
1451
|
rs: RUST_KEYWORDS,
|
|
1452
|
+
c: C_KEYWORDS,
|
|
1453
|
+
h: C_KEYWORDS,
|
|
1454
|
+
csharp: CSHARP_KEYWORDS,
|
|
1455
|
+
cs: CSHARP_KEYWORDS,
|
|
1456
|
+
bash: BASH_KEYWORDS,
|
|
1457
|
+
sh: BASH_KEYWORDS,
|
|
1458
|
+
zsh: BASH_KEYWORDS,
|
|
1459
|
+
cmd: CMD_KEYWORDS,
|
|
1460
|
+
bat: CMD_KEYWORDS,
|
|
1461
|
+
powershell: POWERSHELL_KEYWORDS,
|
|
1462
|
+
ps1: POWERSHELL_KEYWORDS
|
|
1372
1463
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crysnovax/baileys",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Premium Baileys fork
|
|
3
|
+
"version": "2.6.1",
|
|
4
|
+
"description": "Premium Baileys fork ⚉ Meta compositing, bot planning replay, welcome flow, rich messages (code, table, LaTeX, reels), interactive messages, albums, and more.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"scripts": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"baileys-fork",
|
|
26
26
|
"baileys-mod",
|
|
27
27
|
"crysnova ai",
|
|
28
|
+
"cody ai",
|
|
28
29
|
"bot-planning-replay",
|
|
29
30
|
"crysnovax",
|
|
30
31
|
"interactive-messages",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"whatsapp-group",
|
|
41
42
|
"whatsapp-web"
|
|
42
43
|
],
|
|
43
|
-
"homepage": "https://
|
|
44
|
+
"homepage": "https://www.npmjs.com/package/@crysnovax/baileys/",
|
|
44
45
|
"author": "crysnovax",
|
|
45
46
|
"license": "MIT",
|
|
46
47
|
"dependencies": {
|
|
@@ -49,21 +50,22 @@
|
|
|
49
50
|
"@hapi/boom": "^9.1.3",
|
|
50
51
|
"async-mutex": "^0.5.0",
|
|
51
52
|
"fflate": "^0.8.2",
|
|
52
|
-
"libsignal": "
|
|
53
|
+
"libsignal": "^6.0.0",
|
|
53
54
|
"lru-cache": "^11.2.6",
|
|
54
|
-
"music-metadata": "^11.
|
|
55
|
+
"music-metadata": "^11.12.3",
|
|
55
56
|
"p-queue": "^9.1.0",
|
|
56
57
|
"pino": "^9.6.0",
|
|
57
|
-
"protobufjs": "^7.5.
|
|
58
|
-
"whatsapp-rust-bridge": "0.5.
|
|
58
|
+
"protobufjs": "^7.5.6",
|
|
59
|
+
"whatsapp-rust-bridge": "0.5.5",
|
|
59
60
|
"ws": "^8.19.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"@napi-rs/image": "~1.12.0",
|
|
63
64
|
"audio-decode": "^2.2.3",
|
|
64
|
-
"jimp": "^1.6.
|
|
65
|
+
"jimp": "^1.6.1",
|
|
65
66
|
"link-preview-js": "^3.0.0",
|
|
66
|
-
"sharp": "*"
|
|
67
|
+
"sharp": "*",
|
|
68
|
+
"better-sqlite3": "^11.0.0"
|
|
67
69
|
},
|
|
68
70
|
"peerDependenciesMeta": {
|
|
69
71
|
"@napi-rs/image": {
|
|
@@ -77,7 +79,40 @@
|
|
|
77
79
|
},
|
|
78
80
|
"link-preview-js": {
|
|
79
81
|
"optional": true
|
|
82
|
+
},
|
|
83
|
+
"better-sqlite3": {
|
|
84
|
+
"optional": true
|
|
80
85
|
}
|
|
81
86
|
},
|
|
82
|
-
"packageManager": "yarn@4.9.2"
|
|
87
|
+
"packageManager": "yarn@4.9.2",
|
|
88
|
+
"types": "lib/index.d.ts",
|
|
89
|
+
"resolutions": {
|
|
90
|
+
"ajv@npm:^6.12.4": "^6.14.0",
|
|
91
|
+
"basic-ftp": "^5.2.4",
|
|
92
|
+
"brace-expansion@npm:^1.1.7": "^1.1.13",
|
|
93
|
+
"brace-expansion@npm:^2.0.1": "^2.0.3",
|
|
94
|
+
"flatted": "^3.4.2",
|
|
95
|
+
"glob@npm:^10.2.2": "^10.5.0",
|
|
96
|
+
"glob@npm:^10.3.10": "^10.5.0",
|
|
97
|
+
"glob@npm:^10.5.0": "^10.5.0",
|
|
98
|
+
"handlebars": "^4.7.9",
|
|
99
|
+
"ip-address": "^10.1.1",
|
|
100
|
+
"js-yaml@npm:^3.13.1": "^3.14.2",
|
|
101
|
+
"js-yaml@npm:^4.1.0": "^4.1.1",
|
|
102
|
+
"markdown-it": "^14.1.1",
|
|
103
|
+
"minimatch@npm:^3.0.4": "^3.1.5",
|
|
104
|
+
"minimatch@npm:^3.1.2": "^3.1.5",
|
|
105
|
+
"minimatch@npm:^5.0.1": "^5.1.8",
|
|
106
|
+
"minimatch@npm:^9.0.4": "^9.0.9",
|
|
107
|
+
"minimatch@npm:^9.0.5": "^9.0.9",
|
|
108
|
+
"picomatch@npm:^2.0.4": "^2.3.2",
|
|
109
|
+
"picomatch@npm:^2.3.1": "^2.3.2",
|
|
110
|
+
"picomatch@npm:^4.0.0": "^4.0.4",
|
|
111
|
+
"picomatch@npm:^4.0.2": "^4.0.4",
|
|
112
|
+
"socks": "^2.8.8",
|
|
113
|
+
"tar": "^7.5.11",
|
|
114
|
+
"tmp": "^0.2.5",
|
|
115
|
+
"underscore": "^1.13.8",
|
|
116
|
+
"yaml@npm:^2.6.1": "^2.8.4"
|
|
117
|
+
}
|
|
83
118
|
}
|