feat: Remove localStorage for game states and implement cross-domain player ID sync

- Remove localStorage for game states and statistics (backend only)
- Add API route to suggest player ID based on recently updated states
- Add async player ID lookup that finds existing IDs across domains
- When visiting a new domain, automatically find and use existing player ID
- Enables cross-domain synchronization between hoerdle.de and hördle.de
This commit is contained in:
Hördle Bot
2025-12-01 20:37:47 +01:00
parent 27fa689b18
commit 2846afb6f7
4 changed files with 154 additions and 89 deletions

View File

@@ -37,7 +37,9 @@ export async function loadPlayerState(
genreKey: string
): Promise<{ gameState: GameState; statistics: Statistics } | null> {
try {
const playerId = getOrCreatePlayerId();
// Use async version to enable cross-domain player ID sync
const { getOrCreatePlayerIdAsync } = await import('./playerId');
const playerId = await getOrCreatePlayerIdAsync(genreKey);
if (!playerId) {
return null;
}