Skip to content

Commit

Permalink
Matched setup page to style, CSP broke build so reverting to null, al…
Browse files Browse the repository at this point in the history
…so i18n isn't working on setup page right now
  • Loading branch information
reecelikesramen committed Jan 3, 2025
1 parent e03a6a9 commit 4662a58
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
}
],
"security": {
"csp": "default-src 'self'; connect-src 'self' ws: wss: http: https:;"
"csp": null
}
},
"bundle": {
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/chat/Settings/DesktopApp.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,10 @@
type="text"
readonly
value={$WEBUI_BASE_URL}
class="text-xs px-3 py-2.5 rounded-xl bg-gray-50 dark:bg-gray-800 dark:text-gray-200 focus:outline-none pr-24"
class="text-xs px-3 py-2.5 rounded-xl bg-gray-50 dark:bg-gray-850 dark:text-gray-200 focus:outline-none pr-24"
/>
<button
class="absolute right-1 flex text-xs items-center space-x-1 mr-1 px-3 py-1 rounded-lg bg-gray-100 hover:bg-gray-200 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-gray-200 transition"
class="absolute right-1 flex text-xs items-center space-x-1 mr-1 px-3 py-1 rounded-lg bg-gray-50 hover:bg-gray-100 dark:bg-gray-800 dark:hover:bg-gray-700 dark:text-gray-200 transition"
on:click={webUIBaseURLChangeHandler}
>
<div class="self-center font-medium line-clamp-1">{$i18n.t('Change')}</div>
Expand Down
69 changes: 55 additions & 14 deletions src/routes/setup/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
import { APP_STORE_FILE } from '$lib/app/constants';
import { WEBUI_BASE_URL } from '$lib/stores';
import { getStore } from '@tauri-apps/plugin-store';
import { onMount } from 'svelte';
import type { i18n as i18nType } from 'i18next';
import { getContext, onMount } from 'svelte';
import type { Writable } from 'svelte/store';
const i18n: Writable<i18nType> = getContext('i18n');
console.debug('On setup page');
Expand All @@ -28,8 +32,10 @@
}
};
$: $i18n.t('Sign in');
onMount(async () => {
console.log('SETUP PAGE MOUNTED');
console.debug('SETUP PAGE MOUNTED');
const store = await getStore(APP_STORE_FILE);
for (const key of (await store?.keys()) || []) {
if (key !== 'app_config' && key !== 'webui_base_url') {
Expand All @@ -47,19 +53,54 @@
});
</script>

<div class="flex flex-col items-center justify-center min-h-screen p-8 space-y-8">
<h1 class="text-4xl font-bold text-center">Welcome to Open WebUI</h1>
<div class="w-full h-screen max-h-[100dvh] relative bg-white dark:bg-gray-900">
<!-- <div class="w-full h-full absolute top-0 left-0 bg-white dark:bg-black z-[-1]"></div> -->

<div class="w-full max-w-md space-y-4">
<div class="text-center text-gray-600 dark:text-gray-400">
Please enter your instance base URL to get started
</div>
<div class="w-full h-full flex items-center justify-center">
<div class="w-full sm:max-w-md px-10 min-h-screen flex flex-col text-center">
<div class="my-auto pb-10 w-full dark:text-gray-100">
<h1 class="text-3xl font-bold mb-8 text-gray-900 dark:text-white">
Welcome to Open WebUI
<!-- {$i18n.t('Welcome to Open WebUI')} -->
</h1>

<input
bind:value={baseUrl}
placeholder="http://localhost:3000"
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
on:keydown={onKeyDown}
/>
<form
class="flex flex-col justify-center space-y-4"
on:submit|preventDefault={() => {
revealSplashScreen();
$WEBUI_BASE_URL = baseUrl;
}}
>
<div class="text-center text-gray-600 dark:text-gray-400 mb-4">
Please enter the base URL of your Open WebUI instance to get started
<!-- {$i18n.t('Please enter the base URL of your Open WebUI instance to get started')} -->
</div>

<div class="space-y-1">
<div class=" text-sm font-medium text-left mb-1">
WebUI Base URL
<!-- {$i18n.t('WebUI Base URL')} -->
</div>
<input
bind:value={baseUrl}
autocorrect="off"
autocomplete="url"
spellcheck="false"
on:keydown={onKeyDown}
placeholder="http://localhost:3000"
class="my-0.5 w-full text-sm outline-none bg-transparent"
/>
</div>

<button
class="bg-gray-700/5 hover:bg-gray-700/10 dark:bg-gray-100/5 dark:hover:bg-gray-100/10 dark:text-gray-300 dark:hover:text-white transition w-full rounded-full font-medium text-sm py-2.5"
type="submit"
>
<!-- {$i18n.t('Get Started')} -->
Get Started
</button>
</form>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion svelte.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: 'index.html'
fallback: 'app.html'
})
},
onwarn: (warning, handler) => {
Expand Down

0 comments on commit 4662a58

Please sign in to comment.