mirror of
https://github.com/sjzar/chatlog.git
synced 2026-06-05 21:04:51 +08:00
feat(setting): add image key manual setting (#238)
This commit is contained in:
parent
a638aa9c20
commit
dfd5faa3ac
@ -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() {
|
||||
// 使用我们的自定义表单组件
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user