This commit is contained in:
Timothy Jaeryang Baek
2026-02-27 17:04:09 -06:00
parent 3a6c88ade9
commit 83b17e2ac8
2 changed files with 18 additions and 4 deletions
@@ -7,7 +7,9 @@
const dispatch = createEventDispatcher();
const i18n = getContext('i18n');
import { models, settings, user } from '$lib/stores';
import { models, settings, user, terminalServers } from '$lib/stores';
import { getTerminalServers } from '$lib/apis/terminal';
import { WEBUI_API_BASE_URL } from '$lib/constants';
import Switch from '$lib/components/common/Switch.svelte';
import Spinner from '$lib/components/common/Spinner.svelte';
@@ -69,6 +71,18 @@
if (res) {
toast.success($i18n.t('Terminal servers saved'));
// Refresh the terminalServers store so changes are reflected immediately
// Preserve user direct terminals, refresh system terminals from backend
const existingDirectTerminals = ($terminalServers ?? []).filter((t) => !t.id);
const systemTerminals = await getTerminalServers(localStorage.token);
const systemEntries = systemTerminals.map((t) => ({
id: t.id,
url: `${WEBUI_API_BASE_URL}/terminals/${t.id}`,
name: t.name,
key: localStorage.token
}));
terminalServers.set([...existingDirectTerminals, ...systemEntries]);
}
};
+3 -3
View File
@@ -168,10 +168,10 @@
}
// Fetch terminal servers the user has access to (for FileNav + terminal_id)
const backendTerminals = await getTerminalServers(localStorage.token);
if (backendTerminals.length > 0) {
const systemTerminals = await getTerminalServers(localStorage.token);
if (systemTerminals.length > 0) {
// Store with proxy URL and session key for FileNav file browsing
const terminalEntries = backendTerminals.map((t) => ({
const terminalEntries = systemTerminals.map((t) => ({
id: t.id,
url: `${WEBUI_API_BASE_URL}/terminals/${t.id}`,
name: t.name,