enh: iframe sandbox policy setting

This commit is contained in:
Timothy Jaeryang Baek
2025-04-12 17:09:39 -07:00
parent af0d99b2a3
commit 0a69db291d
2 changed files with 62 additions and 3 deletions
+6 -2
View File
@@ -4,7 +4,7 @@
const i18n = getContext('i18n');
const dispatch = createEventDispatcher();
import { chatId, showArtifacts, showControls } from '$lib/stores';
import { chatId, settings, showArtifacts, showControls } from '$lib/stores';
import XMark from '../icons/XMark.svelte';
import { copyToClipboard, createMessagesList } from '$lib/utils';
import ArrowsPointingOut from '../icons/ArrowsPointingOut.svelte';
@@ -305,7 +305,11 @@
title="Content"
srcdoc={contents[selectedContentIdx].content}
class="w-full border-0 h-full rounded-none"
sandbox="allow-scripts allow-forms allow-same-origin"
sandbox="allow-scripts{($settings?.iframeSandboxAllowForms ?? false)
? ' allow-forms'
: ''}{($settings?.iframeSandboxAllowSameOrigin ?? false)
? ' allow-same-origin'
: ''}"
on:load={iframeLoadHandler}
></iframe>
{:else if contents[selectedContentIdx].type === 'svg'}