feat: real-time Federation panel updates via WS events

Added federation_peers_changed (no-payload signal) broadcast from every
peer state mutation, and federation_approval_request_received when a new
approval request is queued. Client subscribes via onFederationPeersChanged
callback registry. FederationPanel and PendingApprovals debounce-refetch
on any event. sendToAdmins helper broadcasts only to admin users.
This commit is contained in:
Jannis Braun
2026-04-20 18:28:10 +02:00
parent 6afad97bd1
commit 3d8709d20a
7 changed files with 95 additions and 0 deletions
+12
View File
@@ -876,6 +876,18 @@ class ConnectionManager {
return this.connections;
}
/** Send an event to all connected admin users. */
sendToAdmins(event: ServerEvent): void {
const db = getDb();
for (const userId of this.connections.keys()) {
const user = db.select({ isAdmin: schema.users.isAdmin })
.from(schema.users).where(eq(schema.users.id, userId)).get();
if (user?.isAdmin === 1) {
this.sendToUser(userId, event);
}
}
}
/** Push a fresh ready payload to a specific user, forcing full store re-sync. */
pushReadyPayload(userId: string): void {
const connections = this.getUserConnections(userId);