Skip to content
This repository was archived by the owner on Jan 13, 2026. It is now read-only.

Commit e3769c1

Browse files
committed
refac
1 parent d78fe4d commit e3769c1

File tree

3 files changed

+58
-5
lines changed

3 files changed

+58
-5
lines changed

backend/open_webui/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ async def lifespan(app: FastAPI):
420420
app.state.config = AppConfig()
421421

422422
app.state.WEBUI_NAME = WEBUI_NAME
423-
app.state.LICENSE_DATA = None
423+
app.state.LICENSE_METADATA = None
424424

425425
########################################
426426
#
@@ -1218,7 +1218,7 @@ async def get_app_config(request: Request):
12181218
{
12191219
"record_count": user_count,
12201220
"active_entries": app.state.USER_COUNT,
1221-
"license_data": app.state.LICENSE_DATA,
1221+
"license_metadata": app.state.LICENSE_METADATA,
12221222
}
12231223
if user.role == "admin"
12241224
else {}

src/lib/components/OnBoarding.svelte

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script>
2-
import { getContext } from 'svelte';
2+
import { getContext, onMount } from 'svelte';
33
const i18n = getContext('i18n');
44
55
import { WEBUI_BASE_URL } from '$lib/constants';
@@ -10,6 +10,32 @@
1010
1111
export let show = true;
1212
export let getStartedHandler = () => {};
13+
14+
function setLogoImage() {
15+
const logo = document.getElementById('logo');
16+
17+
if (logo) {
18+
const isDarkMode = document.documentElement.classList.contains('dark');
19+
20+
if (isDarkMode) {
21+
const darkImage = new Image();
22+
darkImage.src = '/static/favicon-dark.png';
23+
24+
darkImage.onload = () => {
25+
logo.src = '/static/favicon-dark.png';
26+
logo.style.filter = ''; // Ensure no inversion is applied if splash-dark.png exists
27+
};
28+
29+
darkImage.onerror = () => {
30+
logo.style.filter = 'invert(1)'; // Invert image if splash-dark.png is missing
31+
};
32+
}
33+
}
34+
}
35+
36+
$: if (show) {
37+
setLogoImage();
38+
}
1339
</script>
1440

1541
{#if show}
@@ -18,6 +44,7 @@
1844
<div class="flex space-x-2">
1945
<div class=" self-center">
2046
<img
47+
id="logo"
2148
crossorigin="anonymous"
2249
src="{WEBUI_BASE_URL}/static/favicon.png"
2350
class=" w-6 rounded-full"

src/routes/auth/+page.svelte

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script>
22
import { toast } from 'svelte-sonner';
33
4-
import { onMount, getContext } from 'svelte';
4+
import { onMount, getContext, tick } from 'svelte';
55
import { goto } from '$app/navigation';
66
import { page } from '$app/stores';
77
@@ -115,13 +115,38 @@
115115
116116
let onboarding = false;
117117
118+
async function setLogoImage() {
119+
await tick();
120+
const logo = document.getElementById('logo');
121+
122+
if (logo) {
123+
const isDarkMode = document.documentElement.classList.contains('dark');
124+
125+
if (isDarkMode) {
126+
const darkImage = new Image();
127+
darkImage.src = '/static/favicon-dark.png';
128+
129+
darkImage.onload = () => {
130+
logo.src = '/static/favicon-dark.png';
131+
logo.style.filter = ''; // Ensure no inversion is applied if favicon-dark.png exists
132+
};
133+
134+
darkImage.onerror = () => {
135+
logo.style.filter = 'invert(1)'; // Invert image if favicon-dark.png is missing
136+
};
137+
}
138+
}
139+
}
140+
118141
onMount(async () => {
119142
if ($user !== undefined) {
120143
await goto('/');
121144
}
122145
await checkOauthCallback();
123146
124147
loaded = true;
148+
setLogoImage();
149+
125150
if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
126151
await signInHandler();
127152
} else {
@@ -154,9 +179,10 @@
154179
<div class="flex space-x-2">
155180
<div class=" self-center">
156181
<img
182+
id="logo"
157183
crossorigin="anonymous"
158184
src="{WEBUI_BASE_URL}/static/splash.png"
159-
class=" w-6 rounded-full dark:invert"
185+
class=" w-6 rounded-full"
160186
alt="logo"
161187
/>
162188
</div>

0 commit comments

Comments
 (0)