mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-18 19:32:21 -06:00
feat(baileys): enhance logout process and connection handling
- Introduced a flag to prevent reconnection during instance deletion. - Improved logging for connection updates and errors during logout. - Added a delay before reconnection attempts to avoid rapid loops. - Enhanced webhook headers for better tracking and debugging. - Updated configuration to support manual Baileys version setting.
This commit is contained in:
@@ -1,7 +1,24 @@
|
||||
import axios, { AxiosRequestConfig } from 'axios';
|
||||
import { fetchLatestBaileysVersion, WAVersion } from 'baileys';
|
||||
|
||||
import { Baileys, configService } from '../config/env.config';
|
||||
|
||||
export const fetchLatestWaWebVersion = async (options: AxiosRequestConfig<{}>) => {
|
||||
// Check if manual version is set via configuration
|
||||
const baileysConfig = configService.get<Baileys>('BAILEYS');
|
||||
const manualVersion = baileysConfig?.VERSION;
|
||||
|
||||
if (manualVersion) {
|
||||
const versionParts = manualVersion.split('.').map(Number);
|
||||
if (versionParts.length === 3 && !versionParts.some(isNaN)) {
|
||||
return {
|
||||
version: versionParts as WAVersion,
|
||||
isLatest: false,
|
||||
isManual: true,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
const { data } = await axios.get('https://web.whatsapp.com/sw.js', {
|
||||
...options,
|
||||
|
||||
Reference in New Issue
Block a user