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

View File

@@ -15,6 +15,11 @@
onMount(async () => {
if ($user?.role !== 'admin') {
await goto('/');
} else if (
!$config?.features?.enable_plugins &&
$page.url.pathname.includes('/admin/functions')
) {
await goto('/admin');
}
loaded = true;
});
@@ -85,13 +90,15 @@
href="/admin/evaluations">{$i18n.t('Evaluations')}</a
>
<a
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
>
{#if $config?.features?.enable_plugins}
<a
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
>
{/if}
<a
draggable="false"

View File

@@ -1,11 +1,17 @@
<script>
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 Functions from '$lib/components/admin/Functions.svelte';
onMount(async () => {
if (!$config?.features?.enable_plugins) {
await goto('/admin');
return;
}
await Promise.all([
(async () => {
functions.set(await getFunctions(localStorage.token));

View File

@@ -61,6 +61,11 @@
};
onMount(() => {
if (!$config?.features?.enable_plugins) {
goto('/admin');
return;
}
window.addEventListener('message', async (event) => {
if (
!['https://openwebui.com', 'https://www.openwebui.com', 'http://localhost:9999'].includes(

View File

@@ -60,6 +60,11 @@
};
onMount(async () => {
if (!$config?.features?.enable_plugins) {
goto('/admin');
return;
}
console.log('mounted');
const id = $page.url.searchParams.get('id');