From 0ff31b0bfd765f6cf03a62b4d2ee4d52fc6ff437 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Sat, 25 May 2024 00:18:18 +0300 Subject: [PATCH] cosmetics --- server/web/api/torrents.go | 8 ++++---- server/web/msx/msx.go | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/web/api/torrents.go b/server/web/api/torrents.go index 3888339..ec5a974 100644 --- a/server/web/api/torrents.go +++ b/server/web/api/torrents.go @@ -67,7 +67,7 @@ func torrents(c *gin.Context) { } case "list": { - listTorrent(req, c) + listTorrents(c) } case "drop": { @@ -75,7 +75,7 @@ func torrents(c *gin.Context) { } case "wipe": { - wipeTorrents(req, c) + wipeTorrents(c) } } } @@ -176,7 +176,7 @@ func remTorrent(req torrReqJS, c *gin.Context) { c.Status(200) } -func listTorrent(req torrReqJS, c *gin.Context) { +func listTorrents(c *gin.Context) { list := torr.ListTorrent() if len(list) == 0 { c.JSON(200, []*state.TorrentStatus{}) @@ -198,7 +198,7 @@ func dropTorrent(req torrReqJS, c *gin.Context) { c.Status(200) } -func wipeTorrents(req torrReqJS, c *gin.Context) { +func wipeTorrents(c *gin.Context) { torrents := torr.ListTorrent() for _, t := range torrents { torr.RemTorrent(t.TorrentSpec.InfoHash.HexString()) diff --git a/server/web/msx/msx.go b/server/web/msx/msx.go index 477cac1..be01ae4 100644 --- a/server/web/msx/msx.go +++ b/server/web/msx/msx.go @@ -133,6 +133,7 @@ func SetupRoute(r gin.IRouter) { } }) } + func proxy(c *gin.Context, u string, h ...string) { if u == "" { c.AbortWithStatus(http.StatusBadRequest) @@ -152,6 +153,7 @@ func proxy(c *gin.Context, u string, h ...string) { } } } + func trn(h string) (st, sc string) { if h := torr.GetTorrent(h); h != nil { if h := h.Status(); h != nil && h.Stat < 5 { @@ -168,6 +170,7 @@ func trn(h string) (st, sc string) { } return } + func msx(c *gin.Context, a any) { var r struct { R struct {