feat(Nutstore): 添加坚果云备份文本 (#8940)

This commit is contained in:
George·Dong 2025-08-08 00:39:24 +08:00 committed by GitHub
parent 9129625365
commit 32c28e32cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 161 additions and 34 deletions

View File

@ -30,9 +30,20 @@ interface WebdavBackupManagerProps {
webdavDisableStream?: boolean
}
restoreMethod?: (fileName: string) => Promise<void>
customLabels?: {
restoreConfirmTitle?: string
restoreConfirmContent?: string
invalidConfigMessage?: string
}
}
export function WebdavBackupManager({ visible, onClose, webdavConfig, restoreMethod }: WebdavBackupManagerProps) {
export function WebdavBackupManager({
visible,
onClose,
webdavConfig,
restoreMethod,
customLabels
}: WebdavBackupManagerProps) {
const { t } = useTranslation()
const [backupFiles, setBackupFiles] = useState<BackupFile[]>([])
const [loading, setLoading] = useState(false)
@ -167,14 +178,14 @@ export function WebdavBackupManager({ visible, onClose, webdavConfig, restoreMet
const handleRestore = async (fileName: string) => {
if (!webdavHost) {
window.message.error(t('message.error.invalid.webdav'))
window.message.error(customLabels?.invalidConfigMessage || t('message.error.invalid.webdav'))
return
}
window.modal.confirm({
title: t('settings.data.webdav.restore.confirm.title'),
title: customLabels?.restoreConfirmTitle || t('settings.data.webdav.restore.confirm.title'),
icon: <ExclamationCircleOutlined />,
content: t('settings.data.webdav.restore.confirm.content'),
content: customLabels?.restoreConfirmContent || t('settings.data.webdav.restore.confirm.content'),
okText: t('common.confirm'),
cancelText: t('common.cancel'),
centered: true,

View File

@ -11,6 +11,10 @@ interface WebdavModalProps {
backuping: boolean
customFileName: string
setCustomFileName: (value: string) => void
customLabels?: {
modalTitle?: string
filenamePlaceholder?: string
}
}
export function useWebdavBackupModal({ backupMethod }: { backupMethod?: typeof backupToWebdav } = {}) {
@ -59,13 +63,14 @@ export function WebdavBackupModal({
handleCancel,
backuping,
customFileName,
setCustomFileName
setCustomFileName,
customLabels
}: WebdavModalProps) {
const { t } = useTranslation()
return (
<Modal
title={t('settings.data.webdav.backup.modal.title')}
title={customLabels?.modalTitle || t('settings.data.webdav.backup.modal.title')}
open={isModalVisible}
onOk={handleBackup}
onCancel={handleCancel}
@ -75,7 +80,7 @@ export function WebdavBackupModal({
<Input
value={customFileName}
onChange={(e) => setCustomFileName(e.target.value)}
placeholder={t('settings.data.webdav.backup.modal.filename.placeholder')}
placeholder={customLabels?.filenamePlaceholder || t('settings.data.webdav.backup.modal.filename.placeholder')}
/>
</Modal>
)

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Backup to Nutstore"
"button": "Backup to Nutstore",
"modal": {
"filename": {
"placeholder": "Enter backup filename"
},
"title": "Backup to Nutstore"
}
},
"checkConnection": {
"fail": "Nutstore connection failed",
@ -2260,7 +2266,11 @@
"title": "Nutstore Storage Path"
},
"restore": {
"button": "Restore from Nutstore"
"button": "Restore from Nutstore",
"confirm": {
"content": "Restoring from Nutstore will overwrite current data. Do you want to continue?",
"title": "Restore from Nutstore"
}
},
"title": "Nutstore Configuration",
"username": "Nutstore Username"

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Nutstoreにバックアップ"
"button": "Nutstoreにバックアップ",
"modal": {
"filename": {
"placeholder": "バックアップファイル名を入力"
},
"title": "Nutstoreにバックアップ"
}
},
"checkConnection": {
"fail": "Nutstore接続に失敗しました",
@ -2260,7 +2266,11 @@
"title": "Nutstoreストレージパス"
},
"restore": {
"button": "Nutstoreから復元"
"button": "Nutstoreから復元",
"confirm": {
"content": "Nutstoreからの復元により現在のデータが上書きされます。続行しますか",
"title": "Nutstoreから復元"
}
},
"title": "Nutstore設定",
"username": "Nutstoreユーザー名"

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Резервное копирование в Nutstore"
"button": "Резервное копирование в Nutstore",
"modal": {
"filename": {
"placeholder": "Пожалуйста, введите имя файла резервной копии"
},
"title": "Резервное копирование в Nutstore"
}
},
"checkConnection": {
"fail": "Ошибка подключения к Nutstore",
@ -2260,7 +2266,11 @@
"title": "Путь хранения Nutstore"
},
"restore": {
"button": "Восстановление из Nutstore"
"button": "Восстановление из Nutstore",
"confirm": {
"content": "Восстановление из Nutstore перезапишет текущие данные. Продолжить?",
"title": "Восстановить из Nutstore"
}
},
"title": "Настройки Nutstore",
"username": "Имя пользователя Nutstore"

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "备份到坚果云"
"button": "备份到坚果云",
"modal": {
"filename": {
"placeholder": "请输入备份文件名"
},
"title": "备份到坚果云"
}
},
"checkConnection": {
"fail": "坚果云连接失败",
@ -2260,7 +2266,11 @@
"title": "坚果云存储路径"
},
"restore": {
"button": "从坚果云恢复"
"button": "从坚果云恢复",
"confirm": {
"content": "从坚果云恢复将会覆盖当前数据,是否继续?",
"title": "从坚果云恢复"
}
},
"title": "坚果云配置",
"username": "坚果云用户名"

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "備份到堅果雲"
"button": "備份到堅果雲",
"modal": {
"filename": {
"placeholder": "請輸入備份檔案名"
},
"title": "備份到堅果雲"
}
},
"checkConnection": {
"fail": "堅果雲連接失敗",
@ -2260,7 +2266,11 @@
"title": "堅果雲存儲路徑"
},
"restore": {
"button": "從堅果雲恢復"
"button": "從堅果雲恢復",
"confirm": {
"content": "從堅果雲恢復將覆蓋目前資料,是否繼續?",
"title": "從堅果雲恢復"
}
},
"title": "堅果雲設定",
"username": "堅果雲用戶名"

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Αντίγραφο ασφαλείας στο Jotunn Cloud"
"button": "Αντίγραφο ασφαλείας στο Jotunn Cloud",
"modal": {
"filename": {
"placeholder": "Παρακαλώ εισαγάγετε το όνομα του αρχείου δημιουργίας αντιγράφου ασφαλείας"
},
"title": "Δημιουργία αντιγράφων ασφαλείας στο Jianshu Cloud"
}
},
"checkConnection": {
"fail": "Αποτυχία σύνδεσης στο Jotunn Cloud",
@ -2260,7 +2266,11 @@
"title": "Διαδρομή αποθήκευσης Jotunn Cloud"
},
"restore": {
"button": "Επαναφορά από το Jotunn Cloud"
"button": "Επαναφορά από το Jotunn Cloud",
"confirm": {
"content": "Η επαναφορά από το Nutstore θα αντικαταστήσει τα τρέχοντα δεδομένα. Θέλετε να συνεχίσετε;",
"title": "Επαναφορά από το Nutstore"
}
},
"title": "Ρυθμίσεις Jotunn Cloud",
"username": "Όνομα χρήστη Jotunn Cloud"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Χωρίς σημειώσεις",
"title": "Ενημέρωση"
},
"warning": {
"missing_provider": "Ο προμηθευτής δεν υπάρχει, έγινε επαναφορά στον προεπιλεγμένο προμηθευτή {{provider}}. Αυτό μπορεί να προκαλέσει προβλήματα."
},
"words": {
"knowledgeGraph": "γνώσεις Γράφου",
"quit": "Έξοδος",

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Hacer copia de seguridad en Nutstore"
"button": "Hacer copia de seguridad en Nutstore",
"modal": {
"filename": {
"placeholder": "Por favor, introduzca el nombre del archivo de copia de seguridad"
},
"title": "Copia de seguridad en Nutstore"
}
},
"checkConnection": {
"fail": "Fallo en la conexión con Nutstore",
@ -2260,7 +2266,11 @@
"title": "Ruta de almacenamiento de Nutstore"
},
"restore": {
"button": "Restaurar desde Nutstore"
"button": "Restaurar desde Nutstore",
"confirm": {
"content": "Restaurar desde Nutstore sobrescribirá los datos actuales, ¿deseas continuar?",
"title": "Restaurar desde Nutstore"
}
},
"title": "Configuración de Nutstore",
"username": "Nombre de usuario de Nutstore"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Sin notas de la versión",
"title": "Actualización"
},
"warning": {
"missing_provider": "El proveedor no existe, se ha revertido al proveedor predeterminado {{provider}}. Esto podría causar problemas."
},
"words": {
"knowledgeGraph": "Grafo de Conocimiento",
"quit": "Salir",

View File

@ -2226,12 +2226,18 @@
},
"nutstore": {
"backup": {
"button": "Резервное копирование в坚果云"
"button": "Sauvegarder sur Nutstore",
"modal": {
"filename": {
"placeholder": "Veuillez saisir le nom du fichier de sauvegarde"
},
"title": "Sauvegarder sur Nutstore"
}
},
"checkConnection": {
"fail": "Не удалось подключиться к坚果云",
"fail": "Échec de la connexion à Nutstore",
"name": "Проверить соединение",
"success": "Соединение с坚果云 установлено"
"success": "Connecté à Nutstore"
},
"isLogin": "Вход выполнен",
"login": {
@ -2239,8 +2245,8 @@
},
"logout": {
"button": "Выйти из аккаунта",
"content": "После выхода будет невозможно создать резервную копию в坚果云 или восстановить данные из нее",
"title": "Вы действительно хотите выйти из аккаунта坚果云?"
"content": "Après la déconnexion, il ne sera plus possible de sauvegarder vers Nutstore ni de restaurer depuis Nutstore.",
"title": "Êtes-vous sûr de vouloir vous déconnecter de Nutstore ?"
},
"new_folder": {
"button": {
@ -2251,19 +2257,23 @@
},
"notLogin": "Вход не выполнен",
"path": {
"label": "Путь хранения данных坚果云",
"placeholder": "Введите путь хранения данных坚果云"
"label": "Chemin de stockage Nutstore",
"placeholder": "Veuillez saisir le chemin de stockage de Nutstore"
},
"pathSelector": {
"currentPath": "Текущий путь",
"return": "Назад",
"title": "Путь хранения данных坚果云"
"title": "Chemin de stockage Nutstore"
},
"restore": {
"button": "Восстановление из坚果云"
"button": "Restauration depuis Nutstore",
"confirm": {
"content": "La restauration depuis Nutstore écrasera les données actuelles. Continuer ?",
"title": "Récupérer depuis Nutstore"
}
},
"title": "Настройка坚果云",
"username": "Имя пользователя坚果云"
"title": "Configuration de Nutstore",
"username": "Nom dutilisateur Nutstore"
},
"obsidian": {
"default_vault": "Référentiel Obsidian par défaut",
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Aucune note de version",
"title": "Mise à jour"
},
"warning": {
"missing_provider": "Le fournisseur nexiste pas, retour au fournisseur par défaut {{provider}}. Cela peut entraîner des problèmes."
},
"words": {
"knowledgeGraph": "Graphe de connaissances",
"quit": "Quitter",

View File

@ -2226,7 +2226,13 @@
},
"nutstore": {
"backup": {
"button": "Fazer backup para o Nutstore"
"button": "Fazer backup para o Nutstore",
"modal": {
"filename": {
"placeholder": "Por favor, introduza o nome do ficheiro de cópia de segurança"
},
"title": "Fazer backup para o Nutstore"
}
},
"checkConnection": {
"fail": "Falha na conexão com o Nutstore",
@ -2260,7 +2266,11 @@
"title": "Caminho de armazenamento do Nutstore"
},
"restore": {
"button": "Restaurar do Nutstore"
"button": "Restaurar do Nutstore",
"confirm": {
"content": "Restaurar a partir da Nutstore irá substituir os dados atuais. Deseja continuar?",
"title": "Restaurar a partir do Nutstore"
}
},
"title": "Configuração do Nutstore",
"username": "Nome de usuário do Nutstore"
@ -3573,6 +3583,9 @@
"noReleaseNotes": "Sem notas de versão",
"title": "Atualização"
},
"warning": {
"missing_provider": "O fornecedor não existe; foi revertido para o fornecedor predefinido {{provider}}. Isto pode causar problemas."
},
"words": {
"knowledgeGraph": "Gráfico de Conhecimento",
"quit": "Sair",

View File

@ -325,6 +325,10 @@ const NutstoreSettings: FC = () => {
backuping={backuping}
customFileName={customFileName}
setCustomFileName={setCustomFileName}
customLabels={{
modalTitle: t('settings.data.nutstore.backup.modal.title'),
filenamePlaceholder: t('settings.data.nutstore.backup.modal.filename.placeholder')
}}
/>
<WebdavBackupManager
@ -337,6 +341,11 @@ const NutstoreSettings: FC = () => {
webdavPath: storagePath
}}
restoreMethod={restoreFromNutstore}
customLabels={{
restoreConfirmTitle: t('settings.data.nutstore.restore.confirm.title'),
restoreConfirmContent: t('settings.data.nutstore.restore.confirm.content'),
invalidConfigMessage: t('message.error.invalid.nutstore')
}}
/>
</>
</SettingGroup>