release / go (push) Successful in 2m7s
release / web (push) Successful in 1m25s
release / govulncheck (push) Successful in 21s
release / integration (push) Successful in 4m30s
release / android (push) Successful in 4m39s
release / Build signed APK (push) Successful in 5m10s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 29s
release / Verify release artifacts (tag releases only) (push) Skipped
- Module path: github.com/Fabled-Sword/minstrel, in go.mod, every import and the Dockerfile's version ldflags. - buildinfo.ProjectURL, the contact outside services see in Minstrel's User-Agent: https://github.com/Fabled-Sword/minstrel. - README's compose example pulls ghcr.io/fabled-sword/minstrel:latest. - docs/security.md sends problem reports to the GitHub issues. - The demo-library stack builds Minstrel from the checkout, since :dev is not published to GHCR. - hygiene.go's same-site example uses example.com names. The workbench CI (.gitea/, ci/, export-ignored) still builds and publishes :dev to the private registry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
61 lines
2.1 KiB
Go
61 lines
2.1 KiB
Go
// Small helpers for posting live events to the SSE bus. Producers call
|
|
// these from their handler success paths so the wire shape stays in one
|
|
// place. Each helper is a no-op when h.eventbus is nil (tests that don't
|
|
// construct a bus); production always has one.
|
|
|
|
package api
|
|
|
|
import (
|
|
"github.com/Fabled-Sword/minstrel/internal/eventbus"
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
// publishLikeEvent broadcasts a track/album/artist like or unlike. The
|
|
// event is scoped to the user (so only their own clients invalidate); the
|
|
// payload includes the entity_type and entity_id so the dispatcher can
|
|
// invalidate the right query keys.
|
|
func (h *handlers) publishLikeEvent(userID, entityID pgtype.UUID, entityType string, liked bool) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
h.eventbus.Publish(eventbus.LikeChanged(uuidToString(userID), entityType, uuidToString(entityID), liked))
|
|
}
|
|
|
|
// publishQuarantineEvent broadcasts a quarantine action. User-side
|
|
// flag/unflag are scoped to the user; admin-side resolve / delete-file
|
|
// are broadcast (empty UserID) because a single admin
|
|
// action can affect every user who'd flagged that track — every client
|
|
// invalidates and the non-affected ones no-op when the query result
|
|
// matches their cache.
|
|
func (h *handlers) publishQuarantineEvent(kind string, userID, trackID pgtype.UUID, broadcast bool) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
scope := ""
|
|
if !broadcast {
|
|
scope = uuidToString(userID)
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: kind,
|
|
UserID: scope,
|
|
Data: map[string]any{
|
|
"track_id": uuidToString(trackID),
|
|
},
|
|
})
|
|
}
|
|
|
|
// publishSystemRebuilt notifies the owner's clients that their system
|
|
// playlists (and You-might-like rows) were regenerated, so they invalidate
|
|
// the home / system-playlist providers and a stale active queue can re-pull.
|
|
// Mirrors the daily scheduler's event; fired here from the manual refresh.
|
|
func (h *handlers) publishSystemRebuilt(userID pgtype.UUID) {
|
|
if h.eventbus == nil {
|
|
return
|
|
}
|
|
h.eventbus.Publish(eventbus.Event{
|
|
Kind: "playlist.system_rebuilt",
|
|
UserID: uuidToString(userID),
|
|
Data: map[string]any{},
|
|
})
|
|
}
|