feat: stateless federated identity resolver + federation UX improvements

Add identity.ts with isSelf() and resolveDisplayIdentity() — pure
stateless functions that detect replicated-self using the immutable
(username, homeInstance) composite key. No store lookups, no data
mutation. Fixes wrong avatar gradient and missing edit/delete on
own messages in remote channels.

Also includes: optimistic message dedup fix for cross-instance
messages (content-only matching), federation toast notifications,
Username component with @domain display, invite parser, and
deploy script simplification.
This commit is contained in:
Jannis Braun
2026-03-04 03:37:49 +01:00
parent 64fd8edfc9
commit dca9c4dc83
19 changed files with 713 additions and 110 deletions
+13
View File
@@ -107,6 +107,13 @@ function handleEvent(origin: string, event: ServerEvent): void {
populateFromReady(origin, event.servers, event.folders, event.dmChannels);
// Mark remote instance as connected in instanceStore
if (!isHome) {
import('../stores/instanceStore').then(({ useInstanceStore }) => {
useInstanceStore.getState().setInstanceStatus(origin, 'connected');
});
}
if (isHome && currentServerId) {
loadServerDetail(currentServerId);
}
@@ -518,6 +525,12 @@ function connectToOrigin(origin: string, token: string): void {
ws.onclose = () => {
conn.ws = null;
stopHeartbeat(conn);
// Mark remote instance as disconnected in instanceStore
if (origin !== HOME_ORIGIN) {
import('../stores/instanceStore').then(({ useInstanceStore }) => {
useInstanceStore.getState().setInstanceStatus(origin, 'disconnected', 'Connection lost — reconnecting');
});
}
// Only reconnect if the connection is still registered (not explicitly disconnected)
if (connections.has(origin) && conn.token) {
const delay = Math.min(1000 * Math.pow(2, conn.reconnectAttempts), 30000);