feat: 添加 AList 存储选项 (#645)

This commit is contained in:
千石
2026-08-09 14:40:54 +08:00
committed by GitHub
parent 7ea14bc919
commit e6b26cc831
7 changed files with 37 additions and 6 deletions
+1
View File
@@ -12,6 +12,7 @@ const STORAGE_ACCENT_COLOR_MAP = {
u115: '#17B26A',
rclone: '#6675FF',
alist: '#12B8D7',
alistgo: '#1BA0D8',
smb: '#3B82F6',
}
+7 -1
View File
@@ -6,6 +6,7 @@ import alipan_png from '@images/misc/alipan.webp'
import u115_png from '@images/misc/u115.png'
import rclone_png from '@images/misc/rclone.png'
import alist_png from '@images/misc/openlist.svg'
import alistgo_png from '@images/misc/alist.svg'
import custom_png from '@images/misc/database.png'
import smb_png from '@images/misc/smb.png'
import api from '@/api'
@@ -58,6 +59,7 @@ function openStorageDialog() {
u115: U115AuthDialog,
rclone: RcloneConfigDialog,
alist: AlistConfigDialog,
alistgo: AlistConfigDialog,
smb: SmbConfigDialog,
}
@@ -69,7 +71,9 @@ function openStorageDialog() {
const dialog = dialogMap[props.storage.type] || StorageCustomConfigDialog
const dialogProps = dialog === StorageCustomConfigDialog
? { storage: props.storage }
: { conf: props.storage.config || {} }
: dialog === AlistConfigDialog
? { conf: props.storage.config || {}, type: props.storage.type }
: { conf: props.storage.config || {} }
openSharedDialog(
dialog,
@@ -94,6 +98,8 @@ const getIcon = computed(() => {
return rclone_png
case 'alist':
return alist_png
case 'alistgo':
return alistgo_png
case 'smb':
return smb_png
default:
+9 -5
View File
@@ -15,6 +15,10 @@ const props = defineProps({
type: Object as PropType<{ [key: string]: any }>,
required: true,
},
type: {
type: String,
default: 'alist',
},
})
// 定义事件
@@ -29,7 +33,7 @@ async function handleDone() {
// 重置配置
async function handleReset() {
try {
const result: { [key: string]: any } = await api.get('/storage/reset/alist')
const result: { [key: string]: any } = await api.get(`/storage/reset/${props.type}`)
if (result.success) {
// 重置成功
handleDone()
@@ -62,7 +66,7 @@ const sourceItems = [
// 保存alist设置
async function savaAlistConfig() {
try {
await api.post(`storage/save/alist`, props.conf)
await api.post(`storage/save/${props.type}`, props.conf)
} catch (e) {
console.error(e)
}
@@ -78,7 +82,7 @@ async function savaAlistConfig() {
<VIcon icon="mdi-cog-outline" class="me-2" />
</template>
<VCardTitle>
{{ t('dialog.alistConfig.title') }}
{{ t(`dialog.${props.type}Config.title`) }}
</VCardTitle>
</VCardItem>
<VDivider />
@@ -87,8 +91,8 @@ async function savaAlistConfig() {
<VCol cols="12">
<VTextField
v-model="props.conf.url"
:hint="t('dialog.alistConfig.serverUrl')"
:label="t('dialog.alistConfig.serverUrl')"
:hint="t(`dialog.${props.type}Config.serverUrl`)"
:label="t(`dialog.${props.type}Config.serverUrl`)"
persistent-hint
prepend-inner-icon="mdi-server"
/>