Changeset 0.20.0 (#85)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user