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