Skip to content

Commit ceccc1c

Browse files
webui : fix /props fetch to use base path for subpath deployments
1 parent 3288873 commit ceccc1c

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

tools/server/webui/src/lib/components/app/server/ServerErrorSplash.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script lang="ts">
2+
import { base } from '$app/paths';
23
import { AlertTriangle, RefreshCw, Key, CheckCircle, XCircle } from '@lucide/svelte';
34
import { goto } from '$app/navigation';
45
import { Button } from '$lib/components/ui/button';
@@ -64,7 +65,7 @@
6465
settingsStore.updateConfig('apiKey', apiKeyInput.trim());
6566
6667
// Test the API key by making a real request to the server
67-
const response = await fetch('./props', {
68+
const response = await fetch(`${base}/props`, {
6869
headers: {
6970
'Content-Type': 'application/json',
7071
Authorization: `Bearer ${apiKeyInput.trim()}`

tools/server/webui/src/lib/utils/api-key-validation.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { base } from '$app/paths';
12
import { error } from '@sveltejs/kit';
23
import { browser } from '$app/environment';
34
import { config } from '$lib/stores/settings.svelte';
@@ -22,7 +23,7 @@ export async function validateApiKey(fetch: typeof globalThis.fetch): Promise<vo
2223
headers.Authorization = `Bearer ${apiKey}`;
2324
}
2425

25-
const response = await fetch(`./props`, { headers });
26+
const response = await fetch(`${base}/props`, { headers });
2627

2728
if (!response.ok) {
2829
if (response.status === 401 || response.status === 403) {

tools/server/webui/src/routes/+layout.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
22
import '../app.css';
3+
import { base } from '$app/paths';
34
import { page } from '$app/state';
45
import { untrack } from 'svelte';
56
import { ChatSidebar, DialogConversationTitleUpdate } from '$lib/components/app';
@@ -144,7 +145,7 @@
144145
headers.Authorization = `Bearer ${apiKey.trim()}`;
145146
}
146147
147-
fetch(`./props`, { headers })
148+
fetch(`${base}/props`, { headers })
148149
.then((response) => {
149150
if (response.status === 401 || response.status === 403) {
150151
window.location.reload();

0 commit comments

Comments
 (0)