Standard-Theme sichtbar und Autoload repariert
This commit is contained in:
+19
-15
@@ -289,25 +289,29 @@
|
||||
(async () => {
|
||||
await updateAutoStatus();
|
||||
// Wenn noch kein Theme aktiv ist, versuche Standard-Theme zu laden
|
||||
const statusRes = await fetch('/api/soundboard/status');
|
||||
const statusData = await statusRes.json();
|
||||
let statusRes = await fetch('/api/soundboard/status');
|
||||
let statusData = await statusRes.json();
|
||||
if (!statusData.active && !statusData.current_theme) {
|
||||
await fetch('/api/soundboard/load_default', { method: 'POST' });
|
||||
statusRes = await fetch('/api/soundboard/status');
|
||||
statusData = await statusRes.json();
|
||||
}
|
||||
if (selectEl && selectEl.value) {
|
||||
const statusRes2 = await fetch('/api/soundboard/status');
|
||||
const statusData2 = await statusRes2.json();
|
||||
if (!statusData2.active || statusData2.current_theme !== selectEl.value) {
|
||||
loadSoundboard(selectEl.value);
|
||||
} else {
|
||||
const cur = await fetch('/api/soundboard/current');
|
||||
const curData = await cur.json();
|
||||
if (curData.soundboard) {
|
||||
currentSB = curData.soundboard;
|
||||
renderSoundboard(currentSB);
|
||||
content.style.display = 'block';
|
||||
}
|
||||
|
||||
if (statusData.current_theme) {
|
||||
const cur = await fetch('/api/soundboard/current');
|
||||
const curData = await cur.json();
|
||||
if (curData.soundboard) {
|
||||
currentSB = curData.soundboard;
|
||||
renderSoundboard(currentSB);
|
||||
content.style.display = 'block';
|
||||
}
|
||||
// Select auf aktuelles Theme setzen, falls vorhanden
|
||||
if (selectEl) {
|
||||
const opt = Array.from(selectEl.options).find(o => o.value === statusData.current_theme);
|
||||
if (opt) selectEl.value = opt.value;
|
||||
}
|
||||
} else if (selectEl && selectEl.value) {
|
||||
loadSoundboard(selectEl.value);
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user