mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(irc): view announces per channel (#948)
* feat(irc): add sse to handler * feat(irc): view and send irc messages per network * refactor(irc): use id as handlerkey * refactor(irc): use id as handlerkey * feat(web): add irc context * refactor: create sse stream per network channel * fix(irc): remove non-working wildcard callback handler * feat: use fork of sse * chore(deps): update ergo/irc-go to v0.3.0 * fix: clean irc msg before sse publish * feat: add view channel button * feat: styling improvements * feat: show time
This commit is contained in:
parent
bbfcf303ef
commit
ccabe96bdf
14 changed files with 446 additions and 125 deletions
|
@ -5,6 +5,7 @@ package domain
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -85,10 +86,41 @@ type ChannelHealth struct {
|
|||
LastAnnounce time.Time `json:"last_announce"`
|
||||
}
|
||||
|
||||
type SendIrcCmdRequest struct {
|
||||
NetworkId int64 `json:"network_id"`
|
||||
Server string `json:"server"`
|
||||
Channel string `json:"channel"`
|
||||
Nick string `json:"nick"`
|
||||
Message string `json:"msg"`
|
||||
}
|
||||
|
||||
type IrcMessage struct {
|
||||
Channel string `json:"channel"`
|
||||
Nick string `json:"nick"`
|
||||
Message string `json:"msg"`
|
||||
Time time.Time `json:"time"`
|
||||
}
|
||||
|
||||
func (m IrcMessage) ToJsonString() string {
|
||||
j, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return string(j)
|
||||
}
|
||||
|
||||
func (m IrcMessage) Bytes() []byte {
|
||||
j, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return j
|
||||
}
|
||||
|
||||
type IrcRepo interface {
|
||||
StoreNetwork(network *IrcNetwork) error
|
||||
UpdateNetwork(ctx context.Context, network *IrcNetwork) error
|
||||
StoreChannel(networkID int64, channel *IrcChannel) error
|
||||
StoreChannel(ctx context.Context, networkID int64, channel *IrcChannel) error
|
||||
UpdateChannel(channel *IrcChannel) error
|
||||
UpdateInviteCommand(networkID int64, invite string) error
|
||||
StoreNetworkChannels(ctx context.Context, networkID int64, channels []IrcChannel) error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue