feat: improve Firefox torrent extension link capture and peer status
check / check (macos-latest) (push) Failing after 27s
check / check (ubuntu-latest) (push) Failing after 27s
check / check (windows-latest) (push) Failing after 27s

- Capture magnet links from data-magnet attributes and stop the page's own handlers from also firing on torrent and magnet links
- Treat .torrent URLs with fragments as torrent links
- Show tracker status, in-flight block counts, unchoked peer counts, and per-peer state in the torrent list
- Bump the extension to 0.1.2 and rebuild the .xpi
- Run the AppImage router with --debug
This commit is contained in:
nandi committed 2026-11-28 18:04:28 -08:00
1 parent 7a1b4325f9
commit 82aaa9f11e
5 files changed
+38 -10

No files matched your search

+16 -1
View File
@@ -108,6 +108,19 @@ async function refresh() {
const pct = Number(t.progress_pct || 0);
const toggleLabel = t.paused ? "Resume" : "Pause";
const toggleType = t.paused ? "resumeTorrent" : "pauseTorrent";
const infTxt = t.inflight_blocks > 0 ? ` (+${t.inflight_blocks} blks)` : "";
const trackerHtml = t.last_tracker_status
? `<div style="color:var(--muted);font-size:11px;">Tracker: ${escapeHtml(t.last_tracker_status)}</div>`
: "";
const peers = Array.isArray(t.peers) ? t.peers : [];
const peersHtml = peers.length
? `<div style="color:var(--muted);font-size:11px;font-family:monospace;line-height:1.4;">${peers
.map(
(p) =>
`<div>peer ${escapeHtml(p.b32)}${p.client ? ` [${escapeHtml(p.client)}]` : ""} · st=${escapeHtml(String(p.state ?? ""))} ${p.choking ? "choked" : "unchoked"} · ${p.pieces || 0} pcs · inf=${p.in_flight || 0} · blks=${p.blocks_recv || 0}</div>`
)
.join("")}</div>`
: "";
return `
<div class="torrent-item" data-ih="${escapeHtml(t.info_hash)}">
<div class="row" style="justify-content:space-between;">
@@ -116,12 +129,14 @@ async function refresh() {
</div>
<div class="progress-track"><div class="progress-fill" style="width:${pct}%"></div></div>
<div class="row" style="justify-content:space-between;color:var(--muted);font-size:11px;">
<span>${fmtBytes(t.downloaded_bytes)} / ${fmtBytes(t.total_length)} · ${t.have_pieces}/${t.num_pieces} pcs · ${t.connected_peers}/${t.known_peers} peers</span>
<span>${fmtBytes(t.downloaded_bytes)} / ${fmtBytes(t.total_length)} · ${t.have_pieces}/${t.num_pieces} pcs${infTxt} · ${t.connected_peers}/${t.known_peers} peers (${t.unchoked_peers || 0} unchoked)</span>
<span class="row">
<button class="secondary act-btn" data-act="${toggleType}" data-ih="${escapeHtml(t.info_hash)}">${toggleLabel}</button>
<button class="danger act-btn" data-act="removeTorrent" data-ih="${escapeHtml(t.info_hash)}">Remove</button>
</span>
</div>
${trackerHtml}
${peersHtml}
${t.error ? `<div class="msg err">${escapeHtml(t.error)}</div>` : ""}
</div>
`;