From 8662a5fbc00a0bbf88e0574439945758b5fd4441 Mon Sep 17 00:00:00 2001 From: vibe-bot Date: Sat, 9 Aug 2025 16:07:52 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Build-Info=20=C3=BCber=20API=20statt=20B?= =?UTF-8?q?uild-Zeit=20-=20korrekte=20Version/Channel-Anzeige=20zur=20Runt?= =?UTF-8?q?ime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/index.ts | 9 ++++++++- web/src/App.tsx | 17 ++++++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/server/src/index.ts b/server/src/index.ts index 8abbf67..d9bfed0 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -333,7 +333,14 @@ app.use(express.json()); app.use(cors()); app.get('/api/health', (_req: Request, res: Response) => { - res.json({ ok: true, totalPlays: persistedState.totalPlays ?? 0 }); + res.json({ + ok: true, + totalPlays: persistedState.totalPlays ?? 0, + buildInfo: { + version: process.env.VITE_APP_VERSION || '1.0.0', + channel: process.env.VITE_BUILD_CHANNEL || 'stable' + } + }); }); // --- Admin Auth --- diff --git a/web/src/App.tsx b/web/src/App.tsx index fc4a049..544e402 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -30,6 +30,7 @@ export default function App() { const [chaosMode, setChaosMode] = useState(false); const chaosTimeoutRef = useRef(null); const chaosModeRef = useRef(false); + const [buildInfo, setBuildInfo] = useState<{version: string, channel: string}>({version: '1.0.0', channel: 'stable'}); useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]); useEffect(() => { @@ -46,11 +47,12 @@ export default function App() { } catch (e: any) { setError(e?.message || 'Fehler beim Laden der Channels'); } - try { setIsAdmin(await adminStatus()); } catch {} - try { - const h = await fetch('/api/health').then(r => r.json()).catch(() => null); - if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays); - } catch {} + try { setIsAdmin(await adminStatus()); } catch {} + try { + const h = await fetch('/api/health').then(r => r.json()).catch(() => null); + if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays); + if (h && h.buildInfo) setBuildInfo(h.buildInfo); + } catch {} })(); }, []); @@ -115,6 +117,7 @@ export default function App() { try { const h = await fetch('/api/health').then(r => r.json()).catch(() => null); if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays); + if (h && h.buildInfo) setBuildInfo(h.buildInfo); } catch {} }; @@ -255,8 +258,8 @@ export default function App() {

Jukebox 420
- v{import.meta.env.VITE_APP_VERSION || '1.0.0'} - {import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && ( + v{buildInfo.version} + {buildInfo.channel === 'nightly' && ( • Nightly )}