mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
The video's hosted CDN URL was added to WebTorrent's `urlList`, but a standalone hosted-file URL is only a valid BEP19 webseed for a SINGLE-file torrent. For a multi-file torrent WebTorrent treats it as a base directory and appends "<torrent name>/<file path>", producing a doubled URL that 404s on every request — the flood seen on e.g. archive.org videos. The CDN URL is no longer placed in urlList. It's forwarded separately as `hostedUrlWebSeed` and attached post-metadata (handleTorrentStream) via torrent.addWebSeed ONLY when the torrent is a single file, where the URL maps directly to the file. Multi-file torrents get no file-pointing webseed, so no flood. Magnet-declared `ws=` webseeds are unaffected (passed via urlList as before). With CDN-first, dual-source videos play the CDN directly anyway, so this only affects forced-torrent / URL-less paths. Tests: a single-file torrent receives the hosted URL via addWebSeed; a multi-file torrent does not. The single-file guard is mutation-verified. Co-Authored-By: Claude Opus 4.8 <[email protected]>