refac
This commit is contained in:
1 parent
f4a0d3c973
commit
54d7a22370
5 files changed
+34
-1
No files matched your search
@@ -1,6 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { getContext } from 'svelte';
|
import { getContext } from 'svelte';
|
||||||
import { getPortProxyUrl } from '$lib/apis/terminal';
|
import { getPortProxyUrl } from '$lib/apis/terminal';
|
||||||
|
import { settings } from '$lib/stores';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
@@ -268,7 +269,9 @@
|
|||||||
src={proxyUrl}
|
src={proxyUrl}
|
||||||
title="Port {port} preview"
|
title="Port {port} preview"
|
||||||
class="w-full h-full border-0 bg-white"
|
class="w-full h-full border-0 bg-white"
|
||||||
sandbox="allow-scripts allow-same-origin allow-forms allow-popups allow-modals allow-downloads"
|
sandbox="allow-scripts{($settings?.terminalPreviewAllowSameOrigin ?? true)
|
||||||
|
? ' allow-same-origin'
|
||||||
|
: ''} allow-forms allow-popups allow-modals allow-downloads"
|
||||||
on:load={onIframeLoad}
|
on:load={onIframeLoad}
|
||||||
/>
|
/>
|
||||||
{/key}
|
{/key}
|
||||||
|
|||||||
@@ -274,6 +274,8 @@
|
|||||||
'iframe sandbox allow same origin',
|
'iframe sandbox allow same origin',
|
||||||
'iframesandboxallowforms',
|
'iframesandboxallowforms',
|
||||||
'iframesandboxallowsameorigin',
|
'iframesandboxallowsameorigin',
|
||||||
|
'terminal preview allow same origin',
|
||||||
|
'terminalpreviewallowsameorigin',
|
||||||
'imagecompression',
|
'imagecompression',
|
||||||
'image compression',
|
'image compression',
|
||||||
'imagemaxcompressionsize',
|
'imagemaxcompressionsize',
|
||||||
|
|||||||
@@ -109,6 +109,7 @@
|
|||||||
let iframeSandboxAllowSameOrigin = false;
|
let iframeSandboxAllowSameOrigin = false;
|
||||||
let iframeSandboxAllowForms = true;
|
let iframeSandboxAllowForms = true;
|
||||||
let iframeSandboxAllowDownloads = true;
|
let iframeSandboxAllowDownloads = true;
|
||||||
|
let terminalPreviewAllowSameOrigin = true;
|
||||||
|
|
||||||
let showManageFloatingActionButtonsModal = false;
|
let showManageFloatingActionButtonsModal = false;
|
||||||
let showManageImageCompressionModal = false;
|
let showManageImageCompressionModal = false;
|
||||||
@@ -310,6 +311,7 @@
|
|||||||
iframeSandboxAllowSameOrigin = currentSettings?.iframeSandboxAllowSameOrigin ?? false;
|
iframeSandboxAllowSameOrigin = currentSettings?.iframeSandboxAllowSameOrigin ?? false;
|
||||||
iframeSandboxAllowForms = currentSettings?.iframeSandboxAllowForms ?? true;
|
iframeSandboxAllowForms = currentSettings?.iframeSandboxAllowForms ?? true;
|
||||||
iframeSandboxAllowDownloads = currentSettings?.iframeSandboxAllowDownloads ?? true;
|
iframeSandboxAllowDownloads = currentSettings?.iframeSandboxAllowDownloads ?? true;
|
||||||
|
terminalPreviewAllowSameOrigin = currentSettings?.terminalPreviewAllowSameOrigin ?? true;
|
||||||
|
|
||||||
stylizedPdfExport = currentSettings?.stylizedPdfExport ?? true;
|
stylizedPdfExport = currentSettings?.stylizedPdfExport ?? true;
|
||||||
|
|
||||||
@@ -1307,6 +1309,29 @@
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div class={settingRowClass}>
|
||||||
|
<div id="terminal-preview-allow-same-origin-label" class={settingLabelClass}>
|
||||||
|
{$i18n.t('Terminal Preview Allow Same Origin')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class={settingControlClass}>
|
||||||
|
<Switch
|
||||||
|
ariaLabelledbyId="terminal-preview-allow-same-origin-label"
|
||||||
|
tooltip={true}
|
||||||
|
bind:state={terminalPreviewAllowSameOrigin}
|
||||||
|
inherited={isDefaultSetting('terminalPreviewAllowSameOrigin')}
|
||||||
|
on:change={() => {
|
||||||
|
saveSettings({ terminalPreviewAllowSameOrigin });
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<p class={settingDescriptionClass}>
|
||||||
|
{$i18n.t('Allow terminal previews to access same-origin browser APIs.')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<div class={settingRowClass}>
|
<div class={settingRowClass}>
|
||||||
<div id="stylized-pdf-export-label" class={settingLabelClass}>
|
<div id="stylized-pdf-export-label" class={settingLabelClass}>
|
||||||
|
|||||||
@@ -155,6 +155,7 @@
|
|||||||
"All Users": "",
|
"All Users": "",
|
||||||
"All users and system events": "",
|
"All users and system events": "",
|
||||||
"Allow artifacts to access same-origin browser APIs inside the sandbox.": "",
|
"Allow artifacts to access same-origin browser APIs inside the sandbox.": "",
|
||||||
|
"Allow terminal previews to access same-origin browser APIs.": "",
|
||||||
"Allow automatic names for new chats.": "",
|
"Allow automatic names for new chats.": "",
|
||||||
"Allow browser notifications for completed responses.": "",
|
"Allow browser notifications for completed responses.": "",
|
||||||
"Allow Call": "",
|
"Allow Call": "",
|
||||||
@@ -1400,6 +1401,7 @@
|
|||||||
"Idle Timeout": "",
|
"Idle Timeout": "",
|
||||||
"iframe Sandbox Allow Forms": "",
|
"iframe Sandbox Allow Forms": "",
|
||||||
"iframe Sandbox Allow Same Origin": "",
|
"iframe Sandbox Allow Same Origin": "",
|
||||||
|
"Terminal Preview Allow Same Origin": "",
|
||||||
"Image": "",
|
"Image": "",
|
||||||
"Image Compression": "",
|
"Image Compression": "",
|
||||||
"Image Compression Height": "",
|
"Image Compression Height": "",
|
||||||
|
|||||||
@@ -250,6 +250,7 @@ type Settings = {
|
|||||||
iframeSandboxAllowForms?: boolean;
|
iframeSandboxAllowForms?: boolean;
|
||||||
iframeSandboxAllowSameOrigin?: boolean;
|
iframeSandboxAllowSameOrigin?: boolean;
|
||||||
iframeSandboxAllowDownloads?: boolean;
|
iframeSandboxAllowDownloads?: boolean;
|
||||||
|
terminalPreviewAllowSameOrigin?: boolean;
|
||||||
scrollOnBranchChange?: boolean;
|
scrollOnBranchChange?: boolean;
|
||||||
scrollOnResponseGeneration?: boolean;
|
scrollOnResponseGeneration?: boolean;
|
||||||
showFilesOnTerminalSelect?: boolean;
|
showFilesOnTerminalSelect?: boolean;
|
||||||
|
|||||||
Reference in new issue
Block a user