feat(downloads): live speeds and active/completed split on the download panel (DL-2)

- GET /download-tasks/board?state=active|completed: per-torrent dl/up speed,
  ETA, seeds/leechs, downloader total speed (transfer/info), counts for both
  groups, latest organize result (status, reason code, open decision)
- live qB data cached per instance for 2 s with in-flight coalescing
- panel: total speed line, 进行中 / 已完成 segments remembered locally,
  4 s polling while the page is visible, mobile layout, "—" for zero speed

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-29 21:44:34 +08:00
1 parent 8086250ec2
commit 3b340745bf
17 files changed
+1113 -93

No files matched your search

+14 -1
View File
@@ -31,6 +31,10 @@ export interface MockQbTorrent {
dlspeed: number;
upspeed: number;
eta: number;
num_seeds: number;
num_leechs: number;
num_complete: number;
num_incomplete: number;
ratio: number;
seeding_time: number;
infohash_v1: string;
@@ -171,6 +175,10 @@ export async function createMockQb(opts: MockQbOptions = {}): Promise<MockQb> {
dlspeed: 0,
upspeed: 0,
eta: 8640000,
num_seeds: 0,
num_leechs: 0,
num_complete: -1,
num_incomplete: -1,
ratio: 0,
seeding_time: 0,
infohash_v1: t.hash,
@@ -500,7 +508,12 @@ export async function createMockQb(opts: MockQbOptions = {}): Promise<MockQb> {
}),
"app/setPreferences": () => ({ status: 500, body: "mock: writing global preferences is not allowed" }),
"transfer/info": () => ({
body: JSON.stringify({ dl_info_speed: 0, up_info_speed: 0, connection_status: "connected" }),
// 与真实 qB 一致:全局速度是所有任务速度之和(不只是某个标签)
body: JSON.stringify({
dl_info_speed: [...torrents.values()].reduce((a, t) => a + t.dlspeed, 0),
up_info_speed: [...torrents.values()].reduce((a, t) => a + t.upspeed, 0),
connection_status: "connected",
}),
json: true,
}),
"torrents/tags": () => ({ body: JSON.stringify([...tagDefs]), json: true }),