mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat: show irc network status in settings list
This commit is contained in:
parent
dcd1d458cf
commit
f103dff221
6 changed files with 221 additions and 11 deletions
|
@ -72,6 +72,24 @@ type IndexerIRC struct {
|
|||
Settings []IndexerSetting `json:"settings"`
|
||||
}
|
||||
|
||||
func (i IndexerIRC) ValidAnnouncer(announcer string) bool {
|
||||
for _, a := range i.Announcers {
|
||||
if a == announcer {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (i IndexerIRC) ValidChannel(channel string) bool {
|
||||
for _, a := range i.Channels {
|
||||
if a == channel {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type IndexerParse struct {
|
||||
Type string `json:"type"`
|
||||
Lines []IndexerParseExtract `json:"lines"`
|
||||
|
|
|
@ -34,6 +34,44 @@ type IrcNetwork struct {
|
|||
ConnectedSince *time.Time `json:"connected_since"`
|
||||
}
|
||||
|
||||
type IrcNetworkWithHealth struct {
|
||||
ID int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Server string `json:"server"`
|
||||
Port int `json:"port"`
|
||||
TLS bool `json:"tls"`
|
||||
Pass string `json:"pass"`
|
||||
InviteCommand string `json:"invite_command"`
|
||||
NickServ NickServ `json:"nickserv,omitempty"`
|
||||
//Channels []IrcChannel `json:"channels"`
|
||||
Channels []ChannelWithHealth `json:"channels"`
|
||||
//Channels []struct {
|
||||
// IrcChannel
|
||||
// ChannelHealth
|
||||
//} `json:"channels"`
|
||||
Connected bool `json:"connected"`
|
||||
ConnectedSince time.Time `json:"connected_since"`
|
||||
}
|
||||
|
||||
type ChannelWithHealth struct {
|
||||
ID int64 `json:"id"`
|
||||
Enabled bool `json:"enabled"`
|
||||
Name string `json:"name"`
|
||||
Password string `json:"password"`
|
||||
Detached bool `json:"detached"`
|
||||
Monitoring bool `json:"monitoring"`
|
||||
MonitoringSince time.Time `json:"monitoring_since"`
|
||||
LastAnnounce time.Time `json:"last_announce"`
|
||||
}
|
||||
|
||||
type ChannelHealth struct {
|
||||
Name string `json:"name"`
|
||||
Monitoring bool `json:"monitoring"`
|
||||
MonitoringSince time.Time `json:"monitoring_since"`
|
||||
LastAnnounce time.Time `json:"last_announce"`
|
||||
}
|
||||
|
||||
type IrcRepo interface {
|
||||
StoreNetwork(network *IrcNetwork) error
|
||||
UpdateNetwork(ctx context.Context, network *IrcNetwork) error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue