From 31187736211dd3fe0137928d5efb3c88f8fc76f9 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Sun, 1 Feb 2026 11:05:30 -0500 Subject: [PATCH] Add explicit web seeds to torrent streams --- js/webtorrent.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/webtorrent.js b/js/webtorrent.js index 47f8eec6..e3b07b04 100644 --- a/js/webtorrent.js +++ b/js/webtorrent.js @@ -1035,6 +1035,15 @@ export class TorrentClient { chromeOptions.urlList = candidateUrls; } + const addExplicitWebSeeds = (torrent) => { + if (!candidateUrls.length || typeof torrent?.addWebSeed !== "function") { + return; + } + candidateUrls.forEach((url) => { + torrent.addWebSeed(url); + }); + }; + return new Promise((resolve, reject) => { // 3) Add the torrent to the client and handle accordingly. if (isFirefoxBrowser) { @@ -1044,6 +1053,7 @@ export class TorrentClient { { ...chromeOptions, maxWebConns: 4 }, (torrent) => { this.log("Torrent added (Firefox path):", torrent.name); + addExplicitWebSeeds(torrent); this.handleFirefoxTorrent(torrent, videoElement, resolve, reject); } ); @@ -1051,6 +1061,7 @@ export class TorrentClient { this.log("Starting torrent download (Chrome path)"); this.client.add(effectiveMagnetURI, chromeOptions, (torrent) => { this.log("Torrent added (Chrome path):", torrent.name); + addExplicitWebSeeds(torrent); this.handleChromeTorrent(torrent, videoElement, resolve, reject); }); }