Skip to content

Add, list and remove Torznab indexers with torrential indexers - #120

Merged
nexxeln merged 3 commits into
nextfrom
feat/torznab-indexer-management
Nov 17, 2026
Merged

nexxeln merged 3 commits into
nextfrom
feat/torznab-indexer-management

Conversation

@nexxeln

@nexxeln nexxeln commented Nov 17, 2026

Copy link
Copy Markdown
Owner

torrential can now search private and local trackers without hand-editing YAML or exporting environment variables. A person runs Prowlarr or Jackett, adds the tracker there, and runs torrential indexers add <address> --key <key>.

What changes for the person:

  • sources.torznab entries take api_key: beside api_key_env:. One or the other; both is a config error that names the line. The login service passes only TORRENTIAL_HOME, so before this a keyed indexer stopped a service engine from starting. The error for an unset api_key_env now says to write the key as api_key.
  • config.yaml becomes readable by its owner alone (0600, or an owner-only access list on Windows) whenever a write leaves a key in it, including torrential setup on a file someone keyed by hand. The key never appears in Debug output, logs, errors, the list, or --json. A key pasted into the address (?apikey=) moves out of the URL.
  • torrential indexers add <url> [--name] [--key] asks the address for t=caps first and refuses with a plain reason: it needs a key, it refused the key (HTTP 401/403 or Torznab error 100 to 199), it answered HTTP 404 or a web page, or it cannot be reached. On success the engine writes the entry and searches it at once, with no restart. Running it again with a new key updates the entry instead of adding a second.
  • Prowlarr's or Jackett's own address imports every indexer it has: each enabled torrent indexer from Prowlarr's /api/v1/indexer as {prowlarr}/{id}/api, and each configured Jackett indexer from t=indexers as its own feed. Prowlarr is recognized by appName in /api/v1/system/status, so no flag is needed.
  • torrential indexers lists each entry, whether it answers now, where its key comes from, and its top-level categories. torrential indexers remove <name> takes one out, and out of sources.disabled. All three take --json.
  • The engine does the work (wire version 12), so torrential connect users manage the server's indexers. A paired device may; a stranger, a token no device holds, this machine's own token sent from another machine, and a removed device each get 401, and the test checks config.yaml is untouched after each.
  • Edits keep the rest of config.yaml, and inside the list each entry that stays keeps its lines and the comments above it. A list in a shape the editor does not handle (flow style) is rewritten as one block, after a re-read confirms the result.
  • README: a short "Private and local trackers" section. The agent skill gets one line.

How it was proved:

  • On a boxd machine, clippy with -D warnings and rustfmt pass, and so do the core, search, daemon (config, indexers, device refusals), binary unit, golden, CLI search, CLI indexers and remote tests.
  • Real Jackett and Prowlarr ran in Docker on loopback with public trackers only (The Pirate Bay, Nyaa). The engine ran as a systemd user service whose environment held no key variable. indexers add http://127.0.0.1:9117 --key … imported thepiratebay and nyaasi, and indexers add http://127.0.0.1:9696 --key … imported the-pirate-bay and nyaa.si. The service kept the same PID throughout, and config.yaml became mode 600 with the owner's comments and player: line intact.
  • With every built-in source disabled, titles sintel, sources tt1727587 and play tt1727587 --json all found Sintel (2010) through The Pirate Bay via Jackett. The stream URL served a Matroska header (1a45dfa3), and rm removed the play.
  • A wrong Prowlarr key, Jackett's dashboard URL and a closed port were each refused with a plain reason. The keys appeared 0 times in every command's output and 0 times in the service's journal.
  • No private tracker was logged into.

Windows: the change adds no platform code, and the owner-only write uses the existing write_private, so the Windows CI job is the check. A Windows machine has not run indexers by hand.

🤖 Generated with Claude Code

…hange at once

An indexer in config.yaml can now hold its key as api_key, beside api_key_env; both is a config error that names the line. The login service passes only TORRENTIAL_HOME, so an api_key_env indexer stopped a service engine from starting, and that error now says to write the key as api_key. Any write that leaves a key in config.yaml makes the file readable by its owner alone, and the key prints as redacted wherever it could reach a log.

Three new requests (wire version 12) let a paired device or this machine's torrential manage the indexers of the engine it drives. Adding asks the address for t=caps first and refuses with a plain reason; a Prowlarr or Jackett server's own address adds each of its indexers. The engine writes config.yaml keeping every other line and the comments of entries that stay, then swaps the search's source list without a restart.

Tests cover the key rules, the line-keeping edits, the file mode, caps parsing against Jackett's and Prowlarr's real answers, a reconfigured search, and a 401 for a stranger, a token no device holds, this machine's token from another machine, and a removed device, each leaving config.yaml unchanged.
…e it drives

`torrential indexers add <address> --key <key>` takes a Torznab feed or Prowlarr's or Jackett's own address, `torrential indexers` shows whether each answers and its categories, and `torrential indexers remove <name>` takes one out. Each takes --json, and through torrential connect each acts on the server's engine.

End-to-end tests run a stand-in Torznab indexer and a stand-in Prowlarr: refusals for a missing key, a wrong key, a 404, a web page and a closed port, a search that uses a new indexer with no restart, a Prowlarr import of only its enabled torrent indexers, and no key in any output or log. The remote test adds an indexer from a paired laptop and finds it in the server's config.yaml.

The README gets a short "Private and local trackers" section, and the agent skill one line.
@nexxeln
nexxeln merged commit 04a6b68 into next Nov 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant