mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: socket options
This commit is contained in:
@@ -355,13 +355,13 @@ const UNEXPECTED_SERVER_CODE_TEXT = 'Unexpected server response: '
|
||||
|
||||
export const getCodeFromWSError = (error: Error) => {
|
||||
let statusCode = 500
|
||||
if(error.message.includes(UNEXPECTED_SERVER_CODE_TEXT)) {
|
||||
const code = +error.message.slice(UNEXPECTED_SERVER_CODE_TEXT.length)
|
||||
if(error?.message?.includes(UNEXPECTED_SERVER_CODE_TEXT)) {
|
||||
const code = +error?.message.slice(UNEXPECTED_SERVER_CODE_TEXT.length)
|
||||
if(!Number.isNaN(code) && code >= 400) {
|
||||
statusCode = code
|
||||
}
|
||||
} else if(
|
||||
(error as any).code?.startsWith('E')
|
||||
(error as any)?.code?.startsWith('E')
|
||||
|| error?.message?.includes('timed out')
|
||||
) { // handle ETIMEOUT, ENOTFOUND etc
|
||||
statusCode = 408
|
||||
|
||||
@@ -88,17 +88,10 @@ export const generateRegistrationNode = (
|
||||
const appVersionBuf = createHash('md5')
|
||||
.update(config.version.join('.')) // join as string
|
||||
.digest()
|
||||
const browserVersion = config.browser[2].split('.')
|
||||
|
||||
const companion: proto.IDeviceProps = {
|
||||
os: config.browser[0],
|
||||
version: {
|
||||
primary: +(browserVersion[0] || 0),
|
||||
secondary: +(browserVersion[1] || 1),
|
||||
tertiary: +(browserVersion[2] || 0),
|
||||
},
|
||||
platformType: proto.DeviceProps.PlatformType[config.browser[1].toUpperCase()]
|
||||
|| proto.DeviceProps.PlatformType.UNKNOWN,
|
||||
platformType: proto.DeviceProps.PlatformType.DESKTOP,
|
||||
requireFullSync: config.syncFullHistory,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user