Add debug symbols

This commit is contained in:
Ben Sarmiento
2023-11-28 21:38:48 +01:00
parent ee766dba6a
commit 606a19eca5
4 changed files with 44 additions and 29 deletions

View File

@@ -72,20 +72,10 @@ func handleListTorrents(w http.ResponseWriter, requestPath string, t *torrent.To
// initial response is the directory itself
fmt.Fprint(w, dav.BaseDirectory(basePath, ""))
var allTorrents []torrent.Torrent
torrents.IterCb(func(key string, tor *torrent.Torrent) {
if tor.AllInProgress() {
return
}
copy := *tor
copy.AccessKey = key
allTorrents = append(allTorrents, copy)
})
sort.Slice(allTorrents, func(i, j int) bool {
return allTorrents[i].AccessKey < allTorrents[j].AccessKey
})
for _, tor := range allTorrents {
allTorrents := torrents.Keys()
sort.Strings(allTorrents)
for _, accessKey := range allTorrents {
tor, _ := torrents.Get(accessKey)
fmt.Fprint(w, dav.Directory(tor.AccessKey, tor.LatestAdded))
}