fix: send message speed, lid logic, remove messages-send useless functions (#1794)
* fix: remove redundant migration * fix: remove deduplicatelidpnjids * fix: assertsessions complexity * fix: assertsessions call * fix: remove getencryptionjid * fix: add wirejid to injecte2esession, remove libsignal lid migration * fix: logger lid-mapping * fix: injecte2esession decoded approach * fix: changes made by @AstroX11 * fix: lint * fix: lint * fix: lint * Revert "fix: injecte2esession decoded approach" This reverts commit 4e368296ed084398b8a173ec117dc2478e481748. * fix: centralize getlidforpn calls in messages-send * fix: add resolvechunklids to signal * fix: remove useless arrays * fix: assertsessions logic * fix: lint * Revert "fix: assertsessions logic" This reverts commit 65b0730891c91573edcab1c96af010db54382fba. * fix: remove onwhatsapp fallback to prevent rate limit, migrate sessions when lid-map is created, new migration logic and user devices key * fix: migrate session devices, socket creation * fix: add back decryptionjid validation * fix: add resolveSignalAddress to get lid * fix: type error migration * fix: lint * fix: device level cache, proposed changes
This commit is contained in:
@@ -939,7 +939,7 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
}
|
||||
}
|
||||
|
||||
await assertSessions([participant], shouldRecreateSession)
|
||||
await assertSessions([participant])
|
||||
|
||||
if (isJidGroup(remoteJid)) {
|
||||
await authState.keys.set({ 'sender-key-memory': { [remoteJid]: null } })
|
||||
@@ -1130,23 +1130,23 @@ export const makeMessagesRecvSocket = (config: SocketConfig) => {
|
||||
pn = jidNormalizedUser(node.attrs.sender_pn)
|
||||
ev.emit('lid-mapping.update', { lid, pn })
|
||||
await signalRepository.lidMapping.storeLIDPNMappings([{ lid, pn }])
|
||||
await signalRepository.migrateSession(pn, lid)
|
||||
}
|
||||
|
||||
const alt = msg.key.participantAlt || msg.key.remoteJidAlt
|
||||
// store new mappings we didn't have before
|
||||
if (!!alt) {
|
||||
const altServer = jidDecode(alt)?.server
|
||||
const primaryJid = msg.key.participant || msg.key.remoteJid!
|
||||
if (altServer === 'lid') {
|
||||
if (typeof (await signalRepository.lidMapping.getPNForLID(alt)) === 'string') {
|
||||
await signalRepository.lidMapping.storeLIDPNMappings([
|
||||
{ lid: alt, pn: msg.key.participant || msg.key.remoteJid! }
|
||||
])
|
||||
await signalRepository.lidMapping.storeLIDPNMappings([{ lid: alt, pn: primaryJid }])
|
||||
await signalRepository.migrateSession(primaryJid, alt)
|
||||
}
|
||||
} else {
|
||||
if (typeof (await signalRepository.lidMapping.getLIDForPN(alt)) === 'string') {
|
||||
await signalRepository.lidMapping.storeLIDPNMappings([
|
||||
{ lid: msg.key.participant || msg.key.remoteJid!, pn: alt }
|
||||
])
|
||||
await signalRepository.lidMapping.storeLIDPNMappings([{ lid: primaryJid, pn: alt }])
|
||||
await signalRepository.migrateSession(alt, primaryJid)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user