v3: added opengraph support to the app, wrote README instructions incl. a Docker image

This commit is contained in:
khannurien
2026-03-26 19:55:48 +00:00
parent 0cb5a798c7
commit ca70bdc14b
26 changed files with 551 additions and 120 deletions

View File

@@ -35,6 +35,7 @@ interface WSProviderProps {
children: ReactNode;
token: string | null;
userId: string | null;
onForceLogout?: () => void;
}
const MAX_BACKOFF = 30_000;
@@ -54,7 +55,9 @@ function parseWSMessage(data: string): IncomingWSMessage | null {
}
}
export function WSProvider({ children, token, userId }: WSProviderProps) {
export function WSProvider(
{ children, token, userId, onForceLogout }: WSProviderProps,
) {
const [onlineUsers, setOnlineUsers] = useState<OnlineUser[]>([]);
const [voteCounts, setVoteCounts] = useState<Record<string, number>>({});
const [myVotes, setMyVotes] = useState<Set<string>>(new Set());
@@ -264,6 +267,10 @@ export function WSProvider({ children, token, userId }: WSProviderProps) {
break;
}
case "force_logout":
onForceLogout?.();
break;
case "error":
// On error, revert any pending optimistic update for the affected dump
// (the revert timeout will handle it)