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

@@ -15,7 +15,7 @@
<template #default> <template #default>
<NuxtLink to="/"> <NuxtLink to="/">
<div class="h-full flex gap-2 items-center"> <div class="h-full flex gap-2 items-center">
<img src="/blahaj.png" class="h-lh cursor-grab" alt="Blahaj" /> <img src="/blahaj.png" class="h-lh cursor-grab" alt="Blahaj" />
<p <p
style=" style="
background: linear-gradient(110deg, var(--color-pink), var(--color-blue)); background: linear-gradient(110deg, var(--color-pink), var(--color-blue));

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 #footer> <template #header>
<UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton> <h1>Libraries</h1>
</template> </template>
<FileLibraries /> <template #footer>
</UPageSection> <UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton>
<UPageSection title="Maintenance" orientation="horizontal"> </template>
<div class="flex flex-col gap-1 items-end basis-1"> <FileLibraries />
<UButton icon="i-lucide-database" :loading="cleanUpDatabaseBusy" class="w-fit" @click="cleanUpDatabase" </UCard>
>Clean database</UButton <UCard>
> <template #header>
</div> <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"
>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> </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;