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:
parent
29cf0a0126
commit
5e80911501
7 changed files with 981 additions and 53 deletions
|
|
@ -64,11 +64,20 @@ type Task struct {
|
|||
IMDbID string `json:"imdbId,omitempty"`
|
||||
PreferredMethod string `json:"preferredMethod"` // auto | debrid | usenet | torrent
|
||||
Mode string `json:"mode,omitempty"` // download | stream
|
||||
DirectURL string `json:"directUrl,omitempty"` // HTTPS download URL (debrid, etc.)
|
||||
DirectFileName string `json:"directFileName,omitempty"` // Original filename from direct URL
|
||||
}
|
||||
|
||||
// TasksResponse wraps the array of tasks returned by the server.
|
||||
type TasksResponse struct {
|
||||
Tasks []Task `json:"tasks"`
|
||||
Tasks []Task `json:"tasks"`
|
||||
StreamRequests []StreamRequest `json:"streamRequests,omitempty"`
|
||||
}
|
||||
|
||||
// StreamRequest is a request to stream a completed download from disk.
|
||||
type StreamRequest struct {
|
||||
TaskID string `json:"taskId"`
|
||||
FilePath string `json:"filePath"`
|
||||
}
|
||||
|
||||
// StatusUpdate is sent by the CLI to report download progress.
|
||||
|
|
@ -97,6 +106,25 @@ type StatusResponse struct {
|
|||
StreamRequested bool `json:"streamRequested,omitempty"`
|
||||
}
|
||||
|
||||
// HeartbeatResponse is returned by the server on heartbeat.
|
||||
type HeartbeatResponse struct {
|
||||
Success bool `json:"success"`
|
||||
Upgrade *UpgradeSignal `json:"upgrade,omitempty"`
|
||||
}
|
||||
|
||||
// UpgradeSignal tells the agent to upgrade to a specific version.
|
||||
type UpgradeSignal struct {
|
||||
Version string `json:"version"`
|
||||
}
|
||||
|
||||
// UpgradeResult is sent by the agent after an upgrade attempt.
|
||||
type UpgradeResult struct {
|
||||
AgentID string `json:"agentId"`
|
||||
Success bool `json:"success"`
|
||||
Version string `json:"version,omitempty"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// ErrorResponse is returned on API errors.
|
||||
type ErrorResponse struct {
|
||||
Error string `json:"error"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue