2024-05-08 03:18:15 +02:00
|
|
|
<template>
|
2024-06-21 21:22:31 +02:00
|
|
|
<div class="flex flex-col mt-3 gap-3 font-dm overflow-y-scroll h-[calc(100%)]" style="-webkit-app-region: no-drag">
|
2024-05-15 17:04:19 +02:00
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
2024-05-08 03:18:15 +02:00
|
|
|
<div class="text-sm mb-2"> Account Management </div>
|
|
|
|
<div v-for="account in accounts" class="flex flex-row items-center h-12 p-3 w-full bg-[#4b4b4b89] rounded-xl">
|
|
|
|
<Icon v-if="account.service === 'CR'" name="simple-icons:crunchyroll" class="h-6 w-6 text-white" />
|
|
|
|
<Icon v-if="account.service === 'ADN'" name="arcticons:animeultima" class="h-6 w-6 text-white" />
|
|
|
|
<div class="text-xs ml-1.5">
|
2024-05-09 02:09:37 +02:00
|
|
|
{{ services.find((s) => s.service === account.service)?.name }}
|
2024-05-08 03:18:15 +02:00
|
|
|
</div>
|
|
|
|
<div class="text-xs ml-auto">
|
|
|
|
{{ account.username }}
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-row ml-2">
|
|
|
|
<button @click="deleteAccount(account.id)" class="flex items-center justify-center bg-red-500 hover:bg-red-600 w-8 h-8 rounded-lg transition-all">
|
|
|
|
<Icon name="majesticons:logout" class="h-4 w-4 text-white" />
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-21 22:15:16 +02:00
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2">Max Concurrent Downloads</div>
|
|
|
|
<input v-model="selectedMaxDownloads" type="number" class="bg-[#5c5b5b] w-full focus:outline-none px-3 py-2 rounded-xl text-sm text-center cursor-pointer" />
|
|
|
|
</div>
|
2024-05-18 19:48:20 +02:00
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2"> Default Dubs </div>
|
|
|
|
<div class="w-full bg-[#636363] rounded-xl grid grid-cols-10 gap-1 p-1 z-10">
|
|
|
|
<button
|
|
|
|
v-for="l in locales"
|
|
|
|
@click="toggleDub(l)"
|
|
|
|
class="flex flex-row items-center justify-center gap-3 py-2 rounded-xl text-sm"
|
2024-05-20 00:44:43 +02:00
|
|
|
:class="dubLocales && dubLocales.length !== 0 && dubLocales.find((i) => i.locale === l.locale) ? 'bg-[#424242]' : 'hover:bg-[#747474]'"
|
2024-05-18 19:48:20 +02:00
|
|
|
>
|
|
|
|
{{ l.name }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2"> Default Subs </div>
|
|
|
|
<div class="w-full bg-[#636363] rounded-xl grid grid-cols-10 gap-1 p-1 z-10">
|
|
|
|
<button
|
|
|
|
v-for="l in locales"
|
|
|
|
@click="toggleSub(l)"
|
|
|
|
class="flex flex-row items-center justify-center gap-3 py-2 rounded-xl text-sm"
|
2024-05-20 00:44:43 +02:00
|
|
|
:class="subLocales && subLocales.length !== 0 && subLocales.find((i) => i.locale === l.locale) ? 'bg-[#424242]' : 'hover:bg-[#747474]'"
|
2024-05-18 19:48:20 +02:00
|
|
|
>
|
|
|
|
{{ l.name }}
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-06-21 21:22:31 +02:00
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2">Default Video Quality</div>
|
|
|
|
<select
|
|
|
|
v-model="selectedVideoQuality"
|
|
|
|
@change="selectVideoQuality()"
|
|
|
|
class="bg-[#5c5b5b] w-full focus:outline-none px-3 py-2 rounded-xl text-sm text-center cursor-pointer"
|
|
|
|
>
|
|
|
|
<option :value="1080">1080p</option>
|
|
|
|
<option :value="720">720p</option>
|
|
|
|
<option :value="480">480p</option>
|
|
|
|
<option :value="360">360p</option>
|
|
|
|
<option :value="240">240p</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2">Default Audio Quality</div>
|
|
|
|
<select
|
|
|
|
v-model="selectedAudioQuality"
|
|
|
|
@change="selectAudioQuality()"
|
|
|
|
class="bg-[#5c5b5b] w-full focus:outline-none px-3 py-2 rounded-xl text-sm text-center cursor-pointer"
|
|
|
|
>
|
|
|
|
<option :value="1">44.10 kHz</option>
|
|
|
|
<option :value="2">44.10 kHz (2)</option>
|
|
|
|
<option :value="3">22.05 kHz</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
|
|
|
<div class="flex flex-col items-center p-3 bg-[#11111189] rounded-xl select-none">
|
|
|
|
<div class="text-sm mb-2">Default Output Format</div>
|
|
|
|
<select
|
|
|
|
v-model="selectedVideoFormat"
|
|
|
|
@change="selectOutputFormat()"
|
|
|
|
class="bg-[#5c5b5b] w-full focus:outline-none px-3 py-2 rounded-xl text-sm text-center cursor-pointer"
|
|
|
|
>
|
|
|
|
<option value="mkv">MKV</option>
|
|
|
|
<option value="mp4">MP4</option>
|
|
|
|
<option value="untouched" disabled>Untouched</option>
|
|
|
|
</select>
|
|
|
|
</div>
|
2024-05-08 03:18:15 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
2024-05-18 19:48:20 +02:00
|
|
|
const dubLocales = ref<Array<{ locale: string; name: string }>>([])
|
|
|
|
|
|
|
|
const subLocales = ref<Array<{ locale: string; name: string }>>([])
|
|
|
|
|
|
|
|
const locales = ref<Array<{ locale: string; name: string }>>([
|
|
|
|
{ locale: 'ja-JP', name: 'JP' },
|
|
|
|
{ locale: 'de-DE', name: 'DE' },
|
|
|
|
{ locale: 'hi-IN', name: 'HI' },
|
|
|
|
{ locale: 'ru-RU', name: 'RU' },
|
|
|
|
{ locale: 'en-US', name: 'EN' },
|
|
|
|
{ locale: 'fr-FR', name: 'FR' },
|
|
|
|
{ locale: 'pt-BR', name: 'PT' },
|
|
|
|
{ locale: 'es-419', name: 'LA-ES' },
|
|
|
|
{ locale: 'en-IN', name: 'EN-IN' },
|
|
|
|
{ locale: 'it-IT', name: 'IT' },
|
|
|
|
{ locale: 'es-ES', name: 'ES' },
|
|
|
|
{ locale: 'ta-IN', name: 'TA' },
|
|
|
|
{ locale: 'te-IN', name: 'TE' },
|
|
|
|
{ locale: 'ar-SA', name: 'AR' },
|
|
|
|
{ locale: 'ms-MY', name: 'MS' },
|
|
|
|
{ locale: 'th-TH', name: 'TH' },
|
|
|
|
{ locale: 'vi-VN', name: 'VI' },
|
|
|
|
{ locale: 'id-ID', name: 'ID' },
|
|
|
|
{ locale: 'ko-KR', name: 'KO' }
|
|
|
|
])
|
|
|
|
|
2024-06-21 21:22:31 +02:00
|
|
|
const selectedVideoQuality = ref<number>()
|
|
|
|
const selectedAudioQuality = ref<number>()
|
|
|
|
const selectedVideoFormat = ref<number>()
|
2024-06-21 22:15:16 +02:00
|
|
|
const selectedMaxDownloads = ref<number>()
|
2024-06-21 21:22:31 +02:00
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
const toggleDub = (lang: { locale: string; name: string }) => {
|
|
|
|
const index = dubLocales.value.findIndex((i) => i.locale === lang.locale)
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
dubLocales.value.splice(index, 1)
|
2024-05-20 00:44:43 +02:00
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setArrayDub(JSON.stringify(dubLocales.value))
|
|
|
|
}
|
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index === -1) {
|
|
|
|
dubLocales.value.push(lang)
|
2024-05-20 00:44:43 +02:00
|
|
|
|
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setArrayDub(JSON.stringify(dubLocales.value))
|
|
|
|
}
|
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const toggleSub = (lang: { locale: string; name: string }) => {
|
|
|
|
const index = subLocales.value.findIndex((i) => i.locale === lang.locale)
|
|
|
|
|
|
|
|
if (index !== -1) {
|
|
|
|
subLocales.value.splice(index, 1)
|
2024-05-20 00:44:43 +02:00
|
|
|
;(window as any).myAPI.setArraySub(JSON.stringify(subLocales.value))
|
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (index === -1) {
|
|
|
|
subLocales.value.push(lang)
|
2024-05-20 00:44:43 +02:00
|
|
|
;(window as any).myAPI.setArraySub(JSON.stringify(subLocales.value))
|
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-08 03:18:15 +02:00
|
|
|
const services = ref<{ name: string; service: string }[]>([
|
|
|
|
{
|
|
|
|
name: 'Crunchyroll',
|
|
|
|
service: 'CR'
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'ADN',
|
|
|
|
service: 'ADN'
|
|
|
|
}
|
|
|
|
])
|
|
|
|
|
|
|
|
const accounts = ref<{ id: number; username: string; service: string }[]>()
|
|
|
|
|
|
|
|
const getAccounts = async () => {
|
|
|
|
const { data, error } = await useFetch<{ id: number; username: string; service: string }[]>(`http://localhost:9941/api/service/accounts`, {
|
|
|
|
method: 'GET'
|
|
|
|
})
|
|
|
|
|
|
|
|
if (error.value) {
|
|
|
|
alert(error.value)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!data.value) return
|
|
|
|
|
|
|
|
accounts.value = data.value
|
|
|
|
}
|
|
|
|
|
2024-05-09 02:09:37 +02:00
|
|
|
getAccounts()
|
2024-05-08 03:18:15 +02:00
|
|
|
|
|
|
|
const deleteAccount = async (id: number) => {
|
|
|
|
const { error } = await useFetch(`http://localhost:9941/api/service/account/${id}`, {
|
|
|
|
method: 'DELETE'
|
|
|
|
})
|
|
|
|
|
|
|
|
if (error.value) {
|
|
|
|
alert(error.value)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2024-05-09 02:09:37 +02:00
|
|
|
getAccounts()
|
2024-05-08 03:18:15 +02:00
|
|
|
}
|
2024-05-18 19:48:20 +02:00
|
|
|
|
2024-06-21 21:22:31 +02:00
|
|
|
const selectVideoQuality = () => {
|
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setDefaultVideoQuality(selectedVideoQuality.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const selectAudioQuality = () => {
|
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setDefaultAudioQuality(selectedAudioQuality.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const selectOutputFormat = () => {
|
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setDefaultOutputFormat(selectedVideoFormat.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-06-21 22:15:16 +02:00
|
|
|
watch(selectedMaxDownloads, () => {
|
|
|
|
if (selectedMaxDownloads.value !== undefined && selectedMaxDownloads.value !== null) {
|
|
|
|
selectMaxDownloads()
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
const selectMaxDownloads = () => {
|
|
|
|
if (process.client) {
|
|
|
|
;(window as any).myAPI.setDefaultMaxDownloads(selectedMaxDownloads.value)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-18 19:48:20 +02:00
|
|
|
onMounted(() => {
|
|
|
|
;(window as any).myAPI.getArray('defdubarray').then((result: any) => {
|
2024-05-20 00:44:43 +02:00
|
|
|
dubLocales.value = JSON.parse(result)
|
2024-05-18 19:48:20 +02:00
|
|
|
})
|
2024-05-20 00:44:43 +02:00
|
|
|
;(window as any).myAPI.getArray('defsubarray').then((result: any) => {
|
|
|
|
subLocales.value = JSON.parse(result)
|
2024-05-18 19:48:20 +02:00
|
|
|
})
|
2024-06-21 21:22:31 +02:00
|
|
|
;(window as any).myAPI.getDefaultVideoQuality().then((result: any) => {
|
|
|
|
selectedVideoQuality.value = result
|
|
|
|
})
|
|
|
|
;(window as any).myAPI.getDefaultAudioQuality().then((result: any) => {
|
|
|
|
selectedAudioQuality.value = result
|
|
|
|
})
|
|
|
|
;(window as any).myAPI.getDefaultOutputFormat().then((result: any) => {
|
|
|
|
selectedVideoFormat.value = result
|
|
|
|
})
|
2024-06-21 22:15:16 +02:00
|
|
|
;(window as any).myAPI.getDefaultMaxDownloads().then((result: any) => {
|
|
|
|
selectedMaxDownloads.value = result
|
|
|
|
})
|
2024-05-18 19:48:20 +02:00
|
|
|
})
|
2024-05-08 03:18:15 +02:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style></style>
|