feat: 完善多账号连接诊断与聊天媒体导出

- 新增微信账号发现、环境诊断和分步数据库连接引导
- 支持按账号安全保存数据库密钥及快速切换账号
- 完善 WCDB 历史消息分片读取和分页状态提示
- 支持导出图片、视频和语音,提供原图优先及缩略图回退
- 更新安装指引、兼容版本说明和相关自动化测试
This commit is contained in:
Wxw-Gu
2026-08-03 10:43:14 +08:00
parent 224308f0e0
commit 08e1294e5d
37 changed files with 2011 additions and 255 deletions
+45
View File
@@ -0,0 +1,45 @@
import { describe, expect, it, vi } from 'vitest'
import { Wcdb4Client, type Wcdb4Message } from '../../src/main/wcdb4-client'
const message = (id: string, year: number): Wcdb4Message => ({
mesLocalID: id,
serverId: `server-${id}`,
mesDes: 0,
messageType: '1',
msgCreateTime: String(Math.floor(Date.UTC(year, 0, 1) / 1000)),
msgContent: `fixture-${year}`,
raw: {}
})
describe('WCDB message shard pagination', () => {
it('merges cursor and all-store rows for a bounded cross-year page', async () => {
const cursor = vi.fn(async () => [message('2025', 2025)])
const tableScan = vi.fn(async () => [message('2017', 2017), message('2025', 2025)])
const client = Object.assign(Object.create(Wcdb4Client.prototype), {
wcdbGetMessageTableStats: vi.fn(),
wcdbExecQuery: vi.fn(),
getMessagesByCursorAsync: cursor,
getMessagesByTableScanAsync: tableScan
}) as Wcdb4Client
const result = await client.getMessagesAsync(
'fixture@chatroom',
undefined,
Math.floor(Date.UTC(2026, 0, 1) / 1000),
{ limit: 20 }
)
expect(tableScan).toHaveBeenCalledOnce()
expect(result.map((item) => item.msgContent)).toEqual(['fixture-2017', 'fixture-2025'])
})
it('reports an unsupported shard query instead of claiming history ended', async () => {
const client = Object.assign(Object.create(Wcdb4Client.prototype), {
getMessagesByCursorAsync: vi.fn(async () => [])
}) as Wcdb4Client
await expect(
client.getMessagesAsync('fixture@chatroom', undefined, 1_767_225_600, { limit: 20 })
).rejects.toThrow('无法检查历史消息分片')
})
})