Async Download to Library with progress; Download to client

Backend:
- DownloadTask model + background thread runner: streams the file with
  progress (%, bytes, speed) and a cancel flag, then indexes it, names it
  J-<id>.<ext> and applies the e621 metadata
- DownloadTaskViewSet (create/retrieve/cancel) replaces the synchronous
  endpoint; the status footer's worker counts now reflect download jobs
- Client download proxy (/api/online/file/) streams an e621 original to
  the browser with Content-Disposition: attachment, restricted to the
  configured e621 CDN hosts so it cannot be used as an open proxy

Frontend:
- Online detail: progress bar with percentage, transferred size, speed
  and cancel while downloading; success links to the new J-ID
- New 'Download to client' button available to everyone (guests too)
This commit is contained in:
2026-09-17 12:06:15 -05:00
parent bf00cf36a2
commit 6962e483fc
11 changed files with 509 additions and 63 deletions
+15
View File
@@ -107,6 +107,21 @@ export interface FileNeighbors {
next: FileNeighbor | null;
}
export interface DownloadTask {
task_id: string;
post_id: number | null;
filename: string;
status: "pending" | "downloading" | "complete" | "error" | "cancelled";
progress: number;
downloaded: number;
total: number;
speed: number | null;
error: string;
library_j_id: string | null;
created_at: string;
updated_at: string;
}
export interface E621IqdbCandidate {
post_id: number | null;
score: number | null;