auto-start fix

This commit is contained in:
2026-02-19 09:22:38 +01:00
parent e1f068f97f
commit f9804ecb00
2 changed files with 35 additions and 8 deletions
+21 -5
View File
@@ -269,10 +269,26 @@
}
// Autoload erstes Thema (falls vorhanden)
if (selectEl && selectEl.value) {
loadSoundboard(selectEl.value);
} else {
updateAutoStatus();
}
// Reihenfolge: Status prüfen, dann ggf. Theme laden
(async () => {
await updateAutoStatus();
if (selectEl && selectEl.value) {
// Wenn bereits ein Theme aktiv ist, nicht erneut laden (würde Auto stoppen)
const statusRes = await fetch('/api/soundboard/status');
const statusData = await statusRes.json();
if (!statusData.active || statusData.current_theme !== selectEl.value) {
loadSoundboard(selectEl.value);
} else {
// Theme-Daten nachladen ohne Auto zu stoppen
const cur = await fetch('/api/soundboard/current');
const curData = await cur.json();
if (curData.soundboard) {
currentSB = curData.soundboard;
renderSoundboard(currentSB);
content.style.display = 'block';
}
}
}
})();
</script>
{% endblock %}