feat(downloads): ordered preferred_methods list honored for web tasks
The agent ignored its config.toml method preference for web-driven downloads (only the local `unarr download` command read it), and resolveMethod tried torrent first in auto mode — so a 'debrid only' user still got torrent tasks. - config: preferred_methods (ordered list, e.g. ["debrid","usenet"]) with MethodOrder() resolution; back-compat with the singular preferred_method. Methods absent from the list are disabled (debrid-only never torrents). - resolveMethod/tryFallback honor the config order (gating, no fallback to a method outside the list) over the per-task preference. - report preferred_methods on register so the web honors it (resolves debrid, gates the P2P stream fallback). - enable the usenet downloader when usenet is listed (it was never enabled). - config_menu: ordered presets (debrid-only, debrid→torrent, debrid→usenet…). Tests: resolveMethod gating + fallback within/outside the list.
This commit is contained in:
parent
523ecc724a
commit
c7ee0c0a28
8 changed files with 256 additions and 45 deletions
|
|
@ -41,6 +41,9 @@ type DaemonConfig struct {
|
|||
HWDevices []string // device files + driver bins detected at probe time
|
||||
AutoUpgrade bool // honor server-flagged upgrades by downloading + restarting (default: true)
|
||||
Downlink string // realtime downlink transport: "auto" (SSE+long-poll fallback) | "sse" | "poll"
|
||||
// PreferredMethods is the ordered download-method preference from config.toml
|
||||
// (e.g. ["debrid","usenet"]). Reported to the web so it honours the gating.
|
||||
PreferredMethods []string
|
||||
}
|
||||
|
||||
// Daemon manages agent registration and the sync loop.
|
||||
|
|
@ -165,6 +168,7 @@ func (d *Daemon) Register(ctx context.Context) error {
|
|||
VPNServer: d.vpnServer,
|
||||
FunnelURL: d.funnelURL,
|
||||
IsDocker: RunningInDocker(),
|
||||
PreferredMethods: d.cfg.PreferredMethods,
|
||||
}
|
||||
if free, total, err := DiskInfo(d.cfg.DownloadDir); err == nil {
|
||||
req.DiskFreeBytes = free
|
||||
|
|
|
|||
|
|
@ -64,6 +64,10 @@ type RegisterRequest struct {
|
|||
// self-update refuses to run in Docker). No omitempty: false (a binary
|
||||
// install) is a meaningful state the server must see to keep the button.
|
||||
IsDocker bool `json:"isDocker"`
|
||||
// PreferredMethods is the agent's ordered download-method preference from
|
||||
// config.toml (e.g. ["debrid","usenet"]). The web honours it so a "debrid
|
||||
// only" agent is never handed a torrent task. Empty/["auto"] → web decides.
|
||||
PreferredMethods []string `json:"preferredMethods,omitempty"`
|
||||
}
|
||||
|
||||
// RegisterResponse is returned by the server after registration.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue