diff --git a/server/src/plugins/game-library/index.ts b/server/src/plugins/game-library/index.ts index 143ae97..f48d0bd 100644 --- a/server/src/plugins/game-library/index.ts +++ b/server/src/plugins/game-library/index.ts @@ -387,19 +387,29 @@ const gameLibraryPlugin: Plugin = { // ── GET /api/game-library/common-games?users=id1,id2,... ── app.get('/api/game-library/common-games', (req, res) => { - const userIds = String(req.query.users || '').split(',').filter(Boolean); - if (userIds.length < 2) { - res.status(400).json({ error: 'Mindestens zwei Steam-IDs erforderlich (users=id1,id2).' }); + const ids = String(req.query.users || '').split(',').filter(Boolean); + if (ids.length < 2) { + res.status(400).json({ error: 'Mindestens zwei Profile erforderlich (users=id1,id2).' }); return; } const data = loadData(ctx); - // Validate all users exist - for (const id of userIds) { - if (!data.users[id]) { - res.status(404).json({ error: `Benutzer ${id} nicht gefunden.` }); - return; + // Resolve profileIds → steamIds (profiles may be UUIDs from the multi-platform system) + const userIds: string[] = []; + for (const id of ids) { + if (data.users[id]) { + // Direct steamId (backwards compat) + userIds.push(id); + } else { + const profile = data.profiles[id]; + if (profile?.steamId && data.users[profile.steamId]) { + userIds.push(profile.steamId); + } else { + console.warn(`[GameLibrary] common-games: could not resolve id=${id}, profile=${!!profile}, steamId=${profile?.steamId}`); + res.status(404).json({ error: `Benutzer ${id} nicht gefunden oder kein Steam-Konto verknuepft.` }); + return; + } } } diff --git a/web/src/plugins/game-library/GameLibraryTab.tsx b/web/src/plugins/game-library/GameLibraryTab.tsx index 02d4c99..2f30c4d 100644 --- a/web/src/plugins/game-library/GameLibraryTab.tsx +++ b/web/src/plugins/game-library/GameLibraryTab.tsx @@ -390,9 +390,12 @@ export default function GameLibraryTab({ data }: { data: any }) { if (resp.ok) { const d = await resp.json(); setCommonGames(d.games || d); + } else { + console.error('[GameLibrary] common-games error:', resp.status, await resp.text().catch(() => '')); + setCommonGames([]); } - } catch { - /* silent */ + } catch (err) { + console.error('[GameLibrary] common-games fetch failed:', err); } finally { setLoading(false); }