mirror of
https://github.com/teest114514/chatlog_alpha.git
synced 2026-04-06 12:26:38 +08:00
集成wx_key.dll并优化微信进程与密钥管理
新增DLL方式的微信数据库密钥提取(优先于原生方式),集成wx_key.dll相关代码和开发文档,完善临时账户名称与进程PID的动态管理,增强微信进程状态监控和自动切换逻辑。更新README,详细说明项目功能、使用方法和DLL集成指南。
This commit is contained in:
@@ -6,6 +6,7 @@ import (
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/sjzar/chatlog/internal/chatlog/ctx"
|
||||
"github.com/sjzar/chatlog/internal/ui/footer"
|
||||
"github.com/sjzar/chatlog/internal/ui/form"
|
||||
@@ -141,6 +142,24 @@ func (a *App) refresh() {
|
||||
case <-a.stopRefresh:
|
||||
return
|
||||
case <-tick.C:
|
||||
// 如果当前账号为空,尝试查找微信进程
|
||||
if a.ctx.Current == nil {
|
||||
// 获取微信实例
|
||||
instances := a.m.wechat.GetWeChatInstances()
|
||||
if len(instances) > 0 {
|
||||
// 找到微信进程,设置第一个为当前账号
|
||||
a.ctx.SwitchCurrent(instances[0])
|
||||
log.Info().Msgf("检测到微信进程,PID: %d,已设置为当前账号", instances[0].PID)
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新当前账号状态(如果存在)
|
||||
if a.ctx.Current != nil {
|
||||
a.ctx.Current.RefreshStatus()
|
||||
// 更新上下文信息
|
||||
a.ctx.Refresh()
|
||||
}
|
||||
|
||||
if a.ctx.AutoDecrypt || a.ctx.HTTPEnabled {
|
||||
a.m.RefreshSession()
|
||||
}
|
||||
|
||||
@@ -125,6 +125,7 @@ func (c *Context) SwitchCurrent(info *wechat.Account) {
|
||||
}
|
||||
func (c *Context) Refresh() {
|
||||
if c.Current != nil {
|
||||
oldAccount := c.Account
|
||||
c.Account = c.Current.Name
|
||||
c.Platform = c.Current.Platform
|
||||
c.Version = c.Current.Version
|
||||
@@ -132,15 +133,27 @@ func (c *Context) Refresh() {
|
||||
c.PID = int(c.Current.PID)
|
||||
c.ExePath = c.Current.ExePath
|
||||
c.Status = c.Current.Status
|
||||
if c.Current.Key != "" && c.Current.Key != c.DataKey {
|
||||
// 更新密钥数据 - 如果Current中的密钥为空,也更新Context
|
||||
if c.Current.Key != c.DataKey {
|
||||
c.DataKey = c.Current.Key
|
||||
}
|
||||
if c.Current.ImgKey != "" && c.Current.ImgKey != c.ImgKey {
|
||||
if c.Current.ImgKey != c.ImgKey {
|
||||
c.ImgKey = c.Current.ImgKey
|
||||
}
|
||||
if c.Current.DataDir != "" && c.Current.DataDir != c.DataDir {
|
||||
if c.Current.DataDir != c.DataDir {
|
||||
c.DataDir = c.Current.DataDir
|
||||
}
|
||||
|
||||
// 如果账号名称发生变化(例如从临时名称变为真实名称),更新历史记录
|
||||
if oldAccount != "" && oldAccount != c.Account {
|
||||
// 将旧的历史记录迁移到新的账号名称下
|
||||
if oldHistory, ok := c.History[oldAccount]; ok {
|
||||
c.History[c.Account] = oldHistory
|
||||
delete(c.History, oldAccount)
|
||||
// 更新配置
|
||||
c.UpdateConfig()
|
||||
}
|
||||
}
|
||||
}
|
||||
if c.DataUsage == "" && c.DataDir != "" {
|
||||
go func() {
|
||||
|
||||
Reference in New Issue
Block a user