now-playing: Navidrome "Listening to" service for Lotus Chat (cinny #491)
Lint / Shell (shellcheck) (push) Successful in 32s
Lint / JS (eslint) (push) Successful in 27s
Lint / No secrets in webhook configs (push) Successful in 13s
Lint / Python (ruff) (push) Successful in 13s
Lint / Secret scan (gitleaks) (push) Successful in 15s
Lint / Shell (shellcheck) (pull_request) Successful in 19s
Lint / No Hookshot webhook IDs in README (pull_request) Successful in 18s
Lint / JS (eslint) (pull_request) Successful in 24s
Lint / No secrets in webhook configs (pull_request) Successful in 13s
Lint / Landing page is rendered (matrix (pull_request) Successful in 12s
Lint / Python (ruff) (pull_request) Successful in 6s
Lint / Secret scan (gitleaks) (pull_request) Successful in 10s
Lint / Landing page is rendered (matrix (push) Successful in 6s
Lint / Python deps (pip-audit) (pull_request) Successful in 1m50s
Lint / Python deps (pip-audit) (push) Successful in 39s
Lint / No Hookshot webhook IDs in README (push) Successful in 7s

New lotus-now-playing service (LXC 151, :8072, NPM /now-playing/):
- polls Navidrome getNowPlaying every 10 s as a non-admin service user;
  Navidrome is the scrobbling master and Dropped Needle passes the real
  listener through, so entries are keyed by SSO username
- authenticates Lotus Chat with Matrix OpenID tokens (Synapse
  /_matrix/federation/v1/openid/userinfo, cached)
- maps Matrix users to SSO usernames: server-only override file, then the
  Synapse admin API (email <name>@lotusguild.org or the legacy
  plain-username external ID; Authelia opaque UUIDs are ignored)
- opt-in per user (off by default), stored in /var/lib/lotus-now-playing
- GET/PUT /v1/me, GET /v1/users?ids= (opted-in, matched, playing only),
  GET /v1/cover/<id> (no auth, but only covers being played by an
  opted-in user right now)
- never logs titles, artists or tokens

Also: systemd unit, install.sh, unit tests, ruff on now-playing/ in CI,
README section + port row, the outdated NPM note (routes now live in
proxy host 49's Advanced config), and cinny/config.json nowPlaying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
2026-11-16 23:31:37 -05:00
co-authored by Claude Opus 5.5
parent b3fec4af2a
commit 2da017476c
7 changed files with 767 additions and 3 deletions
+38
View File
@@ -0,0 +1,38 @@
[Unit]
Description=Now playing (Navidrome) for Lotus Chat "Listening to" cards
After=network-online.target matrix-synapse.service
Wants=network-online.target
[Service]
Type=simple
User=lotus-now-playing
Group=lotus-now-playing
# MATRIX_TOKEN (Synapse admin API, user lookups only), shared with voice-limit-guard.
EnvironmentFile=/etc/matrix-deploy.env
# NAVIDROME_USER / NAVIDROME_PASSWORD for the read-only lotus-nowplaying account.
EnvironmentFile=/etc/lotus-now-playing/env
Environment=NAVIDROME_URL=http://10.10.10.28:4533
Environment=SERVER_NAME=matrix.lotusguild.org
Environment=BIND_HOST=0.0.0.0
Environment=BIND_PORT=8072
Environment=STATE_DIR=/var/lib/lotus-now-playing
Environment=USERS_FILE=/etc/lotus-now-playing/users.json
StateDirectory=lotus-now-playing
StateDirectoryMode=0750
ExecStart=/usr/bin/python3 /opt/lotus-now-playing/lotus_now_playing.py
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=lotus-now-playing
MemoryMax=96M
CPUQuota=20%
NoNewPrivileges=yes
ProtectSystem=strict
ProtectHome=yes
PrivateTmp=yes
[Install]
WantedBy=multi-user.target