mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
cosmetics
This commit is contained in:
@@ -67,7 +67,7 @@ func torrents(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
case "list":
|
case "list":
|
||||||
{
|
{
|
||||||
listTorrent(req, c)
|
listTorrents(c)
|
||||||
}
|
}
|
||||||
case "drop":
|
case "drop":
|
||||||
{
|
{
|
||||||
@@ -75,7 +75,7 @@ func torrents(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
case "wipe":
|
case "wipe":
|
||||||
{
|
{
|
||||||
wipeTorrents(req, c)
|
wipeTorrents(c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ func remTorrent(req torrReqJS, c *gin.Context) {
|
|||||||
c.Status(200)
|
c.Status(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
func listTorrent(req torrReqJS, c *gin.Context) {
|
func listTorrents(c *gin.Context) {
|
||||||
list := torr.ListTorrent()
|
list := torr.ListTorrent()
|
||||||
if len(list) == 0 {
|
if len(list) == 0 {
|
||||||
c.JSON(200, []*state.TorrentStatus{})
|
c.JSON(200, []*state.TorrentStatus{})
|
||||||
@@ -198,7 +198,7 @@ func dropTorrent(req torrReqJS, c *gin.Context) {
|
|||||||
c.Status(200)
|
c.Status(200)
|
||||||
}
|
}
|
||||||
|
|
||||||
func wipeTorrents(req torrReqJS, c *gin.Context) {
|
func wipeTorrents(c *gin.Context) {
|
||||||
torrents := torr.ListTorrent()
|
torrents := torr.ListTorrent()
|
||||||
for _, t := range torrents {
|
for _, t := range torrents {
|
||||||
torr.RemTorrent(t.TorrentSpec.InfoHash.HexString())
|
torr.RemTorrent(t.TorrentSpec.InfoHash.HexString())
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ func SetupRoute(r gin.IRouter) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func proxy(c *gin.Context, u string, h ...string) {
|
func proxy(c *gin.Context, u string, h ...string) {
|
||||||
if u == "" {
|
if u == "" {
|
||||||
c.AbortWithStatus(http.StatusBadRequest)
|
c.AbortWithStatus(http.StatusBadRequest)
|
||||||
@@ -152,6 +153,7 @@ func proxy(c *gin.Context, u string, h ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func trn(h string) (st, sc string) {
|
func trn(h string) (st, sc string) {
|
||||||
if h := torr.GetTorrent(h); h != nil {
|
if h := torr.GetTorrent(h); h != nil {
|
||||||
if h := h.Status(); h != nil && h.Stat < 5 {
|
if h := h.Status(); h != nil && h.Stat < 5 {
|
||||||
@@ -168,6 +170,7 @@ func trn(h string) (st, sc string) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func msx(c *gin.Context, a any) {
|
func msx(c *gin.Context, a any) {
|
||||||
var r struct {
|
var r struct {
|
||||||
R struct {
|
R struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user