feat(site): 添加站点自定义下载器功能

This commit is contained in:
Attente
2024-11-16 00:28:56 +08:00
parent a780946915
commit bf36e39f3b
2 changed files with 29 additions and 1 deletions

View File

@@ -387,6 +387,8 @@ export interface Site {
pri?: number
// RSS地址
rss?: string
// 下载器
downloader?: string
// Cookie
cookie?: string
// ApiKey

View File

@@ -60,6 +60,22 @@ const priorityItems = ref(
})),
)
// 下载器选项
const downloaderOptions = ref<{ title: string; value: string }[]>([])
async function loadDownloaderSetting() {
try {
const result: { [key: string]: any } = await api.get('system/setting/Downloaders')
const downloaders = result.data?.value ?? []
downloaderOptions.value = [{ title: '默认下载器', value: null }, ...downloaders.map((item: { name: any }) => ({
title: item.name,
value: item.name,
}))]
} catch (error) {
console.error('加载下载器设置失败:', error)
}
}
// 查询站点信息
async function fetchSiteInfo() {
try {
@@ -142,6 +158,7 @@ onMounted(async () => {
isLimit.value = true
if (siteForm.value.apikey) siteType.value = 'api'
}
await loadDownloaderSetting()
})
</script>
@@ -186,7 +203,7 @@ onMounted(async () => {
</VCol>
</VRow>
<VRow>
<VCol cols="12" md="9">
<VCol cols="12" md="6">
<VTextField
v-model="siteForm.rss"
label="RSS地址"
@@ -197,6 +214,15 @@ onMounted(async () => {
<VCol cols="12" md="3">
<VTextField v-model="siteForm.timeout" label="超时时间(秒)" hint="站点请求超时时间" persistent-hint />
</VCol>
<VCol cols="6" md="3">
<VSelect
v-model="siteForm.downloader"
label="下载器"
:items="downloaderOptions"
hint="此站点使用的下载器"
persistent-hint
/>
</VCol>
</VRow>
<VTabs v-model="siteType" show-arrows class="v-tabs-pill mt-3">
<VTab selected-class="v-tab--selected">