feat(setting): add image key manual setting (#238)

This commit is contained in:
Symb0x76 2025-09-02 17:01:55 +08:00 committed by GitHub
parent a638aa9c20
commit dfd5faa3ac
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 39 additions and 0 deletions

View File

@ -484,6 +484,11 @@ func (a *App) settingSelected(i *menu.Item) {
description: "配置数据解密密钥",
action: a.settingDataKey,
},
{
name: "设置图片密钥",
description: "配置图片解密密钥",
action: a.settingImgKey,
},
{
name: "设置数据目录",
description: "配置微信数据文件所在目录",
@ -594,6 +599,30 @@ func (a *App) settingDataKey() {
a.SetFocus(formView)
}
// settingImgKey 设置图片密钥 (ImgKey)
func (a *App) settingImgKey() {
formView := form.NewForm("设置图片密钥")
tempImgKey := a.ctx.ImgKey
formView.AddInputField("图片密钥", tempImgKey, 0, nil, func(text string) {
tempImgKey = text
})
formView.AddButton("保存", func() {
a.ctx.SetImgKey(tempImgKey)
a.mainPages.RemovePage("submenu2")
a.showInfo("图片密钥已设置")
})
formView.AddButton("取消", func() {
a.mainPages.RemovePage("submenu2")
})
a.mainPages.AddPage("submenu2", formView, true, true)
a.SetFocus(formView)
}
// settingDataDir 设置数据目录
func (a *App) settingDataDir() {
// 使用我们的自定义表单组件

View File

@ -227,6 +227,16 @@ func (c *Context) SetDataDir(dir string) {
c.Refresh()
}
func (c *Context) SetImgKey(key string) {
c.mu.Lock()
defer c.mu.Unlock()
if c.ImgKey == key {
return
}
c.ImgKey = key
c.UpdateConfig()
}
func (c *Context) SetAutoDecrypt(enabled bool) {
c.mu.Lock()
defer c.mu.Unlock()