增加群聊置顶、免打扰和应用内提醒

This commit is contained in:
xhgit committed 2026-11-14 16:00:46 +08:00
1 parent ced6e9030d
commit f54077ce46
17 files changed
+228 -42

No files matched your search

+6 -2
View File
@@ -103,15 +103,19 @@ func (a *API) realtime(w http.ResponseWriter, r *http.Request) {
return
}
writeCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
event := map[string]string{"type": "contacts_changed"}
event := map[string]any{"type": "contacts_changed"}
switch change.Channel {
case groupsChannel:
event["type"] = "group_list_changed"
case inboxChannel:
event["type"] = "inbox_changed"
if group, found := strings.CutPrefix(change.Payload, "group:"); found && uuidPattern.MatchString(group) {
kind, group, _ := strings.Cut(change.Payload, ":")
if (kind == "group" || kind == "group-notify") && uuidPattern.MatchString(group) {
event["type"] = "group_changed"
event["groupId"] = group
if kind == "group-notify" {
event["notify"] = true
}
}
}
err := wsjson.Write(writeCtx, conn, event)