|
@@ -1,7 +1,7 @@
|
|
|
<script>
|
|
|
import { toast } from 'svelte-sonner';
|
|
|
|
|
|
- import { onMount, getContext } from 'svelte';
|
|
|
+ import { onMount, getContext, tick } from 'svelte';
|
|
|
import { goto } from '$app/navigation';
|
|
|
import { page } from '$app/stores';
|
|
|
|
|
@@ -115,6 +115,29 @@
|
|
|
|
|
|
let onboarding = false;
|
|
|
|
|
|
+ async function setLogoImage() {
|
|
|
+ await tick();
|
|
|
+ const logo = document.getElementById('logo');
|
|
|
+
|
|
|
+ if (logo) {
|
|
|
+ const isDarkMode = document.documentElement.classList.contains('dark');
|
|
|
+
|
|
|
+ if (isDarkMode) {
|
|
|
+ const darkImage = new Image();
|
|
|
+ darkImage.src = '/static/favicon-dark.png';
|
|
|
+
|
|
|
+ darkImage.onload = () => {
|
|
|
+ logo.src = '/static/favicon-dark.png';
|
|
|
+ logo.style.filter = ''; // Ensure no inversion is applied if favicon-dark.png exists
|
|
|
+ };
|
|
|
+
|
|
|
+ darkImage.onerror = () => {
|
|
|
+ logo.style.filter = 'invert(1)'; // Invert image if favicon-dark.png is missing
|
|
|
+ };
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
onMount(async () => {
|
|
|
if ($user !== undefined) {
|
|
|
await goto('/');
|
|
@@ -122,6 +145,8 @@
|
|
|
await checkOauthCallback();
|
|
|
|
|
|
loaded = true;
|
|
|
+ setLogoImage();
|
|
|
+
|
|
|
if (($config?.features.auth_trusted_header ?? false) || $config?.features.auth === false) {
|
|
|
await signInHandler();
|
|
|
} else {
|
|
@@ -154,9 +179,10 @@
|
|
|
<div class="flex space-x-2">
|
|
|
<div class=" self-center">
|
|
|
<img
|
|
|
+ id="logo"
|
|
|
crossorigin="anonymous"
|
|
|
src="{WEBUI_BASE_URL}/static/splash.png"
|
|
|
- class=" w-6 rounded-full dark:invert"
|
|
|
+ class=" w-6 rounded-full"
|
|
|
alt="logo"
|
|
|
/>
|
|
|
</div>
|