mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-08-17 11:37:06 +08:00
refactor: 移除微信 3.0 解密路径, 统一走 4.0 WCDB
- wechat-db.ts 删除 SQLCipher 回退、connectDb、getUser、tryOpenWechat4 等 3.0 专属逻辑 - image-decrypt-service.ts 删除 decryptDatV3 与 version === 0 分支 - index.ts 去除 wcdb4Client 冗余空值检查 - 移除 better-sqlite3-multiple-ciphers 依赖 - README 版本前置改为 4.0+ Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
+13
-18
@@ -113,16 +113,13 @@ app.whenReady().then(() => {
|
||||
wechatDb?.close()
|
||||
wechatDb = nextWechatDb
|
||||
const wcdb4Client = nextWechatDb.getWcdb4Client()
|
||||
let monitoring = false
|
||||
if (wcdb4Client) {
|
||||
voiceService = new VoiceService(wcdb4Client)
|
||||
stickerService = new StickerService(wcdb4Client)
|
||||
monitoring = wcdb4Client.startMonitor((type, json) => {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
if (!window.isDestroyed()) window.webContents.send('wcdb-change', { type, json })
|
||||
}
|
||||
})
|
||||
}
|
||||
voiceService = new VoiceService(wcdb4Client)
|
||||
stickerService = new StickerService(wcdb4Client)
|
||||
const monitoring = wcdb4Client.startMonitor((type, json) => {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
if (!window.isDestroyed()) window.webContents.send('wcdb-change', { type, json })
|
||||
}
|
||||
})
|
||||
imageDecryptService = null
|
||||
return { success: true, monitoring }
|
||||
} catch (error) {
|
||||
@@ -206,14 +203,13 @@ app.whenReady().then(() => {
|
||||
ipcMain.handle('db:getMessages', (_, userMd5: string, startTime?: number, endTime?: number) => {
|
||||
if (!wechatDb) return []
|
||||
const wcdb4Client = wechatDb.getWcdb4Client()
|
||||
const username = wcdb4Client?.getUsernameByMd5(userMd5)
|
||||
const username = wcdb4Client.getUsernameByMd5(userMd5)
|
||||
const rawMessages = wechatDb.getUserMessages(userMd5, startTime, endTime)
|
||||
const groupMembers = wechatDb.getGroupMembersForChat(userMd5)
|
||||
const myAvatar = wechatDb.getMyAvatarUrl()
|
||||
const myGroupNickname =
|
||||
username?.endsWith('@chatroom') && wcdb4Client
|
||||
? wcdb4Client.getMyGroupNickname(username)
|
||||
: undefined
|
||||
const myGroupNickname = username?.endsWith('@chatroom')
|
||||
? wcdb4Client.getMyGroupNickname(username)
|
||||
: undefined
|
||||
|
||||
return rawMessages.map((msg: WechatMessage) => {
|
||||
const rawMsgType = parseInt(msg.messageType)
|
||||
@@ -281,7 +277,7 @@ app.whenReady().then(() => {
|
||||
const imageDatName = parseImageDatNameFromRow(msg)
|
||||
contentData = { ...parsed, datName: parsed.datName || imageDatName }
|
||||
} else if (parsed.type !== 'system') {
|
||||
if (parsed.type === 'sticker' && !parsed.url && parsed.md5 && wcdb4Client) {
|
||||
if (parsed.type === 'sticker' && !parsed.url && parsed.md5) {
|
||||
parsed.url = wcdb4Client.resolveEmoticonCdnUrl(parsed.md5)
|
||||
}
|
||||
contentData = parsed
|
||||
@@ -301,7 +297,7 @@ app.whenReady().then(() => {
|
||||
) {
|
||||
const parsed = parseStickerMessageFromRow(msg, content)
|
||||
if (parsed.type === 'sticker') {
|
||||
if (!parsed.url && parsed.md5 && wcdb4Client) {
|
||||
if (!parsed.url && parsed.md5) {
|
||||
parsed.url = wcdb4Client.resolveEmoticonCdnUrl(parsed.md5)
|
||||
}
|
||||
content = ''
|
||||
@@ -333,7 +329,6 @@ app.whenReady().then(() => {
|
||||
ipcMain.handle('db:getGroupSnapshot', (_, userMd5: string) => {
|
||||
if (!wechatDb) return null
|
||||
const wcdb4Client = wechatDb.getWcdb4Client()
|
||||
if (!wcdb4Client) return null
|
||||
|
||||
const roomId = wcdb4Client.getUsernameByMd5(userMd5)
|
||||
if (!roomId || !roomId.endsWith('@chatroom')) return null
|
||||
|
||||
Reference in New Issue
Block a user