Changeset 0.20.0 (#85)

This commit is contained in:
2026-03-01 12:40:15 +00:00
parent eb74180611
commit 817062e5fc
57 changed files with 5435 additions and 72 deletions

View File

@@ -56,6 +56,10 @@ var routeTable = map[string]Direction{
// Role alerts (v0.17.0)
"role.fallback": DirToClient,
// Notifications (v0.20.0)
"notification.new": DirToClient, // targeted via Hub.SendToUser, not room-based
"notification.read": DirToClient, // badge sync across tabs
// Plugin hooks — never cross the wire
"plugin.hook.": DirLocal,
"internal.": DirLocal,
@@ -103,3 +107,12 @@ func ShouldAcceptFromClient(label string) bool {
d := RouteFor(label)
return d == DirFromClient || d == DirBoth
}
// MustJSON marshals v to json.RawMessage, returning {} on error.
func MustJSON(v any) json.RawMessage {
data, err := json.Marshal(v)
if err != nil {
return json.RawMessage(`{}`)
}
return data
}