feat(webui): backup/restore UI in system settings (Wave A2)

A '配置备份 / 恢复' card in the 服务 tab: export downloads the JSON bundle
(with an 包含登录凭据 toggle + red warning), restore picks a .json file and
calls importBackup with a 一并恢复登录凭据 toggle (default off). Shows
restored/skipped counts + restart-to-apply. Typed systemSettings.exportBackup/
importBackup client methods. View layer — verified by tsc + vite build.
This commit is contained in:
DrSmoothl committed 2026-06-18 15:01:17 +08:00
1 parent c0e3bd0cff
commit 0c20d58a8c
4 files changed
+113 -3

No files matched your search

+5 -1
View File
@@ -1,4 +1,4 @@
import type { AccountConnections, HookProcessInfo, LogEntry, LogLevel, NotificationDeliveryRecord, NotificationsConfig, QQInfo, SystemInfo, SystemSettingsPatch, SystemSettingsResponse, UiAppearance, UiConfig, UpdateInfo } from '@/types';
import type { AccountConnections, BackupBundle, BackupImportResult, HookProcessInfo, LogEntry, LogLevel, NotificationDeliveryRecord, NotificationsConfig, QQInfo, SystemInfo, SystemSettingsPatch, SystemSettingsResponse, UiAppearance, UiConfig, UpdateInfo } from '@/types';
import type { PasswordRule } from '@/components/pages/change-password-page';
import { normalizeOneBotConfig } from '@/lib/onebot-config';
import {
@@ -112,6 +112,10 @@ class HttpApiClient implements ApiClient {
deleteCert: async () => {
await this.fetchJson<{ success: boolean }>('/api/system/tls/cert', { method: 'DELETE' });
},
exportBackup: (includeCredentials: boolean) =>
this.getJson<BackupBundle>(`/api/system/backup/export${includeCredentials ? '?credentials=1' : ''}`),
importBackup: (backup: BackupBundle, restoreCredentials: boolean) =>
this.postJson<BackupImportResult>('/api/system/backup/import', { backup, restoreCredentials }),
};
this.ui = {