mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix(master): error in init queries
This commit is contained in:
@@ -715,32 +715,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
/** sending abt props may fix QR scan fail if server expects */
|
||||
const fetchAbt = async() => {
|
||||
const abtNode = await query({
|
||||
tag: 'iq',
|
||||
attrs: {
|
||||
to: S_WHATSAPP_NET,
|
||||
xmlns: 'abt',
|
||||
type: 'get',
|
||||
},
|
||||
content: [
|
||||
{ tag: 'props', attrs: { protocol: '1' } }
|
||||
]
|
||||
})
|
||||
|
||||
const propsNode = getBinaryNodeChild(abtNode, 'props')
|
||||
|
||||
let props: { [_: string]: string } = {}
|
||||
if(propsNode) {
|
||||
props = reduceBinaryNodeToDictionary(propsNode, 'prop')
|
||||
}
|
||||
|
||||
logger.debug('fetched abt')
|
||||
|
||||
return props
|
||||
}
|
||||
|
||||
/** sending non-abt props may fix QR scan fail if server expects */
|
||||
const fetchProps = async() => {
|
||||
const resultNode = await query({
|
||||
@@ -751,14 +725,20 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
type: 'get',
|
||||
},
|
||||
content: [
|
||||
{ tag: 'props', attrs: {} }
|
||||
{ tag: 'props', attrs: {
|
||||
protocol: 2,
|
||||
hash: authState?.creds?.lastPropHash || ""
|
||||
} }
|
||||
]
|
||||
})
|
||||
|
||||
const propsNode = getBinaryNodeChild(resultNode, 'props')
|
||||
|
||||
|
||||
|
||||
let props: { [_: string]: string } = {}
|
||||
if(propsNode) {
|
||||
authState?.creds?.lastPropHash = propsNode?.attrs?.hash
|
||||
ev.emit('creds.update', authState.creds)
|
||||
props = reduceBinaryNodeToDictionary(propsNode, 'prop')
|
||||
}
|
||||
|
||||
@@ -841,7 +821,6 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
||||
* */
|
||||
const executeInitQueries = async() => {
|
||||
await Promise.all([
|
||||
fetchAbt(),
|
||||
fetchProps(),
|
||||
fetchBlocklist(),
|
||||
fetchPrivacySettings(),
|
||||
|
||||
Reference in New Issue
Block a user