feat: add prowlarr enable button

This commit is contained in:
Simon Ding
2024-11-04 23:48:52 +08:00
parent 36b72e6461
commit bce4d93ab1
5 changed files with 35 additions and 13 deletions

View File

@@ -318,9 +318,11 @@ func (s *Server) SaveProwlarrSetting(c *gin.Context) (interface{}, error) {
if err := c.ShouldBindJSON(&in); err != nil {
return nil, err
}
client := prowlarr.New(in.ApiKey, in.URL)
if _, err := client.GetIndexers(prowlarr.TV); err != nil {
return nil, errors.Wrap(err, "connect to prowlarr error")
if !in.Disabled {
client := prowlarr.New(in.ApiKey, in.URL)
if _, err := client.GetIndexers(prowlarr.TV); err != nil {
return nil, errors.Wrap(err, "connect to prowlarr error")
}
}
err := s.db.SaveProwlarrSetting(&in)
if err != nil {