fix error and linting (#1888)

* fix: build

* fix: linting

* fix: cast type
This commit is contained in:
Jefferson Felix
2025-10-08 03:27:43 -03:00
committed by GitHub
parent c41aae78c2
commit a3ec28e051
4 changed files with 16 additions and 7 deletions
+1 -1
View File
@@ -332,7 +332,7 @@ const jidToSignalProtocolAddress = (jid: string): libsignal.ProtocolAddress => {
const signalUser = domainType !== WAJIDDomains.WHATSAPP ? `${user}_${domainType}` : user
const finalDevice = device || 0
if (device == 99 && decoded.server !== 'hosted' && decoded.server !== 'hosted.lid') {
if (device === 99 && decoded.server !== 'hosted' && decoded.server !== 'hosted.lid') {
throw new Error('Unexpected non-hosted device JID with device 99. This ID seems invalid. ID:' + jid)
}
+2 -2
View File
@@ -154,13 +154,13 @@ export class LIDMappingStore {
if (!lidUser) continue
for (const device of usyncFetch[pair.pn]!) {
const deviceSpecificLid = `${lidUser}${!!device ? `:${device}` : ``}@${device == 99 ? 'hosted.lid' : 'lid'}`
const deviceSpecificLid = `${lidUser}${!!device ? `:${device}` : ``}@${device === 99 ? 'hosted.lid' : 'lid'}`
this.logger.trace(
`getLIDForPN: USYNC success for ${pair.pn}${deviceSpecificLid} (user mapping with device ${device})`
)
const deviceSpecificPn = `${pnUser}${!!device ? `:${device}` : ``}@${device == 99 ? 'hosted' : 's.whatsapp.net'}`
const deviceSpecificPn = `${pnUser}${!!device ? `:${device}` : ``}@${device === 99 ? 'hosted' : 's.whatsapp.net'}`
successfulPairs[deviceSpecificPn] = { lid: deviceSpecificLid, pn: deviceSpecificPn }
}
+11 -2
View File
@@ -18,7 +18,7 @@ import {
getBinaryNodeChildUInt,
jidDecode,
S_WHATSAPP_NET,
WAJIDDomains,
WAJIDDomains
} from '../WABinary'
import type { DeviceListData, ParsedDeviceInfo, USyncQueryResultList } from '../WAUSync'
import { Curve, generateSignalPubKey } from './crypto'
@@ -153,7 +153,16 @@ export const extractDeviceJids = (
((myUser !== user && myLid !== user) || myDevice !== device) && // either different user or if me user, not this device
(device === 0 || !!keyIndex) // ensure that "key-index" is specified for "non-zero" devices, produces a bad req otherwise
) {
extracted.push({ user, device, domainType: isHosted ? domainType === WAJIDDomains.LID ? WAJIDDomains.HOSTED_LID : WAJIDDomains.HOSTED : domainType, server })
extracted.push({
user,
device,
domainType: isHosted
? domainType === WAJIDDomains.LID
? WAJIDDomains.HOSTED_LID
: WAJIDDomains.HOSTED
: domainType,
server
})
}
}
}
+2 -2
View File
@@ -35,7 +35,7 @@ export type FullJid = JidWithDevice & {
}
export const getServerFromDomainType = (initialServer: string, domainType?: WAJIDDomains): JidServer => {
switch(domainType) {
switch (domainType) {
case WAJIDDomains.LID:
return 'lid'
case WAJIDDomains.HOSTED:
@@ -44,7 +44,7 @@ export const getServerFromDomainType = (initialServer: string, domainType?: WAJI
return 'hosted.lid'
case WAJIDDomains.WHATSAPP:
default:
return initialServer
return initialServer as JidServer
}
}