mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(irc): manually re-process announces (#1419)
* fix(releases): add manual processing * feat(irc): add re-process button to channel msg * feat(irc): add missing client method * feat(web): change reprocess icon placement --------- Co-authored-by: martylukyy <35452459+martylukyy@users.noreply.github.com>
This commit is contained in:
parent
d9fc163655
commit
be05ffba73
15 changed files with 306 additions and 18 deletions
|
@ -36,6 +36,7 @@ type Service interface {
|
|||
UpdateNetwork(ctx context.Context, network *domain.IrcNetwork) error
|
||||
StoreChannel(ctx context.Context, networkID int64, channel *domain.IrcChannel) error
|
||||
SendCmd(ctx context.Context, req *domain.SendIrcCmdRequest) error
|
||||
ManualProcessAnnounce(ctx context.Context, req *domain.IRCManualProcessRequest) error
|
||||
}
|
||||
|
||||
type service struct {
|
||||
|
@ -408,6 +409,26 @@ func (s *service) GetNetworkByID(ctx context.Context, id int64) (*domain.IrcNetw
|
|||
return network, nil
|
||||
}
|
||||
|
||||
func (s *service) ManualProcessAnnounce(ctx context.Context, req *domain.IRCManualProcessRequest) error {
|
||||
network, err := s.repo.GetNetworkByID(ctx, req.NetworkId)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("failed to get network: %d", req.NetworkId)
|
||||
return err
|
||||
}
|
||||
|
||||
handler, ok := s.handlers[network.ID]
|
||||
if !ok {
|
||||
return errors.New("could not find irc handler with id: %d", network.ID)
|
||||
}
|
||||
|
||||
err = handler.sendToAnnounceProcessor(req.Channel, req.Message)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not send manual announce to processor")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) ListNetworks(ctx context.Context) ([]domain.IrcNetwork, error) {
|
||||
networks, err := s.repo.ListNetworks(ctx)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue