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:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/auth"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/db/dbq"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/eventbus"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/playevents"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/playlists"
|
||||
"git.fabledsword.com/bvandeusen/minstrel/internal/recommendation"
|
||||
@@ -34,11 +35,15 @@ import (
|
||||
//
|
||||
// startScan starts a library scan for an admin's startScan; nil leaves the
|
||||
// method answering that scanning is not available.
|
||||
func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, cfg Config, events *playevents.Writer, hops func() int, picker *recommendation.Picker, lists *playlists.Service, startScan StartScan) {
|
||||
//
|
||||
// bus carries a star or unstar made here to the web and Android apps, as
|
||||
// the native like endpoints do; nil tells no one.
|
||||
func Mount(r chi.Router, pool *pgxpool.Pool, logger *slog.Logger, cfg Config, events *playevents.Writer, bus *eventbus.Bus, hops func() int, picker *recommendation.Picker, lists *playlists.Service, startScan StartScan) {
|
||||
b := &browseHandlers{pool: pool}
|
||||
recall := newMixRecall()
|
||||
m := newMediaHandlers(pool, events, logger)
|
||||
m.recall = recall
|
||||
m.bus = bus
|
||||
u := &userHandlers{lookup: dbq.New(pool).GetUserByUsername, list: dbq.New(pool).ListUsers}
|
||||
sc := &scanHandlers{pool: pool, start: startScan}
|
||||
p := &pickHandlers{pool: pool, picker: picker, playlists: lists, logger: logger, recall: recall}
|
||||
|
||||
Reference in New Issue
Block a user