Support filtering by size

This commit is contained in:
Ben Sarmiento
2024-01-06 23:53:47 +01:00
parent 4b441ce2d8
commit 5d733b8be4
5 changed files with 26 additions and 5 deletions

View File

@@ -77,6 +77,12 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
if dirCfg.OnlyShowTheBiggestFile && file.Bytes < biggestFileSize {
continue
}
if dirCfg.OnlyShowFilesWithSizeLte > 0 && file.Bytes > dirCfg.OnlyShowFilesWithSizeLte {
continue
}
if dirCfg.OnlyShowFilesWithSizeGte > 0 && file.Bytes < dirCfg.OnlyShowFilesWithSizeGte {
continue
}
filePath := filepath.Join(directory, torrentName, url.PathEscape(filename))
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s\">%s</a></li>", filePath, filename))
}