This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-09 17:30:02 -05:00
1 parent 951f96021a
commit 252e6fd855
4 files changed
+31 -8

No files matched your search

+14 -7
View File
@@ -15,6 +15,11 @@
onMount(async () => { onMount(async () => {
if ($user?.role !== 'admin') { if ($user?.role !== 'admin') {
await goto('/'); await goto('/');
} else if (
!$config?.features?.enable_plugins &&
$page.url.pathname.includes('/admin/functions')
) {
await goto('/admin');
} }
loaded = true; loaded = true;
}); });
@@ -85,13 +90,15 @@
href="/admin/evaluations">{$i18n.t('Evaluations')}</a href="/admin/evaluations">{$i18n.t('Evaluations')}</a
> >
<a {#if $config?.features?.enable_plugins}
draggable="false" <a
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/functions') draggable="false"
? '' class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/functions')
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition select-none" ? ''
href="/admin/functions">{$i18n.t('Functions')}</a : 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition select-none"
> href="/admin/functions">{$i18n.t('Functions')}</a
>
{/if}
<a <a
draggable="false" draggable="false"
@@ -1,11 +1,17 @@
<script> <script>
import { onMount } from 'svelte'; import { onMount } from 'svelte';
import { functions } from '$lib/stores'; import { config, functions } from '$lib/stores';
import { goto } from '$app/navigation';
import { getFunctions } from '$lib/apis/functions'; import { getFunctions } from '$lib/apis/functions';
import Functions from '$lib/components/admin/Functions.svelte'; import Functions from '$lib/components/admin/Functions.svelte';
onMount(async () => { onMount(async () => {
if (!$config?.features?.enable_plugins) {
await goto('/admin');
return;
}
await Promise.all([ await Promise.all([
(async () => { (async () => {
functions.set(await getFunctions(localStorage.token)); functions.set(await getFunctions(localStorage.token));
@@ -61,6 +61,11 @@
}; };
onMount(() => { onMount(() => {
if (!$config?.features?.enable_plugins) {
goto('/admin');
return;
}
window.addEventListener('message', async (event) => { window.addEventListener('message', async (event) => {
if ( if (
!['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:9999'].includes( !['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:9999'].includes(
@@ -60,6 +60,11 @@
}; };
onMount(async () => { onMount(async () => {
if (!$config?.features?.enable_plugins) {
goto('/admin');
return;
}
console.log('mounted'); console.log('mounted');
const id = $page.url.searchParams.get('id'); const id = $page.url.searchParams.get('id');