fix(master): error in init queries

This commit is contained in:
Rajeh Taher
2024-05-06 18:18:15 +03:00
committed by GitHub
parent 27d42652d7
commit fbbb511fb8
3 changed files with 10 additions and 29 deletions

View File

@@ -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(),