Fix order of root http route
This commit is contained in:
@@ -17,6 +17,9 @@ func ServeRootDirectory(torMgr *torrent.TorrentManager) ([]byte, error) {
|
|||||||
var buf bytes.Buffer
|
var buf bytes.Buffer
|
||||||
buf.WriteString("<ol>")
|
buf.WriteString("<ol>")
|
||||||
directories := torMgr.DirectoryMap.Keys()
|
directories := torMgr.DirectoryMap.Keys()
|
||||||
|
if torMgr.Config.GetConfig().UseDownloadCache {
|
||||||
|
directories = append(directories, config.DOWNLOADS)
|
||||||
|
}
|
||||||
sort.Strings(directories)
|
sort.Strings(directories)
|
||||||
for _, directory := range directories {
|
for _, directory := range directories {
|
||||||
if strings.HasPrefix(directory, "int__") {
|
if strings.HasPrefix(directory, "int__") {
|
||||||
@@ -25,9 +28,6 @@ func ServeRootDirectory(torMgr *torrent.TorrentManager) ([]byte, error) {
|
|||||||
directoryPath := url.PathEscape(directory)
|
directoryPath := url.PathEscape(directory)
|
||||||
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s/\">%s</a></li>", directoryPath, directory))
|
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s/\">%s</a></li>", directoryPath, directory))
|
||||||
}
|
}
|
||||||
if torMgr.Config.GetConfig().UseDownloadCache {
|
|
||||||
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s/\">%s</a></li>", config.DOWNLOADS, config.DOWNLOADS))
|
|
||||||
}
|
|
||||||
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s\">%s</a></li>", version.FILE, version.FILE))
|
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s\">%s</a></li>", version.FILE, version.FILE))
|
||||||
|
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
|
|||||||
Api: api,
|
Api: api,
|
||||||
allAccessKeys: mapset.NewSet[string](),
|
allAccessKeys: mapset.NewSet[string](),
|
||||||
latestState: &LibraryState{},
|
latestState: &LibraryState{},
|
||||||
requiredVersion: "07.01.2024",
|
requiredVersion: "10.01.2024",
|
||||||
workerPool: p,
|
workerPool: p,
|
||||||
log: log,
|
log: log,
|
||||||
}
|
}
|
||||||
@@ -84,7 +84,7 @@ func NewTorrentManager(cfg config.ConfigInterface, api *realdebrid.RealDebrid, p
|
|||||||
offset += len(downloads)
|
offset += len(downloads)
|
||||||
page++
|
page++
|
||||||
if offset >= totalDownloads {
|
if offset >= totalDownloads {
|
||||||
t.log.Infof("Fetched %d downloads", t.DownloadCache.Count())
|
t.log.Infof("Compiled into %d downloads", t.DownloadCache.Count())
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user