File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/api/integrations/channel/whatsapp Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -608,9 +608,14 @@ export class BaileysStartupService extends ChannelStartupService {
608608 try {
609609 const response = await axios . get ( this . localProxy ?. host ) ;
610610 const text = response . data ;
611- const proxyUrls = text . split ( '\r\n' ) ;
611+ const proxyUrls = text . split ( '\r\n' ) . filter ( Boolean ) ;
612612 const rand = Math . floor ( Math . random ( ) * Math . floor ( proxyUrls . length ) ) ;
613- const proxyUrl = 'http://' + proxyUrls [ rand ] ;
613+ let proxyUrl = proxyUrls [ rand ] ;
614+ // Si la línea ya tiene protocolo, úsala tal cual. Si no, anteponer el protocolo configurado
615+ if ( ! / ^ \w + : \/ \/ / . test ( proxyUrl ) ) {
616+ const proto = this . localProxy ?. protocol ?. replace ( ':' , '' ) || 'http' ;
617+ proxyUrl = `${ proto } ://${ proxyUrl } ` ;
618+ }
614619 options = { agent : makeProxyAgent ( proxyUrl ) , fetchAgent : makeProxyAgentUndici ( proxyUrl ) } ;
615620 } catch {
616621 this . localProxy . enabled = false ;
You can’t perform that action at this time.
0 commit comments