Rendering robuster + sichtbare Fehlermeldung + no-cache

- crossOrigin von Asset-Images entfernt (haeufige Ursache fuer "tainted canvas",
  wodurch der Szenen-Export fehlschlug -> kaputtes Bild)
- toBlob mit Fallback auf toDataURL
- Ladefehler werden jetzt sichtbar im UI angezeigt (statt nur Konsole)
- Frontend mit Cache-Control: no-cache -> kein veraltetes JS/CSS nach git pull

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Guido
2026-08-04 18:58:51 +02:00
parent b95464670a
commit adc0fae93f
4 changed files with 62 additions and 8 deletions

View File

@@ -31,12 +31,30 @@ function showToast(message) {
showToast._t = setTimeout(() => toast.classList.remove('show'), 900);
}
function showError(err) {
let box = document.getElementById('error-box');
if (!box) {
box = document.createElement('div');
box.id = 'error-box';
stage.appendChild(box);
}
const msg = err && err.message ? err.message : String(err);
box.textContent = 'Fehler beim Laden der Szene: ' + msg;
box.classList.remove('hidden');
}
function clearError() {
const box = document.getElementById('error-box');
if (box) box.classList.add('hidden');
}
async function loadScene() {
showLoading(true);
clearError();
winOverlay.classList.add('hidden');
try {
const res = await fetch('/api/scene');
if (!res.ok) throw new Error('Szene konnte nicht geladen werden.');
if (!res.ok) throw new Error('Server-Antwort ' + res.status);
current = await res.json();
await scene.render(current);
scene.resetView();
@@ -44,7 +62,7 @@ async function loadScene() {
document.getElementById('category-name').textContent = current.category || '';
} catch (err) {
console.error(err);
showToast('Ups — Szene konnte nicht geladen werden.');
showError(err);
} finally {
showLoading(false);
}