Add setting for hiding broken torrents

This commit is contained in:
Ben Adrian Sarmiento
2024-07-06 23:56:12 +02:00
parent acd18aca9a
commit 1373bbb975
5 changed files with 20 additions and 5 deletions

View File

@@ -220,7 +220,7 @@ func (hs *Handlers) handleInfuseTorrentsList(resp http.ResponseWriter, req *http
// handle files list request
func (hs *Handlers) innerFilesListHandler(resp http.ResponseWriter, req *http.Request, handleFunc func(string, string, *torrent.TorrentManager) ([]byte, error), contentType string) {
func (hs *Handlers) innerFilesListHandler(resp http.ResponseWriter, req *http.Request, handleFunc func(string, string, *torrent.TorrentManager, bool) ([]byte, error), contentType string) {
directory, err := url.PathUnescape(chi.URLParam(req, "directory"))
if err != nil {
directory = chi.URLParam(req, "directory")
@@ -229,7 +229,7 @@ func (hs *Handlers) innerFilesListHandler(resp http.ResponseWriter, req *http.Re
if err != nil {
torrentName = chi.URLParam(req, "torrent")
}
out, err := handleFunc(directory, torrentName, hs.torMgr)
out, err := handleFunc(directory, torrentName, hs.torMgr, hs.cfg.ShouldHideBrokenTorrents())
if err != nil && strings.Contains(contentType, "xml") {
hs.log.Debugf("Not implemented: %s %s", req.Method, req.URL)
resp.WriteHeader(http.StatusNotImplemented)