The Activity is now the full bug.tv site plus a small Discord overlay. Whoever starts the instance hosts and controls everything; everyone else mirrors the host's page and playback. The server is a relay keyed by activity instance and checks membership through Discord's activity-instances API, so it works in DM and group calls. The bot gateway, slash commands and control message are gone.
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/wsrelay (one hub per Activity instance).activity/js/discord.js: the overlay. It handles the Discord SDK and auth, the WebSocket transport for bug.tv'sparty.js, the members pill, the viewer banner and input blocking. esbuild bundles it intodiscord.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