mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 03:27:00 +08:00
1. 拆分读取、解析、转写、媒体处理、写入和压缩阶段,完善任务进度展示。 2. 增量导出复用语音资源与转写结果,并为缺失转写补充识别。 3. 稳定远程头像文件名并保留同源头像版本更新。 4. 支持音频附件直接播放、新窗口打开附件,并解码分享标题 XML 实体。 5. 补充导出进度、语音、头像、附件和消息解析回归测试。
90 lines
2.0 KiB
TypeScript
90 lines
2.0 KiB
TypeScript
import type { Message } from './types'
|
|
|
|
export type ExportFormat = 'html' | 'csv' | 'json' | 'markdown'
|
|
export type ExportMessageKind =
|
|
| 'text'
|
|
| 'image'
|
|
| 'video'
|
|
| 'voice'
|
|
| 'sticker'
|
|
| 'file'
|
|
| 'share'
|
|
| 'location'
|
|
| 'system'
|
|
|
|
export type ExportNameMode = 'groupNickname' | 'remark' | 'wechatNickname'
|
|
|
|
export interface ExportTarget {
|
|
userMd5: string
|
|
name: string
|
|
type: 'user' | 'group'
|
|
avatarUrl?: string
|
|
nameMode?: ExportNameMode
|
|
nameMap?: Record<string, string>
|
|
avatarUrls?: Record<string, string>
|
|
}
|
|
|
|
export interface ExportRequest {
|
|
jobId: string
|
|
targets: ExportTarget[]
|
|
format: ExportFormat
|
|
outputName: string
|
|
startTime?: number
|
|
endTime?: number
|
|
kinds: ExportMessageKind[]
|
|
includeMedia: boolean
|
|
includeVoiceTranscripts?: boolean
|
|
preferOriginal?: boolean
|
|
fallbackThumbnail?: boolean
|
|
keepMissing?: boolean
|
|
includeAvatars?: boolean
|
|
zip?: boolean
|
|
}
|
|
|
|
export interface ExportJobProgress {
|
|
jobId: string
|
|
phase:
|
|
| 'reading'
|
|
| 'parsing'
|
|
| 'media'
|
|
| 'transcribing'
|
|
| 'writing'
|
|
| 'compressing'
|
|
| 'completed'
|
|
| 'cancelled'
|
|
| 'failed'
|
|
processed: number
|
|
total?: number
|
|
percent?: number
|
|
outputPath?: string
|
|
error?: string
|
|
}
|
|
|
|
export interface ExportTaskRecord {
|
|
jobId: string
|
|
targetIds: string[]
|
|
targetNames: string[]
|
|
targetLabel: string
|
|
format: ExportFormat
|
|
includeVoiceTranscripts?: boolean
|
|
zip?: boolean
|
|
status: 'running' | 'completed' | 'cancelled' | 'failed'
|
|
progress: ExportJobProgress
|
|
createdAt: number
|
|
}
|
|
|
|
export interface ExportResult {
|
|
success: boolean
|
|
outputPath?: string
|
|
messageCount?: number
|
|
error?: string
|
|
}
|
|
export type ExportRendererApi = {
|
|
startExport: (request: ExportRequest) => Promise<ExportResult>
|
|
cancelExport: (jobId: string) => Promise<{ success: boolean }>
|
|
revealExport: (path: string) => Promise<{ success: boolean; error?: string }>
|
|
onExportProgress: (callback: (progress: ExportJobProgress) => void) => () => void
|
|
}
|
|
|
|
export type ExportMessage = Message
|