From 02fcad6a8c2d2a5a72ab567ddbf99c0cd5676d17 Mon Sep 17 00:00:00 2001 From: ReaperOfVeriod Date: Sun, 25 Oct 2026 05:37:23 +0100 Subject: [PATCH] add confirmed overlay deletion --- src/App.svelte | 25 +++++++++++++++++++++++++ src/styles.css | 13 +++++++++++++ 2 files changed, 38 insertions(+) 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 @@
A newer unsaved draft is available for this overlay.
{/if} + {#if activeView === 'Overlays' && selectedOverlayId} +
OVERLAY LIFECYCLE
DELETION IS PERMANENT AND INVALIDATES THE BROWSER-SOURCE URL
+ {/if} {#if activeView === 'Overlays' && (selectedOverlayId || overlayName) && overlayVariableWarnings().length}
diff --git a/src/styles.css b/src/styles.css index f51adac..5d1e6d1 100644 --- a/src/styles.css +++ b/src/styles.css @@ -934,6 +934,19 @@ label { .overlay-diagnostics-panel { margin-top: 10px; } +.overlay-danger-panel { + margin-top: 10px; +} +.danger { + border: 1px solid var(--ed-danger); + background: transparent; + color: var(--ed-danger); + padding: 7px 12px; + font: inherit; +} +.danger:hover { + background: color-mix(in srgb, var(--ed-danger) 16%, transparent); +} .diagnostics-toggle { border: 0; background: transparent;