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:
4 files changed
+113
-3
No files matched your search
@@ -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 = {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type {
|
||||
AccountConnections,
|
||||
BackupBundle,
|
||||
BackupImportResult,
|
||||
HookProcessInfo,
|
||||
LogEntry,
|
||||
LogLevel,
|
||||
@@ -84,6 +86,10 @@ export interface ApiClient {
|
||||
/** Validate + write config/cert.pem + key.pem (restart to apply). */
|
||||
uploadCert(cert: string, key: string): Promise<void>;
|
||||
deleteCert(): Promise<void>;
|
||||
/** Download the config backup bundle (credentials gated). */
|
||||
exportBackup(includeCredentials: boolean): Promise<BackupBundle>;
|
||||
/** Validate + restore a bundle (snapshots current config first). */
|
||||
importBackup(backup: BackupBundle, restoreCredentials: boolean): Promise<BackupImportResult>;
|
||||
};
|
||||
|
||||
// ---- notifications (account up/down webhooks) ----
|
||||
|
||||
Reference in new issue
Block a user