Add support for configs

This commit is contained in:
Ben Sarmiento
2023-10-18 21:09:25 +02:00
parent f9b5b1efac
commit 4650213218
19 changed files with 359 additions and 48 deletions

View File

@@ -27,10 +27,11 @@ func HandleGetRequest(w http.ResponseWriter, r *http.Request, t *torrent.Torrent
}
// Get the last two segments
baseDirectory := segments[len(segments)-3]
torrentName := segments[len(segments)-2]
filename := segments[len(segments)-1]
torrents := findAllTorrentsWithName(t, torrentName)
torrents := findAllTorrentsWithName(t, baseDirectory, torrentName)
if torrents == nil {
log.Println("Cannot find torrent", torrentName)
http.Error(w, "Cannot find file", http.StatusNotFound)