diff --git a/src/api/constants.ts b/src/api/constants.ts index 35bd89ac..882dd85d 100644 --- a/src/api/constants.ts +++ b/src/api/constants.ts @@ -26,6 +26,11 @@ export const storageAttributes = [ icon: 'mdi-server-network-outline', remote: true, }, + { + type: 'smb', + icon: 'mdi-folder-network-outline', + remote: true, + }, ] export const storageIconDict = storageAttributes.reduce((dict, item) => { diff --git a/src/assets/images/misc/smb.png b/src/assets/images/misc/smb.png new file mode 100644 index 00000000..4774d778 Binary files /dev/null and b/src/assets/images/misc/smb.png differ diff --git a/src/components/cards/StorageCard.vue b/src/components/cards/StorageCard.vue index f550efa4..bc027f36 100644 --- a/src/components/cards/StorageCard.vue +++ b/src/components/cards/StorageCard.vue @@ -7,11 +7,13 @@ 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 custom_png from '@images/misc/database.png' +import smb_png from '@images/misc/smb.png' import api from '@/api' import AliyunAuthDialog from '../dialog/AliyunAuthDialog.vue' import U115AuthDialog from '../dialog/U115AuthDialog.vue' import RcloneConfigDialog from '../dialog/RcloneConfigDialog.vue' import AlistConfigDialog from '../dialog/AlistConfigDialog.vue' +import SmbConfigDialog from '../dialog/SmbConfigDialog.vue' import { useToast } from 'vue-toastification' import { isNullOrEmptyObject } from '@/@core/utils' import { useI18n } from 'vue-i18n' @@ -65,6 +67,8 @@ const u115AuthDialog = ref(false) const rcloneConfigDialog = ref(false) // AList配置对话框 const aListConfigDialog = ref(false) +// SMB配置对话框 +const smbConfigDialog = ref(false) // 自定义存储配置对话框 const customConfigDialog = ref(false) @@ -83,6 +87,9 @@ function openStorageDialog() { case 'alist': aListConfigDialog.value = true break + case 'smb': + smbConfigDialog.value = true + break case 'local': $toast.info(t('storage.noConfigNeeded')) break @@ -105,6 +112,8 @@ const getIcon = computed(() => { return rclone_png case 'alist': return alist_png + case 'smb': + return smb_png default: return custom_png } @@ -143,6 +152,7 @@ function handleDone() { u115AuthDialog.value = false rcloneConfigDialog.value = false aListConfigDialog.value = false + smbConfigDialog.value = false customConfigDialog.value = false // 更新存储 storage_ref.value.name = customName.value @@ -203,6 +213,13 @@ function onClose() { @close="aListConfigDialog = false" @done="handleDone" /> + +import api from '@/api' +import { useI18n } from 'vue-i18n' +import { useDisplay } from 'vuetify' + +// 显示器宽度 +const display = useDisplay() + +// 多语言支持 +const { t } = useI18n() + +// 定义输入 +const props = defineProps({ + conf: { + type: Object as PropType<{ [key: string]: any }>, + required: true, + }, +}) + +// 定义事件 +const emit = defineEmits(['done', 'close']) + +// 完成 +async function handleDone() { + await saveSmbConfig() + emit('done') +} + +// 重置配置 +async function handleReset() { + try { + const result: { [key: string]: any } = await api.get('/storage/reset/smb') + if (result.success) { + // 重置成功 + handleDone() + } + } catch (e) { + console.error(e) + } +} + +// 保存 SMB 设置 +async function saveSmbConfig() { + try { + await api.post(`storage/save/smb`, props.conf) + } catch (e) { + console.error(e) + } +} + + + diff --git a/src/locales/en-US.ts b/src/locales/en-US.ts index 29b9f2da..6e84d50b 100644 --- a/src/locales/en-US.ts +++ b/src/locales/en-US.ts @@ -780,6 +780,7 @@ export default { u115: '115 Cloud', rclone: 'RClone', alist: 'OpenList', + smb: 'SMB Network Share', custom: 'Custom', }, filterRules: { @@ -1678,6 +1679,21 @@ export default { complete: 'Complete', reset: 'Reset', }, + smbConfig: { + title: 'SMB Network Share Configuration', + host: 'SMB Server Address', + hostHint: 'IP address or hostname of the SMB server', + share: 'Share Name', + shareHint: 'Name of the shared folder to connect to', + username: 'Username', + usernameHint: 'SMB login username', + password: 'Password', + passwordHint: 'SMB login password', + domain: 'Domain', + domainHint: 'SMB domain name, such as WORKGROUP or domain controller name', + complete: 'Complete', + reset: 'Reset', + }, workflowAddEdit: { addTitle: 'Add Workflow', editTitle: 'Edit Workflow', diff --git a/src/locales/zh-CN.ts b/src/locales/zh-CN.ts index 834052d7..aa1eb424 100644 --- a/src/locales/zh-CN.ts +++ b/src/locales/zh-CN.ts @@ -777,6 +777,7 @@ export default { u115: '115网盘', rclone: 'RClone', alist: 'OpenList', + smb: 'SMB网络共享', custom: '自定义', }, filterRules: { @@ -1656,6 +1657,21 @@ export default { complete: '完成', reset: '重置', }, + smbConfig: { + title: 'SMB网络共享配置', + host: 'SMB服务器地址', + hostHint: 'SMB服务器的IP地址或主机名', + share: '共享名称', + shareHint: '要连接的共享文件夹名称', + username: '用户名', + usernameHint: 'SMB登录用户名', + password: '密码', + passwordHint: 'SMB登录密码', + domain: '域名', + domainHint: 'SMB域名,如WORKGROUP或域控制器名称', + complete: '完成', + reset: '重置', + }, workflowAddEdit: { addTitle: '添加工作流', editTitle: '编辑工作流', diff --git a/src/locales/zh-TW.ts b/src/locales/zh-TW.ts index 2e95cbfd..8602f0c3 100644 --- a/src/locales/zh-TW.ts +++ b/src/locales/zh-TW.ts @@ -775,6 +775,7 @@ export default { u115: '115網盤', rclone: 'RClone', alist: 'OpenList', + smb: 'SMB網路共享', custom: '自定義', }, @@ -1655,6 +1656,21 @@ export default { complete: '完成', reset: '重置', }, + smbConfig: { + title: 'SMB網路共享配置', + host: 'SMB伺服器地址', + hostHint: 'SMB伺服器的IP地址或主機名', + share: '共享名稱', + shareHint: '要連接的共享資料夾名稱', + username: '用戶名', + usernameHint: 'SMB登入用戶名', + password: '密碼', + passwordHint: 'SMB登入密碼', + domain: '域名', + domainHint: 'SMB域名,如WORKGROUP或域控制器名稱', + complete: '完成', + reset: '重置', + }, workflowAddEdit: { addTitle: '新增工作流', editTitle: '編輯工作流',