feat(debrid): add HTTPS downloader for debrid direct URLs

DebridDownloader receives directUrl from the server and downloads via
plain HTTPS with progress reporting, resume (Range), and pause/cancel.

- Add DirectURL, DirectFileName to agent Task and engine Task types
- Implement DebridDownloader: HTTPS download with progress, resume, cancel
- HTTP client with 30s ResponseHeaderTimeout
- Safe shortID helper to prevent slice panic on short IDs
- Validate 416 against Content-Range server size for resume integrity
- Register debridDl in daemon and one-shot download command
- Tests: available, download, resume, cancel, pause, fallback filename,
  expired URL (410), unauthorized (401), shutdown, task propagation
This commit is contained in:
Deivid Soto 2026-03-28 18:09:34 +01:00
parent 29cf0a0126
commit 5e80911501
7 changed files with 981 additions and 53 deletions

View file

@ -88,6 +88,8 @@ func runDownload(input, method string) error {
5*time.Second,
)
debridDl := engine.NewDebridDownloader()
manager := engine.NewManager(engine.ManagerConfig{
MaxConcurrent: 1,
OutputDir: outputDir,
@ -96,7 +98,7 @@ func runDownload(input, method string) error {
MoviesDir: cfg.Organize.MoviesDir,
TVShowsDir: cfg.Organize.TVShowsDir,
},
}, reporter, torrentDl)
}, reporter, torrentDl, debridDl)
ctx, cancel := context.WithCancel(context.Background())
defer cancel()