feat: local backup (#5054)

* feat: local backup

* refactor(backup): make local backup helpers synchronous and clean up redundant checks

- Converted local backup helpers to synchronous functions to remove unused async warnings and align command signatures.
- Updated list/delete/export commands to call the sync feature functions directly without awaits while preserving behavior.
- Simplified destination directory creation to always ensure parent folders exist without redundant checks, satisfying Clippy.
This commit is contained in:
Sline
2025-10-14 14:52:04 +08:00
committed by GitHub
parent 4dd811330b
commit 51b08be87e
14 changed files with 666 additions and 61 deletions

View File

@@ -440,14 +440,30 @@ export async function createWebdavBackup() {
return invoke<void>("create_webdav_backup");
}
export async function createLocalBackup() {
return invoke<void>("create_local_backup");
}
export async function deleteWebdavBackup(filename: string) {
return invoke<void>("delete_webdav_backup", { filename });
}
export async function deleteLocalBackup(filename: string) {
return invoke<void>("delete_local_backup", { filename });
}
export async function restoreWebDavBackup(filename: string) {
return invoke<void>("restore_webdav_backup", { filename });
}
export async function restoreLocalBackup(filename: string) {
return invoke<void>("restore_local_backup", { filename });
}
export async function exportLocalBackup(filename: string, destination: string) {
return invoke<void>("export_local_backup", { filename, destination });
}
export async function saveWebdavConfig(
url: string,
username: string,
@@ -468,6 +484,10 @@ export async function listWebDavBackup() {
return list;
}
export async function listLocalBackup() {
return invoke<ILocalBackupFile[]>("list_local_backup");
}
export async function scriptValidateNotice(status: string, msg: string) {
return invoke<void>("script_validate_notice", { status, msg });
}

View File

@@ -870,6 +870,13 @@ interface IWebDavFile {
tag: string;
}
interface ILocalBackupFile {
filename: string;
path: string;
last_modified: string;
content_length: number;
}
interface IWebDavConfig {
url: string;
username: string;