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 author.name
}}</UBadge> }}</UBadge>
<UBadge v-for="tag in manga.tags" :key="tag" variant="outline">{{ tag }}</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> <UBadge variant="outline" color="warning">{{ link.provider }}</UBadge>
</NuxtLink> </NuxtLink>
</div> </div>

View File

@@ -1,18 +1,33 @@
<template> <template>
<UPageBody> <UPageBody>
<UPageSection title="Settings" /> <UPageSection title="Settings">
<UPageSection title="Libraries" orientation="horizontal"> <UCard>
<template #header>
<h1>Libraries</h1>
</template>
<template #footer> <template #footer>
<UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton> <UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton>
</template> </template>
<FileLibraries /> <FileLibraries />
</UPageSection> </UCard>
<UPageSection title="Maintenance" orientation="horizontal"> <UCard>
<template #header>
<h1>Maintenance</h1>
</template>
<div class="flex flex-col gap-1 items-end basis-1"> <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 >Clean database</UButton
> >
</div> </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> </UPageSection>
</UPageBody> </UPageBody>
</template> </template>
@@ -25,6 +40,16 @@ const overlay = useOverlay();
const addLibraryModal = overlay.create(LazyAddLibraryModal); 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 cleanUpDatabaseBusy = ref(false);
const cleanUpDatabase = async () => { const cleanUpDatabase = async () => {
cleanUpDatabaseBusy.value = true; cleanUpDatabaseBusy.value = true;