Skip to content

Commit

Permalink
proxy for fetch config
Browse files Browse the repository at this point in the history
  • Loading branch information
clairton committed May 21, 2024
1 parent dab557f commit a03cc78
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/services/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { isValidPhoneNumber } from './transformer'
import logger from './logger'
import { Level } from 'pino'
import { SocksProxyAgent } from 'socks-proxy-agent'
import { HttpsProxyAgent } from 'https-proxy-agent'
import { isSessionStatusConnecting, isSessionStatusOnline, setSessionStatus, isSessionStatusOffline, isSessionStatusIsDisconnect } from './session_store'
import { CONFIG_SESSION_PHONE_CLIENT, CONFIG_SESSION_PHONE_NAME, WHATSAPP_VERSION, LOG_LEVEL } from '../defaults'

Expand Down Expand Up @@ -346,6 +347,7 @@ export const connect = async ({
let fetchAgent
if (config.proxyUrl) {
agent = new SocksProxyAgent(config.proxyUrl)
fetchAgent = new HttpsProxyAgent(config.proxyUrl)
}

try {
Expand All @@ -361,6 +363,7 @@ export const connect = async ({
retryRequestDelayMs: config.retryRequestDelayMs,
patchMessageBeforeSending,
agent,
fetchAgent,
version: WHATSAPP_VERSION,
})
// eslint-disable-next-line @typescript-eslint/no-explicit-any
Expand Down

0 comments on commit a03cc78

Please sign in to comment.