mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Fixed infinite reconnection cycle
This commit is contained in:
@@ -415,7 +415,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
const identitySharedKey = Curve.sharedKey(authState.creds.signedIdentityKey.private, primaryIdentityPublicKey)
|
const identitySharedKey = Curve.sharedKey(authState.creds.signedIdentityKey.private, primaryIdentityPublicKey)
|
||||||
const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random])
|
const identityPayload = Buffer.concat([companionSharedKey, identitySharedKey, random])
|
||||||
authState.creds.advSecretKey = hkdf(identityPayload, 32, { info: 'adv_secret' }).toString('base64')
|
authState.creds.advSecretKey = hkdf(identityPayload, 32, { info: 'adv_secret' }).toString('base64')
|
||||||
await sendNode({
|
await query({
|
||||||
tag: 'iq',
|
tag: 'iq',
|
||||||
attrs: {
|
attrs: {
|
||||||
to: S_WHATSAPP_NET,
|
to: S_WHATSAPP_NET,
|
||||||
@@ -451,6 +451,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
authState.creds.registered = true
|
authState.creds.registered = true
|
||||||
|
ev.emit('creds.update', authState.creds)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Object.keys(result).length) {
|
if(Object.keys(result).length) {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
let url = typeof waWebSocketUrl === 'string' ? new URL(waWebSocketUrl) : waWebSocketUrl
|
let url = typeof waWebSocketUrl === 'string' ? new URL(waWebSocketUrl) : waWebSocketUrl
|
||||||
|
|
||||||
config.mobile = config.mobile || config.auth?.creds?.registered || url.protocol === 'tcp:'
|
config.mobile = config.mobile || url.protocol === 'tcp:'
|
||||||
|
|
||||||
if(config.mobile && url.protocol !== 'tcp:') {
|
if(config.mobile && url.protocol !== 'tcp:') {
|
||||||
url = new URL(`tcp://${MOBILE_ENDPOINT}:${MOBILE_PORT}`)
|
url = new URL(`tcp://${MOBILE_ENDPOINT}:${MOBILE_PORT}`)
|
||||||
@@ -488,6 +488,7 @@ export const makeSocket = (config: SocketConfig) => {
|
|||||||
id: jidEncode(phoneNumber, 's.whatsapp.net'),
|
id: jidEncode(phoneNumber, 's.whatsapp.net'),
|
||||||
name: '~'
|
name: '~'
|
||||||
}
|
}
|
||||||
|
ev.emit('creds.update', authState.creds)
|
||||||
await sendNode({
|
await sendNode({
|
||||||
tag: 'iq',
|
tag: 'iq',
|
||||||
attrs: {
|
attrs: {
|
||||||
|
|||||||
Reference in New Issue
Block a user