add indexer setting

This commit is contained in:
Simon Ding
2024-07-09 15:36:29 +08:00
parent 684846fd88
commit 232042b1e3
7 changed files with 239 additions and 49 deletions

View File

@@ -6,6 +6,7 @@ import (
"polaris/log"
"polaris/pkg/torznab"
"polaris/pkg/transmission"
"strconv"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
@@ -48,6 +49,16 @@ func (s *Server) AddTorznabInfo(c *gin.Context) (interface{}, error) {
return nil, nil
}
func (s *Server) DeleteTorznabInfo(c *gin.Context) (interface{}, error) {
var ids = c.Param("id")
id, err := strconv.Atoi(ids)
if err != nil {
return nil, fmt.Errorf("id is not correct: %v", ids)
}
s.db.DeleteTorznab(id)
return "success", nil
}
func (s *Server) GetAllIndexers(c *gin.Context) (interface{}, error) {
indexers := s.db.GetAllTorznabInfo()
if len(indexers) == 0 {
@@ -124,4 +135,4 @@ func (s *Server) GetAllDonloadClients(c *gin.Context) (interface{}, error) {
return nil, fmt.Errorf("no download client")
}
return res, nil
}
}