Skip to content

contrib: iris-youtube-accounts (Google-login account switcher for Iris)#4

Open
davidj4tech wants to merge 1 commit into
mainfrom
contrib-iris-youtube-accounts
Open

contrib: iris-youtube-accounts (Google-login account switcher for Iris)#4
davidj4tech wants to merge 1 commit into
mainfrom
contrib-iris-youtube-accounts

Conversation

@davidj4tech

Copy link
Copy Markdown
Owner

Adds contrib/iris-youtube-accounts/ — an optional, de-personalized add-on that puts a YouTube account switcher into Mopidy-Iris's sidebar: a popover to switch the active account + an "Add account" Google-login button + Remove, backed by this plugin's /mpv/ytadd|ytcb|ytdel routes.

What's included

  • README.md — setup (GCP device + web OAuth clients, HTTPS redirect via Tailscale Serve, wiring into Mopidy ExecStartPre), the request flow, env config, and a reference enumerator snippet.
  • iris-inject-accounts — injects a native-looking sidebar__menu__item + popover into Iris's served index.html via a MutationObserver (no Iris fork).
  • iris-inject-sw — patches Iris's cache-first service worker (skipWaiting + network-first navigation) so injected UI changes propagate without a manual cache clear.
  • yt-google-add — runs the Google login (device flow, or the fully code-free auth-code/redirect flow with a web client), writes an auto-refreshing token named after the channel, stamps its issuing client, and calls a pluggable YT_ACTIVATE_CMD.

Three reusable techniques documented

  1. Custom Iris nav with no fork (index.html injection + SW self-update).
  2. Enumerate a YouTube account's playlists via the Data API v3 (playlists.list?mine=true) — sidesteps ytmusicapi's InnerTube HTTP 400 for device tokens.
  3. A code-free OAuth redirect flow on a headless box using tailscale serve for the HTTPS redirect URI.

Notes

  • Backend handlers already live in mopidy_mpv/http.py; these scripts are the front-end + login tool, configurable via env (YT_OAUTH_DIR, YT_STATUS_DIR, YT_ACTIVATE_CMD, YT_PLAYLISTS_DIR, IRIS_YT_PORT).
  • The "turn a logged-in account into Mopidy playlists" step is intentionally pluggable (YT_ACTIVATE_CMD) — the README gives a reference Data-API enumerator to adapt.
  • Python files parse clean; the injected JS passes node --check.

🤖 Generated with Claude Code

Optional add-on, de-personalized from the author's setup, that adds a YouTube
account switcher to Mopidy-Iris's sidebar — a popover to switch accounts + an
"Add account" Google-login button + Remove — backed by this plugin's
/mpv/ytadd|ytcb|ytdel routes.

Ships three adaptable scripts and a README documenting the setup and the three
reusable techniques:
  - iris-inject-accounts: inject a native-looking sidebar item + popover into
    Iris's served index.html (MutationObserver; no Iris fork).
  - iris-inject-sw: make Iris's cache-first service worker self-update so
    injected UI changes propagate without a manual cache clear.
  - yt-google-add: run the Google login (device flow, or the fully code-free
    auth-code/redirect flow with a web client), write an auto-refreshing token
    named after the channel, and call a pluggable activate hook.

Config via env (YT_OAUTH_DIR / YT_STATUS_DIR / YT_ACTIVATE_CMD /
YT_PLAYLISTS_DIR / IRIS_YT_PORT). The playlist enumerator (Data API v3
playlists.list?mine=true) is documented as a reference snippet for you to wire
into your own backend.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant