feat(version): API /api/health liefert build/version; UI zeigt Server-Version im Nightly-Badge
This commit is contained in:
parent
c86f4f5875
commit
7a067aa95f
2 changed files with 18 additions and 3 deletions
|
|
@ -53,6 +53,8 @@ export default function App() {
|
|||
const [totalPlays, setTotalPlays] = useState<number>(0);
|
||||
const [mediaUrl, setMediaUrl] = useState<string>('');
|
||||
const [chaosMode, setChaosMode] = useState<boolean>(false);
|
||||
const [serverVersion, setServerVersion] = useState<string>('');
|
||||
const [serverBuild, setServerBuild] = useState<string>('');
|
||||
const chaosTimeoutRef = useRef<number | null>(null);
|
||||
const chaosModeRef = useRef<boolean>(false);
|
||||
useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]);
|
||||
|
|
@ -81,7 +83,11 @@ export default function App() {
|
|||
try { const cats = await fetchCategories(); setCategories(cats.categories || []); } 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) {
|
||||
if (typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
|
||||
if (typeof h.version === 'string') setServerVersion(h.version);
|
||||
if (typeof h.build === 'string') setServerBuild(h.build);
|
||||
}
|
||||
} catch {}
|
||||
})();
|
||||
}, []);
|
||||
|
|
@ -330,7 +336,7 @@ export default function App() {
|
|||
Jukebox 420
|
||||
{import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && (
|
||||
<div className="text-sm font-normal mt-1 opacity-70">
|
||||
v{import.meta.env.VITE_APP_VERSION || ''}
|
||||
v{serverVersion || import.meta.env.VITE_APP_VERSION || ''}
|
||||
<span className="ml-2" style={{ color: '#ff4d4f' }}>• Nightly</span>
|
||||
</div>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue