Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 1afbfc71cd |
+6
-14
@@ -230,22 +230,14 @@ export const bindWaitForConnectionUpdate = (ev: BaileysEventEmitter) => bindWait
|
|||||||
* utility that fetches latest baileys version from the master branch.
|
* utility that fetches latest baileys version from the master branch.
|
||||||
* Use to ensure your WA connection is always on the latest version
|
* Use to ensure your WA connection is always on the latest version
|
||||||
*/
|
*/
|
||||||
export const fetchLatestBaileysVersion = async (options: RequestInit & { timeout?: number } = {}) => {
|
export const fetchLatestBaileysVersion = async (options: RequestInit = {}) => {
|
||||||
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts'
|
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts'
|
||||||
try {
|
try {
|
||||||
const controller = new AbortController()
|
const response = await fetch(URL, {
|
||||||
const timeout = setTimeout(() => controller.abort(), options.timeout ?? 5000)
|
dispatcher: options.dispatcher,
|
||||||
let response: Response
|
method: 'GET',
|
||||||
try {
|
headers: options.headers
|
||||||
response = await fetch(URL, {
|
})
|
||||||
dispatcher: options.dispatcher,
|
|
||||||
method: 'GET',
|
|
||||||
headers: options.headers,
|
|
||||||
signal: controller.signal
|
|
||||||
})
|
|
||||||
} finally {
|
|
||||||
clearTimeout(timeout)
|
|
||||||
}
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Boom(`Failed to fetch latest Baileys version: ${response.statusText}`, { statusCode: response.status })
|
throw new Boom(`Failed to fetch latest Baileys version: ${response.statusText}`, { statusCode: response.status })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const getUserAgent = (config: SocketConfig): proto.ClientPayload.IUserAgent => {
|
|||||||
secondary: config.version[1],
|
secondary: config.version[1],
|
||||||
tertiary: config.version[2]
|
tertiary: config.version[2]
|
||||||
},
|
},
|
||||||
platform: proto.ClientPayload.UserAgent.Platform.WEB,
|
platform: proto.ClientPayload.UserAgent.Platform.MACOS,
|
||||||
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
releaseChannel: proto.ClientPayload.UserAgent.ReleaseChannel.RELEASE,
|
||||||
osVersion: '0.1',
|
osVersion: '0.1',
|
||||||
device: 'Desktop',
|
device: 'Desktop',
|
||||||
|
|||||||
Reference in New Issue
Block a user