Merge branch 'master' into old-engine

This commit is contained in:
nikk gitanes
2023-02-02 20:51:51 +03:00
39 changed files with 1437 additions and 134 deletions

View File

@@ -39,6 +39,7 @@ func SetupRoute(route *gin.RouterGroup) {
route.GET("/playlist/*fname", playList)
route.GET("/download/:size", download)
route.GET("/search/*query", rutorSearch)
}
func shutdown(c *gin.Context) {

16
server/web/api/rutor.go Normal file
View File

@@ -0,0 +1,16 @@
package api
import (
"github.com/gin-gonic/gin"
"server/rutor"
"server/rutor/models"
)
func rutorSearch(c *gin.Context) {
query := c.Query("query")
list := rutor.Search(query)
if list == nil {
list = []*models.TorrentDetails{}
}
c.JSON(200, list)
}

View File

@@ -2,6 +2,7 @@ package api
import (
"net/http"
"server/rutor"
"github.com/gin-gonic/gin"
"github.com/pkg/errors"
@@ -11,7 +12,7 @@ import (
"server/torr"
)
//Action: get, set, def
// Action: get, set, def
type setsReqJS struct {
requestI
Sets *sets.BTSets `json:"sets,omitempty"`
@@ -34,11 +35,14 @@ func settings(c *gin.Context) {
if req.Sets.EnableDLNA {
dlna.Start()
}
rutor.Stop()
rutor.Start()
c.Status(200)
return
} else if req.Action == "def" {
torr.SetDefSettings()
dlna.Stop()
rutor.Stop()
c.Status(200)
return
}