chore(version): Entfernt serverseitige Versions-/Build-Logik; Nightly-Badge bleibt im Header

This commit is contained in:
vibe-bot 2025-08-10 19:49:35 +02:00
parent 7a067aa95f
commit dda30d48fa
2 changed files with 3 additions and 19 deletions

View file

@ -37,9 +37,6 @@ const ALLOWED_GUILD_IDS = (process.env.ALLOWED_GUILD_IDS ?? '')
.split(',') .split(',')
.map((s) => s.trim()) .map((s) => s.trim())
.filter(Boolean); .filter(Boolean);
// Build/Version-Infos (zur Laufzeit verfügbar machen)
const BUILD_CHANNEL = String(process.env.VITE_BUILD_CHANNEL ?? process.env.BUILD_CHANNEL ?? 'stable');
const APP_VERSION = String(process.env.VITE_APP_VERSION ?? process.env.APP_VERSION ?? '1.0.0');
if (!DISCORD_TOKEN) { if (!DISCORD_TOKEN) {
console.error('Fehlende Umgebungsvariable DISCORD_TOKEN'); console.error('Fehlende Umgebungsvariable DISCORD_TOKEN');
@ -390,13 +387,7 @@ 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({ res.json({ ok: true, totalPlays: persistedState.totalPlays ?? 0, categories: (persistedState.categories ?? []).length });
ok: true,
totalPlays: persistedState.totalPlays ?? 0,
categories: (persistedState.categories ?? []).length,
version: APP_VERSION,
build: BUILD_CHANNEL
});
}); });
// --- Admin Auth --- // --- Admin Auth ---

View file

@ -53,8 +53,6 @@ export default function App() {
const [totalPlays, setTotalPlays] = useState<number>(0); const [totalPlays, setTotalPlays] = useState<number>(0);
const [mediaUrl, setMediaUrl] = useState<string>(''); const [mediaUrl, setMediaUrl] = useState<string>('');
const [chaosMode, setChaosMode] = useState<boolean>(false); const [chaosMode, setChaosMode] = useState<boolean>(false);
const [serverVersion, setServerVersion] = useState<string>('');
const [serverBuild, setServerBuild] = useState<string>('');
const chaosTimeoutRef = useRef<number | null>(null); const chaosTimeoutRef = useRef<number | null>(null);
const chaosModeRef = useRef<boolean>(false); const chaosModeRef = useRef<boolean>(false);
useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]); useEffect(() => { chaosModeRef.current = chaosMode; }, [chaosMode]);
@ -83,11 +81,7 @@ export default function App() {
try { const cats = await fetchCategories(); setCategories(cats.categories || []); } catch {} try { const cats = await fetchCategories(); setCategories(cats.categories || []); } catch {}
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) { if (h && typeof h.totalPlays === 'number') setTotalPlays(h.totalPlays);
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 {} } catch {}
})(); })();
}, []); }, []);
@ -334,9 +328,8 @@ export default function App() {
<div> <div>
<h1 className="text-4xl font-bold"> <h1 className="text-4xl font-bold">
Jukebox 420 Jukebox 420
{import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && ( {import.meta.env.VITE_BUILD_CHANNEL === 'nightly' && (
<div className="text-sm font-normal mt-1 opacity-70"> <div className="text-sm font-normal mt-1 opacity-70">
v{serverVersion || import.meta.env.VITE_APP_VERSION || ''}
<span className="ml-2" style={{ color: '#ff4d4f' }}> Nightly</span> <span className="ml-2" style={{ color: '#ff4d4f' }}> Nightly</span>
</div> </div>
)} )}