mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
chore: expose admintest + cleaner initial state update
This commit is contained in:
@@ -30,9 +30,7 @@ const makeAuthSocket = (config: LegacySocketConfig) => {
|
|||||||
let initTimeout: NodeJS.Timeout
|
let initTimeout: NodeJS.Timeout
|
||||||
|
|
||||||
ws.on('phone-connection', ({ value: phoneConnected }) => {
|
ws.on('phone-connection', ({ value: phoneConnected }) => {
|
||||||
if(phoneConnected !== state.legacy.phoneConnected) {
|
updateState({ legacy: { ...state.legacy, phoneConnected } })
|
||||||
updateState({ legacy: { ...state.legacy, phoneConnected } })
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
// add close listener
|
// add close listener
|
||||||
ws.on('ws-close', (error: Boom | Error) => {
|
ws.on('ws-close', (error: Boom | Error) => {
|
||||||
@@ -222,11 +220,7 @@ const makeAuthSocket = (config: LegacySocketConfig) => {
|
|||||||
|
|
||||||
process.nextTick(() => {
|
process.nextTick(() => {
|
||||||
ev.emit('connection.update', {
|
ev.emit('connection.update', {
|
||||||
connection: 'connecting',
|
...state
|
||||||
receivedPendingNotifications: false,
|
|
||||||
legacy: {
|
|
||||||
phoneConnected: false
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -365,6 +365,7 @@ export const makeSocket = ({
|
|||||||
return {
|
return {
|
||||||
type: 'legacy' as 'legacy',
|
type: 'legacy' as 'legacy',
|
||||||
ws,
|
ws,
|
||||||
|
sendAdminTest,
|
||||||
updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info,
|
updateKeys: (info: { encKey: Buffer, macKey: Buffer }) => authInfo = info,
|
||||||
waitForSocketOpen,
|
waitForSocketOpen,
|
||||||
sendNode,
|
sendNode,
|
||||||
|
|||||||
Reference in New Issue
Block a user