From 7ee0b61716f166fa94a05302f5a048a1d5001701 Mon Sep 17 00:00:00 2001 From: Rajeh Taher Date: Sat, 18 Oct 2025 20:35:36 +0300 Subject: [PATCH] chore: lint --- src/Signal/libsignal.ts | 4 ++-- src/Signal/lid-mapping.ts | 12 ++++++++++-- src/Socket/messages-send.ts | 2 +- src/Socket/socket.ts | 2 +- src/Utils/decode-wa-message.ts | 4 ++-- src/Utils/process-message.ts | 5 +++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/Signal/libsignal.ts b/src/Signal/libsignal.ts index 0a66b111..c279a851 100644 --- a/src/Signal/libsignal.ts +++ b/src/Signal/libsignal.ts @@ -357,9 +357,9 @@ function signalStorage( if (domainType === WAJIDDomains.LID || domainType === WAJIDDomains.HOSTED_LID) return id - const pnJid = `${user!}${device !== '0' ? `:${device}` : ''}@${domainType == WAJIDDomains.HOSTED ? 'hosted' : 's.whatsapp.net'}` + const pnJid = `${user!}${device !== '0' ? `:${device}` : ''}@${domainType === WAJIDDomains.HOSTED ? 'hosted' : 's.whatsapp.net'}` - let lidForPN = await lidMapping.getLIDForPN(pnJid) + const lidForPN = await lidMapping.getLIDForPN(pnJid) if (lidForPN) { const lidAddr = jidToSignalProtocolAddress(lidForPN) return lidAddr.toString() diff --git a/src/Signal/lid-mapping.ts b/src/Signal/lid-mapping.ts index 95967480..960b80eb 100644 --- a/src/Signal/lid-mapping.ts +++ b/src/Signal/lid-mapping.ts @@ -1,7 +1,15 @@ import { LRUCache } from 'lru-cache' import type { LIDMapping, SignalKeyStoreWithTransaction } from '../Types' import type { ILogger } from '../Utils/logger' -import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser, WAJIDDomains } from '../WABinary' +import { + isHostedLidUser, + isHostedPnUser, + isLidUser, + isPnUser, + jidDecode, + jidNormalizedUser, + WAJIDDomains +} from '../WABinary' export class LIDMappingStore { private readonly mappingCache = new LRUCache({ @@ -201,7 +209,7 @@ export class LIDMappingStore { // Construct device-specific PN JID const lidDevice = decoded.device !== undefined ? decoded.device : 0 - const pnJid = `${pnUser}:${lidDevice}@${decoded.domainType == WAJIDDomains.HOSTED_LID ? 'hosted' : 's.whatsapp.net'}` + const pnJid = `${pnUser}:${lidDevice}@${decoded.domainType === WAJIDDomains.HOSTED_LID ? 'hosted' : 's.whatsapp.net'}` this.logger.trace(`Found reverse mapping: ${lid} → ${pnJid}`) return pnJid diff --git a/src/Socket/messages-send.ts b/src/Socket/messages-send.ts index 80e9aafd..eead9c94 100644 --- a/src/Socket/messages-send.ts +++ b/src/Socket/messages-send.ts @@ -43,9 +43,9 @@ import { getBinaryNodeChild, getBinaryNodeChildren, getServerFromDomainType, - isJidGroup, isHostedLidUser, isHostedPnUser, + isJidGroup, isLidUser, isPnUser, jidDecode, diff --git a/src/Socket/socket.ts b/src/Socket/socket.ts index d6582cf2..cb5e5070 100644 --- a/src/Socket/socket.ts +++ b/src/Socket/socket.ts @@ -502,7 +502,7 @@ export const makeSocket = (config: SocketConfig) => { try { let count = 0 const preKeyCount = await getAvailablePreKeysOnServer() - if (preKeyCount == 0) count = INITIAL_PREKEY_COUNT + if (preKeyCount === 0) count = INITIAL_PREKEY_COUNT else count = MIN_PREKEY_COUNT const { exists: currentPreKeyExists, currentPreKeyId } = await verifyCurrentPreKeyExists() diff --git a/src/Utils/decode-wa-message.ts b/src/Utils/decode-wa-message.ts index 8e406876..621a30f0 100644 --- a/src/Utils/decode-wa-message.ts +++ b/src/Utils/decode-wa-message.ts @@ -5,10 +5,10 @@ import type { SignalRepositoryWithLIDStore } from '../Types/Signal' import { areJidsSameUser, type BinaryNode, - isJidBroadcast, - isJidGroup, isHostedLidUser, isHostedPnUser, + isJidBroadcast, + isJidGroup, isJidMetaAI, isJidNewsletter, isJidStatusBroadcast, diff --git a/src/Utils/process-message.ts b/src/Utils/process-message.ts index 89a1677a..b939d7a3 100644 --- a/src/Utils/process-message.ts +++ b/src/Utils/process-message.ts @@ -19,9 +19,9 @@ import { WAMessageStubType } from '../Types' import { getContentType, normalizeMessageContent } from '../Utils/messages' import { areJidsSameUser, - isJidBroadcast, isHostedLidUser, isHostedPnUser, + isJidBroadcast, isJidStatusBroadcast, jidDecode, jidEncode, @@ -90,7 +90,8 @@ export const cleanMessage = (message: WAMessage, meId: string, meLid: string) => // if the sender believed the message being reacted to is not from them // we've to correct the key to be from them, or some other participant msgKey.fromMe = !msgKey.fromMe - ? areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meId) || areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meLid) + ? areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meId) || + areJidsSameUser(msgKey.participant || msgKey.remoteJid!, meLid) : // if the message being reacted to, was from them // fromMe automatically becomes false false