Settings add API Url field

This commit is contained in:
2025-10-12 00:32:45 +02:00
parent 97ab6e8894
commit 517e022e4a
3 changed files with 40 additions and 15 deletions

View File

@@ -14,7 +14,7 @@
author.name
}}</UBadge>
<UBadge v-for="tag in manga.tags" :key="tag" variant="outline">{{ tag }}</UBadge>
<NuxtLink v-for="link in manga.links" :key="link.key" :to="link.url" external noPrefetch>
<NuxtLink v-for="link in manga.links" :key="link.key" :to="link.url" external no-prefetch>
<UBadge variant="outline" color="warning">{{ link.provider }}</UBadge>
</NuxtLink>
</div>

View File

@@ -1,18 +1,33 @@
<template>
<UPageBody>
<UPageSection title="Settings" />
<UPageSection title="Libraries" orientation="horizontal">
<UPageSection title="Settings">
<UCard>
<template #header>
<h1>Libraries</h1>
</template>
<template #footer>
<UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton>
</template>
<FileLibraries />
</UPageSection>
<UPageSection title="Maintenance" orientation="horizontal">
</UCard>
<UCard>
<template #header>
<h1>Maintenance</h1>
</template>
<div class="flex flex-col gap-1 items-end basis-1">
<UButton icon="i-lucide-database" :loading="cleanUpDatabaseBusy" class="w-fit" @click="cleanUpDatabase"
<UButton
icon="i-lucide-database"
:loading="cleanUpDatabaseBusy"
class="w-fit"
@click="cleanUpDatabase"
>Clean database</UButton
>
</div>
<UFormField label="API Url" name="apiUrl">
<UInput v-model="apiUrl" class="max-w-full w-lg" placeholder="http://<ip:port>/" />
<UButton :loading="reloading" class="mx-1" @click="setUrl">Set</UButton>
</UFormField>
</UCard>
</UPageSection>
</UPageBody>
</template>
@@ -25,6 +40,16 @@ const overlay = useOverlay();
const addLibraryModal = overlay.create(LazyAddLibraryModal);
const config = useRuntimeConfig();
const apiUrl = ref(config.public.openFetch.api.baseURL);
const reloading = ref(false);
const setUrl = async () => {
reloading.value = true;
config.public.openFetch.api.baseURL = apiUrl.value;
await refreshNuxtData();
reloading.value = false;
};
const cleanUpDatabaseBusy = ref(false);
const cleanUpDatabase = async () => {
cleanUpDatabaseBusy.value = true;