Skip to content

feat(torrent): export a torrent's magnet link and .torrent file - #666

Merged
linroid merged 2 commits into
mainfrom
feat/torrent-export
Nov 14, 2026
Merged

linroid merged 2 commits into
mainfrom
feat/torrent-export

Conversation

@linroid

@linroid linroid commented Nov 14, 2026

Copy link
Copy Markdown
Owner

What

The torrent control contract has reserved an export capability that nothing carried out. This implements it, so a torrent task can be shared with another client:

  • API: TorrentController.export(taskId, metainfo) answers a TorrentExport: the v1 and v2 info hashes, the name, the magnet link and, when asked for, the .torrent file (Base64, metainfoBytes()).
  • Engine: built from the metainfo the task kept (v1, v2 and hybrid, which exports both hashes), else from a magnet link that is still looking for its metadata, without its x.pe peers and so selection. A link that identifies nothing yet answers metadata_unavailable.
  • Server and remote: GET /api/torrents/{id}/export (?metainfo=true adds the file); RemoteKetch's controller fails closed against servers without the capability.
  • Apps: the inspector's details show Info hash and, for a torrent whose link is not already a magnet, Magnet link, each copied with a click. Translated in every language.
  • CLI: ketch export <id> prints the magnet link, --output <file> saves the .torrent file, --json prints the details.

The magnet link names the torrent's own trackers and web seeds, never the extra trackers of the settings. A private torrent has no magnet link: its trackers may carry a passkey and no peer would send its metadata; its .torrent file can still be saved, with a note on stderr.

Snapshots

Before After
Light
Dark

The sample torrent is a magnet, so only the Info hash row is new there; the Magnet link row shows for torrents added from a .torrent.

Testing

  • TorrentExportsTest (v1, v2, hybrid, private, magnet-only, unknown), KetchTorrentControllerTest, TorrentRoutesTest, RemoteTorrentControllerTest, InstanceArgsTest, InstanceCommandsTest, TorrentIdentityTest, NativeImageConfigTest
  • Localization, hard-coded text and design token checks; iOS and WasmJs compiles of the touched modules

Not verified: the native CLI binary was not rebuilt (its reflection metadata for the two new response types is added and checked by NativeImageConfigTest only).

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-14T03:53:26.515813Z c6cd0fd PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Nov 14, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.


🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 2 272 files  + 7   2 300 suites  +7   58m 37s ⏱️ +55s
16 134 tests +50  15 853 ✅ +49  281 💤 +1  0 ❌ ±0 
19 593 runs  +70  19 312 ✅ +69  281 💤 +1  0 ❌ ±0 

Results for commit 3f2d10b. ± Comparison against base commit aca4a27.

@linroid
linroid merged commit edf5327 into main Nov 14, 2026
14 checks passed
@linroid
linroid deleted the feat/torrent-export branch November 14, 2026 04:26
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