mirror of
https://wget.la/https://github.com/Wxw-Gu/WechatExplorer
synced 2026-12-01 01:05:30 +08:00
fix: 更新打包配置并修复群昵称刷新
更新跨平台 WCDB 和运行时命名。 优化消息获取速度 修复群昵称刷新回退与消息发送者显示,并增加可控的消息读取诊断日志和有界查询优化。
This commit is contained in:
1 parent
fc54c3b946
commit
47e0d7cd1e
25 files changed
+415
-148
No files matched your search
@@ -603,23 +603,49 @@ export function saveCachedGroupSnapshot(
|
||||
accountRoot: string,
|
||||
userMd5: string,
|
||||
snapshot: CachedGroupSnapshot
|
||||
): void {
|
||||
): CachedGroupSnapshot {
|
||||
const normalizedRoot = normalizeRoot(accountRoot)
|
||||
if (!normalizedRoot || !userMd5) return
|
||||
if (!normalizedRoot || !userMd5) return snapshot
|
||||
const paths = getAccountCachePaths(normalizedRoot)
|
||||
const file = getGroupCacheFile(normalizedRoot, userMd5)
|
||||
const previous = readGroupSnapshotFile(normalizedRoot, userMd5)?.snapshot
|
||||
const previousByWxid = new Map((previous?.members || []).map((member) => [member.wxid, member]))
|
||||
const mergedSnapshot: CachedGroupSnapshot = previous && previous.roomId === snapshot.roomId
|
||||
? {
|
||||
...snapshot,
|
||||
members: snapshot.members.map((member) => {
|
||||
const oldMember = previousByWxid.get(member.wxid)
|
||||
const freshGroupNickname = String(member.groupNickname || '').trim()
|
||||
const freshWechatNickname = String(member.wechatNickname || '').trim()
|
||||
const oldGroupNickname = String(oldMember?.groupNickname || '').trim()
|
||||
const freshLooksLikeContactFallback =
|
||||
!freshGroupNickname ||
|
||||
freshGroupNickname === freshWechatNickname
|
||||
const groupNickname =
|
||||
freshLooksLikeContactFallback && oldGroupNickname
|
||||
? oldGroupNickname
|
||||
: freshGroupNickname
|
||||
return {
|
||||
...member,
|
||||
groupNickname,
|
||||
nickname: groupNickname || member.nickname
|
||||
}
|
||||
})
|
||||
}
|
||||
: snapshot
|
||||
const value: CachedGroupSnapshotFile = {
|
||||
version: CACHE_VERSION,
|
||||
platform: process.platform,
|
||||
accountRoot: normalizedRoot,
|
||||
userMd5,
|
||||
updatedAt: Date.now(),
|
||||
snapshot
|
||||
snapshot: mergedSnapshot
|
||||
}
|
||||
touchMemory(groupMemory, file, value, MAX_MEMORY_GROUP_SNAPSHOTS)
|
||||
scheduleWrite(file, value, {
|
||||
prune: { directory: paths.groups, maxFiles: MAX_GROUP_SNAPSHOTS }
|
||||
})
|
||||
return mergedSnapshot
|
||||
}
|
||||
|
||||
export function saveCachedMessages(
|
||||
|
||||
Reference in new issue
Block a user