added media fixes, search, push updates, pwa, metrics. preparing release 1.0
CI / Go (build + vet + test) (push) Canceled after 0s
CI / Web (build + lint) (push) Canceled after 0s

This commit is contained in:
vantablackTea
2026-09-27 23:26:15 +03:00
parent 855a62755c
commit 6fc6d977bf
59 changed files with 6823 additions and 113 deletions
+11
View File
@@ -8,6 +8,8 @@ import (
"sync"
"github.com/coder/websocket"
"messenger/internal/platform/metrics"
)
// MembershipProvider resolves conversation membership and read state.
@@ -145,6 +147,13 @@ func (h *Hub) PublishReactionChanged(conversationID, messageID, userID int64, em
h.sendToConversation(conversationID, envelope{Type: evtType, Data: mustMarshal(evt)}, 0)
}
// IsOnline reports whether a user has at least one active WebSocket connection.
func (h *Hub) IsOnline(userID int64) bool {
h.mu.Lock()
defer h.mu.Unlock()
return len(h.conns[userID]) > 0
}
func (h *Hub) register(c *client, conversationIDs []int64) {
h.mu.Lock()
defer h.mu.Unlock()
@@ -158,6 +167,7 @@ func (h *Hub) register(c *client, conversationIDs []int64) {
}
h.subs[cid][c.userID] = struct{}{}
}
metrics.RecordWS(1)
}
func (h *Hub) unregister(c *client, conversationIDs []int64) {
@@ -177,6 +187,7 @@ func (h *Hub) unregister(c *client, conversationIDs []int64) {
}
}
}
metrics.RecordWS(-1)
close(c.done)
}