diff --git a/src/spotify.js b/src/spotify.js index 709d428..d408e85 100644 --- a/src/spotify.js +++ b/src/spotify.js @@ -16,7 +16,7 @@ export async function loadSpotifyImporter() { if (S.cfg.backendUrl) { try { - const h = await fetch(`${S.cfg.backendUrl}/api/health`).then(r => r.json()); + const h = await fetch(`${S.cfg.backendUrl}/api/health`, { signal: AbortSignal.timeout(5000) }).then(r => r.json()); if (!h.spotify?.configured) { const input = document.getElementById('spotify-link-input'); if (input) { @@ -63,6 +63,7 @@ export async function resolveSpotifyLink() { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url }), + signal: AbortSignal.timeout(90000), }); if (!res.ok) { const err = await res.json().catch(() => ({})); @@ -74,6 +75,10 @@ export async function resolveSpotifyLink() { if (data.skippedLocal > 0) toast(`${data.skippedLocal} lokale Datei(en) übersprungen (kein Stream verfügbar)`); _renderSpotifyPreview(data); } catch(e) { + if (e.name === 'TimeoutError' || e.name === 'AbortError') { + inner.innerHTML = `