Refactor torrent manager

This commit is contained in:
Ben Sarmiento
2023-11-09 02:34:04 +01:00
parent 9dfd6c32d5
commit 15a0ba95d8
14 changed files with 436 additions and 516 deletions

View File

@@ -35,9 +35,9 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
// If there are less than 3 segments, return an error or adjust as needed
if len(segments) <= 3 {
if isDav {
dav.HandlePropfindRequest(w, r, t, c, cache)
dav.HandlePropfindRequest(w, r, t, c)
} else {
intHttp.HandleDirectoryListing(w, r, t, c, cache)
intHttp.HandleDirectoryListing(w, r, t, c)
}
return
}
@@ -57,7 +57,7 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
return
}
torrent, file := getFile(torrents, filename)
_, file := getFile(torrents, filename)
if file == nil {
log.Errorf("Cannot find file from path %s", requestPath)
http.Error(w, "File not found", http.StatusNotFound)
@@ -75,7 +75,7 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
if resp == nil {
if !file.Unavailable {
log.Errorf("Cannot unrestrict file %s %s", filename, link)
t.HideTheFile(torrent, file)
// t.HideTheFile(torrent, file)
}
streamErrorVideo("https://www.youtube.com/watch?v=gea_FJrtFVA", w, r, t, c, log)
return