数据备份测试

This commit is contained in:
cc
2026-04-25 14:55:31 +08:00
parent c167be53b3
commit 5129574729
21 changed files with 1890 additions and 4 deletions

View File

@@ -21,6 +21,76 @@ export interface SocialSaveWeiboCookieResult {
error?: string
}
export interface BackupProgress {
phase: 'preparing' | 'scanning' | 'exporting' | 'packing' | 'inspecting' | 'restoring' | 'done' | 'failed'
message: string
current?: number
total?: number
detail?: string
}
export interface BackupOptions {
includeImages?: boolean
includeVideos?: boolean
includeFiles?: boolean
}
export interface BackupManifest {
version: 1
type: 'weflow-db-snapshots'
createdAt: string
appVersion: string
source: {
wxid: string
dbRoot: string
}
options?: BackupOptions
databases: Array<{
id: string
kind: 'session' | 'contact' | 'emoticon' | 'message' | 'media' | 'sns'
dbPath: string
relativePath: string
tables: Array<{
name: string
snapshotPath: string
rows: number
columns: number
schemaSql?: string
}>
}>
resources?: {
images?: Array<{
kind: 'image' | 'video' | 'file'
id: string
md5?: string
sessionId?: string
createTime?: number
sourceFileName?: string
archivePath: string
targetRelativePath: string
ext?: string
size?: number
}>
videos?: Array<{
kind: 'image' | 'video' | 'file'
id: string
md5?: string
sourceFileName?: string
archivePath: string
targetRelativePath: string
size?: number
}>
files?: Array<{
kind: 'image' | 'video' | 'file'
id: string
sourceFileName?: string
archivePath: string
targetRelativePath: string
size?: number
}>
}
}
export interface ElectronAPI {
window: {
minimize: () => void
@@ -158,6 +228,27 @@ export interface ElectronAPI {
close: () => Promise<boolean>
}
backup: {
create: (payload: { outputPath: string; options?: BackupOptions }) => Promise<{
success: boolean
filePath?: string
manifest?: BackupManifest
error?: string
}>
inspect: (payload: { archivePath: string }) => Promise<{
success: boolean
manifest?: BackupManifest
error?: string
}>
restore: (payload: { archivePath: string }) => Promise<{
success: boolean
inserted?: number
ignored?: number
skipped?: number
error?: string
}>
onProgress: (callback: (progress: BackupProgress) => void) => () => void
}
key: {
autoGetDbKey: () => Promise<{ success: boolean; key?: string; error?: string; logs?: string[] }>
autoGetImageKey: (manualDir?: string, wxid?: string) => Promise<{ success: boolean; xorKey?: number; aesKey?: string; verified?: boolean; error?: string }>
@@ -1220,4 +1311,3 @@ declare global {
}
export { }