Limit active pieces and expose file list

This commit is contained in:
ookami125 2026-06-17 02:23:15 -04:00
parent ff8e0f5f5b
commit 6dc711cf57
6 changed files with 117 additions and 3 deletions

View file

@ -847,12 +847,14 @@ static json_t *map_torrent(json_t *torrent, bool detail, double dlspeed) {
json_t *peers_list = NULL;
json_t *hosts = NULL;
json_t *source_trackers = json_object_get(torrent, "trackers");
json_t *source_files = json_object_get(torrent, "files");
hosts = tracker_hosts(source_trackers);
if (detail) {
trackers = json_is_array(source_trackers)
? json_deep_copy(source_trackers) : json_array();
files = json_array();
if (files)
files = json_is_array(source_files)
? json_deep_copy(source_files) : json_array();
if (files && json_array_size(files) == 0 && total > 0)
json_array_append_new(files, json_pack(
"{s:s,s:I,s:f,s:i,s:f}", "name", name,
"size", (json_int_t)total, "progress", progress,