Skip to content

feat: admin-only manual torrent download (magnet link / .torrent upload) - #290

Open
zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:feat/manual-torrent-download
Open

feat: admin-only manual torrent download (magnet link / .torrent upload)#290
zpersichetti wants to merge 2 commits into
kikootwo:mainfrom
zpersichetti:feat/manual-torrent-download

Conversation

@zpersichetti

@zpersichetti zpersichetti commented Aug 28, 2026

Copy link
Copy Markdown

Summary

Lets admins attach a manually-supplied magnet link or .torrent file to a
request and hand it to the configured download client through the normal
pipeline — without relying on indexer search.

What changed

  • New POST /api/requests/[id]/manual-download route: accepts a multipart
    body (magnet field and/or .torrent file), validates it (info hash,
    5 MB cap), and queues a download job.
  • New ManualTorrentModal for pasting a magnet link or dropping a .torrent
    file.
  • "Manual Torrent" action in the admin request-actions dropdown, alongside
    Manual Search / Interactive Search.
  • "Manual Torrent" button on the audiobook details modal.

Access control (admin-only)

  • UI button gated to user.role === 'admin'.
  • API route enforces req.user.role === 'admin' server-side (403 for
    non-admins), so it can't be reached via a direct API call.
  • Only actionable statuses (pending, failed, awaiting_search,
    awaiting_release) accept a manual torrent; others return 409.

Testing

  • New route tests (requests-manual-download.routes.test.ts): auth, status
    gating, magnet/file validation, and job queueing.
  • Updated AudiobookDetailsModal tests for the admin-only gate.
  • tsc --noEmit clean; full suite passes (2667 passed, 0 failed).

zpersichetti and others added 2 commits August 28, 2026 20:01
Adds a "Manual Torrent" entry point so a user can attach a torrent they
found themselves to an existing request, bypassing Prowlarr search. The
supplied magnet (or a magnet derived server-side from an uploaded
.torrent) is queued as a normal download_torrent job, so monitoring,
organization and Plex/Audiobookshelf import are unchanged.

- POST /api/requests/[id]/manual-download (multipart/form-data): auth +
  ownership/admin checks, status guard (pending, failed, awaiting_search,
  awaiting_release), magnet/.torrent validation (<=5 MB), configured
  torrent-client check, job enqueue, request set to downloading.
- .torrent files are parsed with parse-torrent and converted to a magnet
  URI, keeping every download client on the existing magnet path - no
  download-client or processor changes needed.
- ManualTorrentModal (magnet input + .torrent drop zone) wired into the
  AudiobookDetailsModal action bar, gated by the same permission pattern
  as Interactive Search.
- Tests: route (auth/status/validation/happy paths), component
  (visibility rules, magnet submit, error surfacing), processor
  (manual-magnet candidate).
- Docs: phase3/manual-torrent-download.md + TABLEOFCONTENTS entries.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@zpersichetti zpersichetti changed the title feat: manual torrent download via magnet or .torrent upload feat: admin-only manual torrent download (magnet link / .torrent upload) Aug 29, 2026
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