auto-start fix
This commit is contained in:
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user