diff --git a/src/App.svelte b/src/App.svelte index 55473af..9072ad1 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -855,6 +855,28 @@ await navigator.clipboard.writeText(`${serverAddress}/overlay/${overlaySlug}`).catch(() => (overlayError = 'Copy was unavailable; select the URL manually.')); } + async function deleteOverlay() { + if (!selectedOverlayId || !window.confirm(`Permanently delete overlay “${overlayName}”? Its browser-source URL will stop serving content.`)) return; + overlayBusy = true; + overlayError = ''; + try { + const response = await fetch(`${serverAddress}/api/v1/overlays/${selectedOverlayId}`, { method: 'DELETE', headers: { authorization: `Bearer ${sessionToken}` } }); + if (!response.ok) throw new Error('The overlay could not be deleted.'); + selectedOverlayId = ''; + overlayName = ''; + overlaySlug = ''; + overlayHtml = ''; + overlayCss = ''; + overlayJavascript = ''; + pendingOverlayDraft = null; + await loadOverlays(); + } catch (error) { + overlayError = error instanceof Error ? error.message : 'The overlay could not be deleted.'; + } finally { + overlayBusy = false; + } + } + async function revokeOAuth(identity: 'streamer' | 'bot') { oauthBusy = true; oauthError = ''; @@ -1042,6 +1064,9 @@