fix(events): a like made in a Subsonic app reaches the other apps, and an open web tab follows likes and playlist changes (#8077)

The native like endpoints announce a like on the event bus; Subsonic star
and unstar announced nothing, so the web and Android apps showed a stale
heart until they refetched. Subsonic now publishes the same events, through
one shape both surfaces build (eventbus.LikeChanged, eventbus.LedBy).

The web listened only for the nightly rebuild and notifications, so an open
tab ignored likes and playlist changes made in another tab, on Android or
in a Subsonic app. It now refreshes its liked views on any like event and
its playlists (and the open one) on playlist.created/updated/deleted/
tracks_changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-27 00:02:12 -05:00
co-authored by Claude Opus 5.5
parent 528ea9df0c
commit 8ba1d109c3
11 changed files with 204 additions and 51 deletions
+4
View File
@@ -18,6 +18,7 @@ import (
"git.fabledsword.com/bvandeusen/minstrel/internal/coverart"
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
"git.fabledsword.com/bvandeusen/minstrel/internal/eventbus"
"git.fabledsword.com/bvandeusen/minstrel/internal/playevents"
)
@@ -31,6 +32,9 @@ type mediaHandlers struct {
// recall credits a scrobble to the daily mix the app last opened
// (see mixRecall); nil credits nothing.
recall *mixRecall
// bus tells the web and Android apps about a star or unstar made here;
// nil (tests) tells no one.
bus *eventbus.Bus
}
func newMediaHandlers(pool *pgxpool.Pool, events *playevents.Writer, logger *slog.Logger) *mediaHandlers {