feat: runtime config, Matomo analytics, chat accounts, DM history/search, and Prometheus retention
This commit is contained in:
1 parent
06ab5b4655
commit
121fdbacdc
27 files changed
+1841
-161
No files matched your search
@@ -93,6 +93,17 @@ func (h *Hub) Broadcast(msg db.Message) {
|
||||
}
|
||||
}
|
||||
|
||||
// BroadcastTyping notifies other users in the room that a user is typing.
|
||||
func (h *Hub) BroadcastTyping(username, room string) {
|
||||
h.mu.Lock()
|
||||
defer h.mu.Unlock()
|
||||
for conn, info := range h.clientMeta {
|
||||
if info.Room == room && info.Username != username {
|
||||
_ = conn.WriteJSON(db.Message{Room: room, Username: username, Text: "", Type: "typing", Timestamp: time.Now()})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// PushChatHistory sends the last N messages for a room via WebSocket.
|
||||
func (h *Hub) PushChatHistory(conn *websocket.Conn, room string, limit int) {
|
||||
if h.DB == nil || room == "" {
|
||||
@@ -224,6 +235,12 @@ func (h *Hub) HandleConnection(w http.ResponseWriter, r *http.Request) {
|
||||
continue
|
||||
}
|
||||
|
||||
// Handle typing indicator (ephemeral — not persisted, not rate-limited)
|
||||
if msg.Type == "typing" {
|
||||
h.BroadcastTyping(msg.Username, msg.Room)
|
||||
continue
|
||||
}
|
||||
|
||||
// Handle private DMs
|
||||
if strings.HasPrefix(msg.Room, "dm:") {
|
||||
h.handlePrivateDM(msg)
|
||||
|
||||
Reference in new issue
Block a user