mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix: make valid channels check lowercase (#75)
This commit is contained in:
parent
efa84fee8b
commit
27f902041b
1 changed files with 5 additions and 6 deletions
|
@ -85,6 +85,7 @@ func NewHandler(network domain.IrcNetwork, filterService filter.Service, release
|
||||||
for _, definition := range definitions {
|
for _, definition := range definitions {
|
||||||
// indexers can use multiple channels, but it's not common, but let's handle that anyway.
|
// indexers can use multiple channels, but it's not common, but let's handle that anyway.
|
||||||
for _, channel := range definition.IRC.Channels {
|
for _, channel := range definition.IRC.Channels {
|
||||||
|
// some channels are defined in mixed case
|
||||||
channel = strings.ToLower(channel)
|
channel = strings.ToLower(channel)
|
||||||
|
|
||||||
h.announceProcessors[channel] = announce.NewAnnounceProcessor(definition, filterService, releaseService)
|
h.announceProcessors[channel] = announce.NewAnnounceProcessor(definition, filterService, releaseService)
|
||||||
|
@ -93,17 +94,15 @@ func NewHandler(network domain.IrcNetwork, filterService filter.Service, release
|
||||||
name: channel,
|
name: channel,
|
||||||
monitoring: false,
|
monitoring: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create map of valid channels
|
||||||
|
h.validChannels[channel] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create map of valid announcers
|
// create map of valid announcers
|
||||||
for _, announcer := range definition.IRC.Announcers {
|
for _, announcer := range definition.IRC.Announcers {
|
||||||
h.validAnnouncers[announcer] = struct{}{}
|
h.validAnnouncers[announcer] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// create map of valid channels
|
|
||||||
for _, ch := range definition.IRC.Channels {
|
|
||||||
h.validChannels[ch] = struct{}{}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return h
|
return h
|
||||||
|
@ -622,7 +621,7 @@ func (s *Handler) isValidAnnouncer(nick string) bool {
|
||||||
|
|
||||||
// check if channel is one from the list in the definition
|
// check if channel is one from the list in the definition
|
||||||
func (s *Handler) isValidChannel(channel string) bool {
|
func (s *Handler) isValidChannel(channel string) bool {
|
||||||
_, ok := s.validChannels[channel]
|
_, ok := s.validChannels[strings.ToLower(channel)]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue