2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00
2026-10-27 10:00:34 -05:00

tv-discord

A Discord Activity for watching bug.tv together. The Activity is the whole bug.tv site with a small watch-party overlay on top. Whoever starts the Activity is the host and controls everything. Everyone else in the call follows the host's page and playback in sync, and can only change volume and fullscreen. If the host leaves, the next person to have joined takes over.

The contract is in docs/protocol.md.

Layout

  • src/server.js: static files, /api/config, /api/token (OAuth code exchange), /api/avatar/:id, and the /ws relay (one hub per Activity instance).
  • activity/js/discord.js: the overlay. It handles the Discord SDK and auth, the WebSocket transport for bug.tv's party.js, the members pill, the viewer banner and input blocking. esbuild bundles it into discord.js.
  • activity/overlay.css: the overlay styles.
  • scripts/build-activity.sh <bug-tv web dir> <out dir> [apiBase=/tv]: builds the Activity site.

Run

npm install
bash scripts/build-activity.sh ../tv/web site      # or nix build .#activity
cp config.example.json config.json                 # applicationId, tokenFile, clientSecretFile
npm start

The bot token is only used to check who is in an Activity instance; there is no gateway connection.

Discord URL mappings:

  • / → this server
  • /tv → api-tv.bug.tools
  • /tmdb → api.themoviedb.org
  • /img → image.tmdb.org

Dev without Discord: set "dev": true and "devApiUrl": "http://127.0.0.1:8789" (a local bug-tv API). Build the site with an absolute API base, or use the default /tv, which the dev server proxies. Then open /?user=1&instance=x and /?user=2&instance=x in two browsers.

Test

npm test
S
Description
No description provided
Readme
197 KiB
0 Stars 1 Watchers 0 Forks
Languages
JavaScript 75.7%
Nix 12.8%
CSS 7.8%
Shell 3.7%