mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-29 23:15:51 +00:00
fix: 支持微信 4.0.5+ 新数据目录结构 (Application Support/com.tencent.xinWeChat/2.0b4.0.x)
- dbPathService.autoDetect: 自动枚举版本目录(如 2.0b4.0.9),优先检测新路径 - dbPathService.getDefaultPath: 同步返回新版本路径 - keyServiceMac.resolveXwechatRootFromPath: 兼容新路径标记 - keyServiceMac.getKvcommCandidates: 补充新路径下的 kvcomm 推导 Fixes #551
This commit is contained in:
@@ -935,10 +935,17 @@ export class KeyServiceMac {
|
||||
private resolveXwechatRootFromPath(accountPath?: string): string | null {
|
||||
const normalized = String(accountPath || '').replace(/\\/g, '/').replace(/\/+$/, '')
|
||||
if (!normalized) return null
|
||||
|
||||
// 旧路径:xwechat_files
|
||||
const marker = '/xwechat_files'
|
||||
const markerIdx = normalized.indexOf(marker)
|
||||
if (markerIdx < 0) return null
|
||||
return normalized.slice(0, markerIdx + marker.length)
|
||||
if (markerIdx >= 0) return normalized.slice(0, markerIdx + marker.length)
|
||||
|
||||
// 新路径(微信 4.0.5+):Application Support/com.tencent.xinWeChat/2.0b4.0.9
|
||||
const newMarkerMatch = normalized.match(/^(.*\/com\.tencent\.xinWeChat\/(?:\d+\.\d+b\d+\.\d+|\d+\.\d+\.\d+))(\/|$)/)
|
||||
if (newMarkerMatch) return newMarkerMatch[1]
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
private pushAccountIdCandidates(candidates: string[], value?: string): void {
|
||||
@@ -1096,6 +1103,16 @@ export class KeyServiceMac {
|
||||
candidates.add(`${base}/app_data/net/kvcomm`)
|
||||
}
|
||||
|
||||
// 微信 4.0.5+ 新路径推导:版本目录同级的 net/kvcomm
|
||||
const newMarkerMatch = normalized.match(/^(.*\/com\.tencent\.xinWeChat\/(?:\d+\.\d+b\d+\.\d+|\d+\.\d+\.\d+))/)
|
||||
if (newMarkerMatch) {
|
||||
const versionBase = newMarkerMatch[1]
|
||||
candidates.add(`${versionBase}/net/kvcomm`)
|
||||
// 上级目录也尝试
|
||||
const parentBase = versionBase.replace(/\/[^\/]+$/, '')
|
||||
candidates.add(`${parentBase}/net/kvcomm`)
|
||||
}
|
||||
|
||||
let cursor = accountPath
|
||||
for (let i = 0; i < 6; i++) {
|
||||
candidates.add(join(cursor, 'net', 'kvcomm'))
|
||||
|
||||
Reference in New Issue
Block a user