Create a torrentMap

This commit is contained in:
Ben Sarmiento
2023-11-08 20:20:52 +01:00
parent 17cd7ae1f4
commit 9dfd6c32d5
16 changed files with 405 additions and 324 deletions

View File

@@ -15,8 +15,7 @@ import (
)
func HandlePropfindRequest(w http.ResponseWriter, r *http.Request, t *torrent.TorrentManager, c config.ConfigInterface, cache *expirable.LRU[string, string]) {
rlog := logutil.NewLogger()
log := rlog.Named("dav")
log := logutil.NewLogger().Named("dav")
requestPath := path.Clean(r.URL.Path)
requestPath = strings.Trim(requestPath, "/")

View File

@@ -18,12 +18,12 @@ func createMultiTorrentResponse(basePath string, torrents []torrent.Torrent) (*d
if item.Progress != 100 {
continue
}
if _, exists := seen[item.Name]; exists {
if _, exists := seen[item.AccessKey]; exists {
continue
}
seen[item.Name] = true
seen[item.AccessKey] = true
path := filepath.Join(basePath, item.Name)
path := filepath.Join(basePath, item.AccessKey)
responses = append(responses, dav.Directory(path))
}
@@ -39,7 +39,7 @@ func createSingleTorrentResponse(basePath string, torrents []torrent.Torrent) (*
var responses []dav.Response
// initial response is the directory itself
currentPath := filepath.Join(basePath, torrents[0].Name)
currentPath := filepath.Join(basePath, torrents[0].AccessKey)
responses = append(responses, dav.Directory(currentPath))
finalName := make(map[string]bool)