feat: add Zenith, fix BTN, add IPTorrents & TorrentLeech adapters - #175
Open
clawdbrunner wants to merge 10 commits into
Open
feat: add Zenith, fix BTN, add IPTorrents & TorrentLeech adapters#175clawdbrunner wants to merge 10 commits into
clawdbrunner wants to merge 10 commits into
Conversation
### Zenith (znth.cx)
- New registry entry (UNIT3D platform)
- Uses existing Unit3dAdapter
### BroadcasTheNet (BTN)
- Fixed: was listed as Gazelle 'Unvalidated' — never worked
- New custom BTN JSON-RPC adapter (platform: 'btn')
- POST JSON-RPC to api.broadcasthe.net, maps Lumens→seedbonus
- Un-stucks the BTN entry — now fully functional
### IPTorrents (IPT)
- New custom adapter (cookie + HTML scrape)
- Parses .tTipWrap/.tTip header stats and .up-stat cards
- Credential format: {cookies, userAgent} JSON
### TorrentLeech (TL)
- New custom adapter (username/password login + HTML scrape)
- POSTs to /user/account/login/, captures tluid/tlpass cookies
- Parses .profile-*-details spans from profile page
- Credential format: {username, password} JSON
### Files
- 7 new files, 6 edited files
- All 2848 tests pass (78 new)
- TypeScript and biome lint clean
H1: mark Class, Lumens, Bonus, HnR, JoinDate as optional in BtnUserInfoResult. use nullish coalescing fallbacks in mapBtnResult so adapter degrades gracefully if BTN changes API response shape. H2: replace BigInt(parseInt()) with BigInt(string) to preserve full precision for byte values exceeding Number.MAX_SAFE_INTEGER. add test for missing optional fields scenario. Fixes: QA H1+H2
clawdbrunner
marked this pull request as ready for review
July 25, 2026 22:03
parseBytes: return 0n for ∞/Inf/-∞/-Inf values so UNIT3D trackers (e.g. zenith) that return infinite buffer don't crash the poll with 'Invalid byte format' error. iptorrents: inspect Location header on 302 rather than throwing session-expired on every redirect. iptorrents 302s logged-in users from / to /t — only throw when redirected to a login page. follow non-login redirects up to 3 hops. add 6 new tests (4 parseBytes ∞ variants, 2 ipt redirect). 2855 total tests pass, tsc clean. Fixes: 86bae41991a748
- H1: Handle infinity values case-insensitively (e.g. 'inf', 'INF'). - H2: Fix relative redirect resolution in IPTorrents fetchHtml. - Added tests for case-insensitive infinity and path-relative redirects. Fixes: 86bae41991a748
patrickdundas
added a commit
to patrickdundas/tracker-tracker
that referenced
this pull request
Jul 29, 2026
Integrate upstream PR jordanlambrecht#175 (TorrentLeech adapter + others)
Postgres freeleech_tokens/seedbonus columns are INTEGER; parseFloat on BTN's Bonus/Lumens fields produced decimals once tokens accrued fractional values, causing every snapshot INSERT to throw and BTN to auto-pause after 4 consecutive failed polls (failing since 2026-07-26). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…x stale test Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
qBittorrent 5.2.3RC returns 204 with an empty body on successful /api/v2/auth/login instead of the pre-5.2 200 "Ok." body, which was incorrectly treated as a failed login and surfaced as a generic "Connection failed" error. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
qBittorrent 5.2+ names its session cookie QBT_SID_<port> (its own
WebUI listen port baked into the name) instead of the legacy plain
SID, so the /SID=([^;]+)/ regex in login() never matched and auth
kept failing even after the 204-status fix. Widen it to match any
cookie whose name contains SID as a token.
Verified live against a 5.2+ instance that the server accepts the
session value back under any cookie name (only the value is
validated, not the name), so qbtFetch's Cookie: SID=${sid} header
needs no change.
… SID
qBittorrent 5.2+ rejects the session value when sent back under the wrong
cookie name (verified live: same SID value, QBT_SID_8080=<value> -> 200,
SID=<value> -> 403). login() now returns {name, value} captured from the
Set-Cookie regex match instead of just the value, and that pair is plumbed
through sidCache/getSession/withSessionRetry/qbtFetch so the Cookie header
uses the actual assigned name.
The regex-over-comma-joined-header approach could pick the wrong cookie (any name merely containing "SID", e.g. "SIDCC") and could bleed a cookie's value across a comma boundary into the next Set-Cookie entry when the SID cookie had no trailing attributes. getSetCookie() returns each Set-Cookie header as its own array element, so each is parsed as a single cookie and matched against an exact SID/QBT_SID_<port> name pattern.
Owner
|
@clawdbrunner your btn credentials are exposed! Unless you are permanently okay with your login info being used in our vitests haha src/lib/adapters/btn.test.ts, lines 19–21: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added Trackers
Zenith (znth.cx)
BroadcasTheNet (BTN)
btn)api.broadcasthe.net, methoduserInfoIPTorrents (IPT)
iptorrents.tTipWrap/.tTipheader stats bar from any authenticated page{"cookies":"...","userAgent":"..."}JSONTorrentLeech (TL)
torrentleech/user/account/login/, capturestluid/tlpasscookies.profile-*-detailsspans from profile page{"username":"...","password":"..."}JSONChanges
src/data/trackers/zenith.tssrc/data/trackers/broadcasthenet.tssrc/data/trackers/iptorrents.tssrc/data/trackers/torrentleech.tssrc/data/trackers/index.tssrc/lib/adapters/constants.tssrc/lib/adapters/btn.tssrc/lib/adapters/iptorrents.tssrc/lib/adapters/torrentleech.tssrc/lib/adapters/index.tssrc/lib/adapters/btn.test.tssrc/lib/adapters/iptorrents.test.tssrc/lib/adapters/torrentleech.test.tsTotal: 7 new files, 6 edited files
Tests: 2849 passing (78 new) at open; see update below
TypeScript: clean
Lint: clean
Integration testing complete — see update below.
Update 2 — Post-deployment fixes (2026-07-26)
After running this branch in production against live accounts, two edge cases surfaced and were fixed:
src/lib/parser.ts—parseBytes()now handles infinity values (∞,Inf,-∞,-Inf, case-insensitive) → returns0n. Zenith reports"buffer": "∞"for accounts with unlimited buffer, which previously threwInvalid byte format. (Touches shared parser — behavior for all other inputs unchanged, covered by 6 new tests.)src/lib/adapters/iptorrents.ts—fetchHtml()no longer treats every 302 as session expiry. IPTorrents 302s logged-in users from/→/t(normal behavior). Now inspects theLocationheader: only throws session-expired when it points at a login page; otherwise follows the redirect (bounded to 3 hops, relativeLocationvalues resolved vianew URL(loc, base)).Tests: 2858 passing | TypeScript: clean
Verified live against all four trackers on a production instance: Zenith ✅ BTN ✅ IPTorrents ✅ TorrentLeech ✅ — all polling real stats.