fix(irc): set proxy if use proxy is enabled (#2011)

fix(irc): set proxy is use proxy is enabled
This commit is contained in:
ze0s 2025-04-06 17:07:28 +02:00 committed by GitHub
parent e137ac4070
commit 6b2b1637cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -83,11 +83,11 @@ func (s *service) StartHandlers() {
continue continue
} }
if network.ProxyId != 0 { if network.UseProxy && network.ProxyId != 0 {
networkProxy, err := s.proxyService.FindByID(context.Background(), network.ProxyId) networkProxy, err := s.proxyService.FindByID(context.Background(), network.ProxyId)
if err != nil { if err != nil {
s.log.Error().Err(err).Msgf("failed to get proxy for network: %s", network.Server) s.log.Error().Err(err).Msgf("failed to get proxy for network: %s", network.Server)
return continue
} }
network.Proxy = networkProxy network.Proxy = networkProxy
} }
@ -147,7 +147,10 @@ func (s *service) startNetwork(network domain.IrcNetwork) error {
} }
}(existingHandler) }(existingHandler)
} }
} else {
return nil
}
// if not found in handlers, lets add it and run it // if not found in handlers, lets add it and run it
channels, err := s.repo.ListChannels(network.ID) channels, err := s.repo.ListChannels(network.ID)
if err != nil { if err != nil {
@ -178,7 +181,6 @@ func (s *service) startNetwork(network domain.IrcNetwork) error {
s.log.Error().Err(err).Msgf("failed to start handler for network: %s", network.Name) s.log.Error().Err(err).Msgf("failed to start handler for network: %s", network.Name)
} }
}(network) }(network)
}
return nil return nil
} }