[core] NOWEB - fix ssl issue

fix #1474
This commit is contained in:
devlikepro committed 2025-10-12 18:45:45 +07:00
1 parent 9d0050adb8
commit df8cb7cecb
1 file changed
+13 -3
+13 -3
View File
@@ -43,6 +43,7 @@ import { complete } from '@waha/utils/reactive/complete';
import { SwitchObservable } from '@waha/utils/reactive/SwitchObservable';
import axios from 'axios';
import axiosRetry from 'axios-retry';
import { Agent as HttpsAgent } from 'https';
import * as fs from 'fs';
import * as lodash from 'lodash';
import * as NodeCache from 'node-cache';
@@ -1076,10 +1077,19 @@ export abstract class WhatsappSession {
/**
* Fetches the content from the specified URL and returns it as a Buffer.
*/
private static readonly insecureHttpsAgent = new HttpsAgent({
rejectUnauthorized: false,
});
public async fetch(url: string): Promise<Buffer> {
return axios.get(url, { responseType: 'arraybuffer' }).then((res) => {
return Buffer.from(res.data);
});
return axios
.get(url, {
responseType: 'arraybuffer',
httpsAgent: WhatsappSession.insecureHttpsAgent,
})
.then((res) => {
return Buffer.from(res.data);
});
}
}