Skip to content

Commit

Permalink
Merge branch 'WhiskeySockets:master' into send-server-ack
Browse files Browse the repository at this point in the history
  • Loading branch information
MateusFrFreitas authored Jan 30, 2025
2 parents 4c33327 + 40ebf66 commit fcc3ed2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Defaults/baileys-version.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": [2, 3000, 1017531287]
"version": [2, 3000, 1019707846]
}
1 change: 1 addition & 0 deletions src/Defaults/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export const DEFAULT_CONNECTION_CONFIG: SocketConfig = {
patch: false,
snapshot: false,
},
countryCode: 'US',
getMessage: async() => undefined,
cachedGroupMetadata: async() => undefined,
makeSignalRepository: makeLibSignalRepository
Expand Down
3 changes: 2 additions & 1 deletion src/Types/Socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export type SocketConfig = {
transactionOpts: TransactionCapabilityOptions
/** marks the client as online whenever the socket successfully connects */
markOnlineOnConnect: boolean

/** alphanumeric country code (USA -> US) for the number used */
countryCode: string
/** provide a cache to store media, so does not have to be re-uploaded */
mediaCache?: CacheStore
/**
Expand Down
9 changes: 6 additions & 3 deletions src/Utils/validate-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { encodeBigEndian } from './generics'
import { createSignalIdentity } from './signal'

const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {

return {
appVersion: {
primary: config.version[0],
Expand All @@ -22,7 +21,9 @@ const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
device: 'Desktop',
osBuildNumber: '0.1',
localeLanguageIso6391: 'en',
localeCountryIso31661Alpha2: 'US'
mnc: '000',
mcc: '000',
localeCountryIso31661Alpha2: config.countryCode,
}
}

Expand Down Expand Up @@ -58,7 +59,8 @@ export const generateLoginNode = (userJid: string, config: SocketConfig): proto.
const { user, device } = jidDecode(userJid)!
const payload: proto.IClientPayload = {
...getClientPayload(config),
passive: true,
passive: false,
pull: true,
username: +user,
device: device,
}
Expand Down Expand Up @@ -91,6 +93,7 @@ export const generateRegistrationNode = (
const registerPayload: proto.IClientPayload = {
...getClientPayload(config),
passive: false,
pull: false,
devicePairingData: {
buildHash: appVersionBuf,
deviceProps: companionProto,
Expand Down

0 comments on commit fcc3ed2

Please sign in to comment.