Repository navigation
fix(torrents): keep downloaded info hash in sync with the tracker - #51
Conversation
Downloads forced info.private = 1, which changes the info hash whenever the uploaded torrent was not private: clients then announced a hash the tracker did not know and got "Torrent not found or inactive". - make uploads private when stored and save the hash of the stored file - never modify the info dict on download (site and Torznab) - tell uploaders to seed the .torrent served by the site - override public tracker URLs at runtime (NUXT_PUBLIC_TRACKER_*) and build the image through compose so .env URLs are used instead of localhost Closes #49 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (9)
💤 Files with no reviewable changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthroughThe installer and Compose files now configure tracker URLs for the app service. Torrent uploads are normalized as private torrents without announce URLs, and personalized download endpoints leave the info dictionary unchanged. ChangesTracker URL configuration
Torrent normalization
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant Uploader
participant TorrentUploadEndpoint
participant normalizeTorrent
participant TorrentDatabase
Uploader->>TorrentUploadEndpoint: Upload torrent
TorrentUploadEndpoint->>normalizeTorrent: Normalize torrent bytes
normalizeTorrent-->>TorrentUploadEndpoint: Return bytes, info hash, madePrivate
TorrentUploadEndpoint->>TorrentDatabase: Store normalized bytes and info hash
TorrentUploadEndpoint-->>Uploader: Return upload response and seeding guidance
Merge Risk: ⚪ Minimal · up to No actionable issue remains identified; the change is mergeable after normal checks. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Out of Scope Changes checkExplanation The changes in Full details: Docstring CoverageExplanation Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Fixes the two problems reported in #49.
1. "Tracker error: Torrent not found or inactive"
On download, the site and the Torznab download set
info.private = 1. The info hash is the SHA-1 of the info dict, so for any torrent uploaded without the private flag, the downloaded file had a different hash from the one stored in the DB. The client then announced an unknown hash and got this error..torrentis normalized when stored (private = 1, announce URLs removed). The DB stores the hash of that file, which is exactly the one clients will announce..torrentserved by the site. If the private flag had to be added, the hash differs from their local file.2. Torrents pointing to
localhostruntimeConfig.public.trackerHttpUrlis evaluated at build time.install.shran a plaindocker buildwithout build args, sohttp://localhost:8080/announcewas baked into the image. The runtime envTRACKER_HTTP_URLwas ignored, because Nuxt only readsNUXT_PUBLIC_*at runtime.docker-compose.prod.ymlanddocker-compose.local.ymlnow setNUXT_PUBLIC_TRACKER_{HTTP,UDP,WS}_URLfrom.env. Existing installs only needdocker compose up -d, no rebuild.install.shnow builds throughdocker compose build app, so the.envURLs are passed as build args.Notes
.torrentfrom the site to seed it.Test plan
npx vitest run: 110 passing, including newnormalizeTorrenttests (public torrent → private, stored hash = hash of the served file)docker compose configpasses for prod;bash -n scripts/install.sh.torrent, download it from the site, and confirm the announce succeedsdocker compose up -dand confirm the downloaded.torrentuses the real tracker domainCloses #49
🤖 Generated with Claude Code
Summary by CodeRabbit