mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Merge pull request #711 from WhiskeySockets/fix-516
This commit is contained in:
@@ -13,7 +13,7 @@ const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
|
||||
const version = config.mobile ? [2, 22, 24] : config.version
|
||||
const device = config.mobile ? 'iPhone_7' : 'Desktop'
|
||||
const manufacturer = config.mobile ? 'Apple' : ''
|
||||
const platform = config.mobile ? proto.ClientPayload.UserAgent.Platform.IOS : proto.ClientPayload.UserAgent.Platform.MACOS
|
||||
const platform = config.mobile ? proto.ClientPayload.UserAgent.Platform.IOS : proto.ClientPayload.UserAgent.Platform.WEB
|
||||
const phoneId = config.mobile ? { phoneId: config.auth.creds.phoneId } : {}
|
||||
|
||||
return {
|
||||
@@ -36,6 +36,21 @@ const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
|
||||
}
|
||||
}
|
||||
|
||||
const PLATFORM_MAP = {
|
||||
'Mac OS': proto.ClientPayload.WebInfo.WebSubPlatform.DARWIN,
|
||||
'Windows': proto.ClientPayload.WebInfo.WebSubPlatform.WIN32
|
||||
}
|
||||
|
||||
const getWebInfo = (config: SocketConfig): proto.ClientPayload.IWebInfo => {
|
||||
let webSubPlatform = proto.ClientPayload.WebInfo.WebSubPlatform.WEB_BROWSER
|
||||
if(config.syncFullHistory && PLATFORM_MAP[config.browser[0]]) {
|
||||
webSubPlatform = PLATFORM_MAP[config.browser[0]]
|
||||
}
|
||||
|
||||
return { webSubPlatform }
|
||||
}
|
||||
|
||||
|
||||
const getClientPayload = (config: SocketConfig) => {
|
||||
const payload: proto.IClientPayload = {
|
||||
connectType: proto.ClientPayload.ConnectType.WIFI_UNKNOWN,
|
||||
@@ -43,6 +58,10 @@ const getClientPayload = (config: SocketConfig) => {
|
||||
userAgent: getUserAgent(config),
|
||||
}
|
||||
|
||||
if(!config.mobile) {
|
||||
payload.webInfo = getWebInfo(config)
|
||||
}
|
||||
|
||||
return payload
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user