Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions docs/MTEAM_ADAPTER.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,12 @@ read capabilities:
- torrent search (`site search`).

Torrent detail and metafile download are not implemented yet; see
[Not supported yet](#not-supported-yet). The adapter has not had a credentialed
live smoke test in this repository; its tests use synthetic responses shaped
after the public API.
[Not supported yet](#not-supported-yet). The three reads were smoke-tested live
on 2026-10-16 with a newly created API key: `site status` reported
`authenticated`, `site account` read the profile, and `site search` returned
results in both table and JSON output. A creation time the API returned for that
key matched UTC+8, confirming how [times](#results) are read. The unit tests use
synthetic responses shaped after the public API.

## Getting an API key

Expand Down Expand Up @@ -145,7 +148,10 @@ ptctl metafile store import --store "$PTCTL_STORE" release.torrent

**Torrent detail.** `site detail` and live-site reconciliation seal a route
identity into their records. M-Team detail will be added together with the
download contract so both get one reviewed, versioned identity.
download contract so both get one reviewed, versioned identity. The website's
detail page reads `/api/torrent/detail`, whose answer includes the info hash,
and also calls `/api/torrent/viewHits`, which by its name records a view; an
adapter should send only the first.

**Everything else.** Bonus exchange, RSS, seeding lists, and messages are not
implemented.
Expand Down
6 changes: 6 additions & 0 deletions docs/guide/downloader.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ If the downloader refuses the login, the error names the usual cause:
`rpc-whitelist` does not include the caller (behind Docker that is the bridge
gateway, not 127.0.0.1) or while its anti-brute-force lock is active.

If nothing answers at all, for example because the downloader is stopped or
restarting or an SSH tunnel's far end refuses the connection, the error says
there was no response instead of naming a status. That is a reachability
problem: check that the downloader is running and the URL is reachable before
suspecting the password, and avoid retrying blindly toward the ban.

Adopt one exact materialized layout into qBittorrent or Transmission without
starting it. The default action adds an absent stopped job:

Expand Down
4 changes: 3 additions & 1 deletion internal/downloader/qbittorrent/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ func (s *readSession) login(ctx context.Context, credential downloader.Credentia
if contextErr := ctx.Err(); contextErr != nil {
return contextErr
}
return fmt.Errorf("qBittorrent login failed")
// Say that nothing answered, so an unreachable WebUI is not mistaken
// for rejected credentials and retried toward qBittorrent's ban.
return fmt.Errorf("qBittorrent login failed: no response from the WebUI; check that qBittorrent is running and reachable at the URL")
}
defer resp.Body.Close()
body, err := io.ReadAll(io.LimitReader(resp.Body, 1025))
Expand Down
7 changes: 5 additions & 2 deletions internal/downloader/qbittorrent/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,11 @@ func TestOpenReadSessionErrorRequestCounts(t *testing.T) {
if got, ok := downloader.RequestsMadeFromError(openErr); !ok || got != 1 {
t.Fatalf("request count=(%d, %t), want (1, true)", got, ok)
}
if strings.Contains(openErr.Error(), "CANARY-QBIT-PASSWORD") {
t.Fatalf("network error leaked credential: %v", openErr)
if strings.Contains(openErr.Error(), "CANARY-QBIT-PASSWORD") || strings.Contains(openErr.Error(), endpoint) {
t.Fatalf("network error leaked credential or endpoint: %v", openErr)
}
if !strings.Contains(openErr.Error(), "no response from the WebUI") {
t.Fatalf("network error does not say nothing answered: %v", openErr)
}
})

Expand Down
2 changes: 1 addition & 1 deletion internal/downloader/transmission/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ func (s *readSession) executeReader(ctx context.Context, body io.Reader, content
if contextErr := ctx.Err(); contextErr != nil {
return rawHTTPResponse{}, contextErr
}
return rawHTTPResponse{}, fmt.Errorf("Transmission request failed")
return rawHTTPResponse{}, fmt.Errorf("Transmission request failed: no response from the RPC endpoint; check that Transmission is running and reachable at the URL")
}
defer resp.Body.Close()
result := rawHTTPResponse{
Expand Down
3 changes: 3 additions & 0 deletions internal/downloader/transmission/adapter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ func TestOpenTransportFailureIsCountedAndRedacted(t *testing.T) {
t.Fatalf("open error leaked %q: %q", secret, err)
}
}
if !strings.Contains(err.Error(), "no response from the RPC endpoint") {
t.Fatalf("open error does not say nothing answered: %v", err)
}
}

func TestRejectedHandshakeNamesTheCause(t *testing.T) {
Expand Down
Loading