Move wipe to server side. Add UI unsafe buttons (#355)

* move 'remove all' function to server side ('wipe')

* add UnsafeButton to RemoveAll and CloseServer webui
This commit is contained in:
Alexey D. Filimonov
2024-02-15 09:14:58 +03:00
committed by GitHub
parent d1b29bd848
commit 5e71af9751
4 changed files with 55 additions and 19 deletions

View File

@@ -72,6 +72,10 @@ func torrents(c *gin.Context) {
{
dropTorrent(req, c)
}
case "wipe":
{
wipeTorrents(req, c)
}
}
}
@@ -184,3 +188,16 @@ func dropTorrent(req torrReqJS, c *gin.Context) {
torr.DropTorrent(req.Hash)
c.Status(200)
}
func wipeTorrents(req torrReqJS, c *gin.Context) {
torrents := torr.ListTorrent()
for _, t := range torrents {
torr.RemTorrent(t.TorrentSpec.InfoHash.HexString())
}
// TODO: remove (copied todo from remTorrent())
if set.BTsets.EnableDLNA {
dlna.Stop()
dlna.Start()
}
c.Status(200)
}