Fix: Build-Info über API statt Build-Zeit - korrekte Version/Channel-Anzeige zur Runtime
This commit is contained in:
parent
c44d9b7f87
commit
8662a5fbc0
2 changed files with 18 additions and 8 deletions
|
|
@ -333,7 +333,14 @@ app.use(express.json());
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
|
||||||
app.get('/api/health', (_req: Request, res: Response) => {
|
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 ---
|
// --- Admin Auth ---
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,7 @@ export default function App() {
|
||||||
const [chaosMode, setChaosMode] = useState<boolean>(false);
|
const [chaosMode, setChaosMode] = useState<boolean>(false);
|
||||||
const chaosTimeoutRef = useRef<number | null>(null);
|
const chaosTimeoutRef = useRef<number | null>(null);
|
||||||
const chaosModeRef = useRef<boolean>(false);
|
const chaosModeRef = useRef<boolean>(false);
|
||||||
|
const [buildInfo, setBuildInfo] = useState<{version: string, channel: string}>({version: '1.0.0', channel: 'stable'});
|
||||||
useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]);
|
useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
@ -50,6 +51,7 @@ export default function App() {
|
||||||
try {
|
try {
|
||||||
const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
|
const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
|
||||||
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
|
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
|
||||||
|
if (h && h.buildInfo) setBuildInfo(h.buildInfo);
|
||||||
} catch {}
|
} catch {}
|
||||||
})();
|
})();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
@ -115,6 +117,7 @@ export default function App() {
|
||||||
try {
|
try {
|
||||||
const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
|
const h = await fetch('/api/health').then(r => r.json()).catch(() => null);
|
||||||
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
|
if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
|
||||||
|
if (h && h.buildInfo) setBuildInfo(h.buildInfo);
|
||||||
} catch {}
|
} catch {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -255,8 +258,8 @@ export default function App() {
|
||||||
<h1 className="text-4xl font-bold">
|
<h1 className="text-4xl font-bold">
|
||||||
Jukebox 420
|
Jukebox 420
|
||||||
<div className="text-sm font-normal mt-1 opacity-70">
|
<div className="text-sm font-normal mt-1 opacity-70">
|
||||||
v{import.meta.env.VITE_APP_VERSION || '1.0.0'}
|
v{buildInfo.version}
|
||||||
{import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && (
|
{buildInfo.channel === 'nightly' && (
|
||||||
<span className="ml-2" style={{ color: '#ff4d4f' }}>• Nightly</span>
|
<span className="ml-2" style={{ color: '#ff4d4f' }}>• Nightly</span>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue