mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-10-15 01:40:46 +02:00
Settings add API Url field
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
<template #default>
|
||||
<NuxtLink to="/">
|
||||
<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
|
||||
style="
|
||||
background: linear-gradient(110deg, var(--color-pink), var(--color-blue));
|
||||
|
@@ -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>
|
||||
|
@@ -1,18 +1,33 @@
|
||||
<template>
|
||||
<UPageBody>
|
||||
<UPageSection title="Settings" />
|
||||
<UPageSection title="Libraries" orientation="horizontal">
|
||||
<template #footer>
|
||||
<UButton icon="i-lucide-plus" class="w-fit" @click="addLibraryModal.open()">Add</UButton>
|
||||
</template>
|
||||
<FileLibraries />
|
||||
</UPageSection>
|
||||
<UPageSection title="Maintenance" orientation="horizontal">
|
||||
<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>
|
||||
<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 />
|
||||
</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"
|
||||
>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;
|
||||
|
Reference in New Issue
Block a user