Fix: Gemeinsame Spiele - profileId zu steamId Resolution

Das Multi-Platform Profile System hatte den Common-Games-Endpoint
kaputt gemacht: Client sendete profileIds (UUIDs), Server erwartete
steamIds. Endpoint loest jetzt profileIds korrekt auf.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel 2026-03-09 00:47:34 +01:00
parent 7a05676037
commit ecd5e96ee2
2 changed files with 23 additions and 10 deletions

View file

@ -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;
}
}
}

View file

@ -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);
}