mirror of
https://github.com/open-webui/open-webui.git
synced 2026-08-28 05:27:35 +00:00
refac
This commit is contained in:
parent
f4a0d3c973
commit
54d7a22370
5 changed files with 34 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
|||
<script lang="ts">
|
||||
import { getContext } from 'svelte';
|
||||
import { getPortProxyUrl } from '$lib/apis/terminal';
|
||||
import { settings } from '$lib/stores';
|
||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||
|
||||
const i18n = getContext('i18n');
|
||||
|
|
@ -268,7 +269,9 @@
|
|||
src={proxyUrl}
|
||||
title="Port {port} preview"
|
||||
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}
|
||||
/>
|
||||
{/key}
|
||||
|
|
|
|||
|
|
@ -274,6 +274,8 @@
|
|||
'iframe sandbox allow same origin',
|
||||
'iframesandboxallowforms',
|
||||
'iframesandboxallowsameorigin',
|
||||
'terminal preview allow same origin',
|
||||
'terminalpreviewallowsameorigin',
|
||||
'imagecompression',
|
||||
'image compression',
|
||||
'imagemaxcompressionsize',
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@
|
|||
let iframeSandboxAllowSameOrigin = false;
|
||||
let iframeSandboxAllowForms = true;
|
||||
let iframeSandboxAllowDownloads = true;
|
||||
let terminalPreviewAllowSameOrigin = true;
|
||||
|
||||
let showManageFloatingActionButtonsModal = false;
|
||||
let showManageImageCompressionModal = false;
|
||||
|
|
@ -310,6 +311,7 @@
|
|||
iframeSandboxAllowSameOrigin = currentSettings?.iframeSandboxAllowSameOrigin ?? false;
|
||||
iframeSandboxAllowForms = currentSettings?.iframeSandboxAllowForms ?? true;
|
||||
iframeSandboxAllowDownloads = currentSettings?.iframeSandboxAllowDownloads ?? true;
|
||||
terminalPreviewAllowSameOrigin = currentSettings?.terminalPreviewAllowSameOrigin ?? true;
|
||||
|
||||
stylizedPdfExport = currentSettings?.stylizedPdfExport ?? true;
|
||||
|
||||
|
|
@ -1307,6 +1309,29 @@
|
|||
</p>
|
||||
</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 class={settingRowClass}>
|
||||
<div id="stylized-pdf-export-label" class={settingLabelClass}>
|
||||
|
|
|
|||
|
|
@ -155,6 +155,7 @@
|
|||
"All Users": "",
|
||||
"All users and system events": "",
|
||||
"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 browser notifications for completed responses.": "",
|
||||
"Allow Call": "",
|
||||
|
|
@ -1400,6 +1401,7 @@
|
|||
"Idle Timeout": "",
|
||||
"iframe Sandbox Allow Forms": "",
|
||||
"iframe Sandbox Allow Same Origin": "",
|
||||
"Terminal Preview Allow Same Origin": "",
|
||||
"Image": "",
|
||||
"Image Compression": "",
|
||||
"Image Compression Height": "",
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ type Settings = {
|
|||
iframeSandboxAllowForms?: boolean;
|
||||
iframeSandboxAllowSameOrigin?: boolean;
|
||||
iframeSandboxAllowDownloads?: boolean;
|
||||
terminalPreviewAllowSameOrigin?: boolean;
|
||||
scrollOnBranchChange?: boolean;
|
||||
scrollOnResponseGeneration?: boolean;
|
||||
showFilesOnTerminalSelect?: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue