mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-27 07:52:24 +00:00
feat(blossom): P2P for Blossom videos via a WebTorrent-metadata companion event (#30)
Blossom servers reject a .torrent (415), so a Blossom video's magnet is webseed-only and can't bootstrap WebTorrent. This restores P2P without hosting a .torrent: - Upload hardening: correct Content-Type (overrides empty/generic application/octet-stream), HTTP status surfaced in errors, and best-effort .torrent sidecar so a rejected sidecar no longer sinks the upload (URL-first fallback). - Publish: when the .torrent can't be hosted, publish the piece-map as an infohash-keyed companion event (kind 30078, d=bitvid:torrent:<infohash>) and ship a ws= magnet. Gated by FEATURE_BLOSSOM_TORRENT_METADATA (default off = no trace); size-capped. - Playback: torrentMetadataService lazily fetches the companion, VERIFIES the reconstructed infohash === the magnet's btih (untrusted content), sources the webseed from the video event, and hands the .torrent buffer to WebTorrent so it streams with zero peers. Relay reads go through the subscription manager. Inherited by any upload-based media (shorts, audio-publish); excludes ingest/live. See docs/blossom-torrent-metadata-plan.md. Includes a Prettier reflow in css/tailwind.source.css. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
56aff1ada0
commit
d23cfa6697
18 files changed
+1278
-25
No files matched your search
@@ -292,6 +292,23 @@ export const FEATURE_BITCOIN_CONNECT = true;
|
||||
*/
|
||||
export const FEATURE_BLOSSOM_STORAGE = true;
|
||||
|
||||
/**
|
||||
* FEATURE_BLOSSOM_TORRENT_METADATA — restore WebTorrent/P2P for Blossom-hosted
|
||||
* videos without hosting a `.torrent` file. Blossom servers reject a `.torrent`
|
||||
* (415), so a Blossom video's magnet ships webseed-only (no `xs=`) and can't
|
||||
* bootstrap WebTorrent. With this on, bitvid publishes the torrent piece-map as a
|
||||
* separate, infohash-keyed Nostr event (kind 30078, `d=bitvid:torrent:<infohash>`)
|
||||
* and fetches it lazily only when the torrent path actually runs.
|
||||
* See docs/blossom-torrent-metadata-plan.md.
|
||||
*
|
||||
* Defaults to `false` ("off = no trace"): off ⇒ no companion event is published
|
||||
* and the playback lookup is skipped (Blossom stays URL-only, exactly as today).
|
||||
*
|
||||
* Currently `true` for LOCAL testing of the companion-event flow — reset to
|
||||
* `false` (shipping default) before pushing/promoting.
|
||||
*/
|
||||
export const FEATURE_BLOSSOM_TORRENT_METADATA = true;
|
||||
|
||||
/**
|
||||
* Card liveness visibility policy — what a non-owner video card does while its
|
||||
* CDN/WebTorrent liveness probes are still running:
|
||||
|
||||
Reference in new issue
Block a user