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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user