From 01cfd448f021357d309295057151d6685c7cb919 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Thu, 30 Jan 2025 19:25:58 +0100 Subject: [PATCH] avoid embedding anything else than /embed --- website/src/lib/components/Map.svelte | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/website/src/lib/components/Map.svelte b/website/src/lib/components/Map.svelte index 85805e0c..ee015802 100644 --- a/website/src/lib/components/Map.svelte +++ b/website/src/lib/components/Map.svelte @@ -22,6 +22,7 @@ mapboxgl.accessToken = accessToken; let webgl2Supported = true; + let embeddedApp = false; let fitBoundsOptions: mapboxgl.FitBoundsOptions = { maxZoom: 15, linear: true, @@ -40,6 +41,10 @@ webgl2Supported = false; return; } + if (window.top !== window.self && !$page.route.id?.includes('embed')) { + embeddedApp = true; + return; + } let language = $page.params.language; if (language === 'zh') { @@ -208,14 +213,23 @@
-
+
-

{$_('webgl2_required')}

- + {#if !webgl2Supported} +

{$_('webgl2_required')}

+ + {:else if embeddedApp} +

The app cannot be embedded in an iframe.

+ + {/if}