mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-07 09:18:49 +01:00
🔒 Randomly generate the cookie key https://github.com/siyuan-note/siyuan/issues/16690
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
cef8ca8cf7
commit
a65dcd220f
5 changed files with 13 additions and 7 deletions
|
|
@ -82,6 +82,7 @@ type AppConf struct {
|
|||
CloudRegion int `json:"cloudRegion"` // 云端区域,0:中国大陆,1:北美
|
||||
Snippet *conf.Snpt `json:"snippet"` // 代码片段
|
||||
DataIndexState int `json:"dataIndexState"` // 数据索引状态,0:已索引,1:未索引
|
||||
CookieKey string `json:"cookieKey"` // 用于加密 Cookie 的密钥
|
||||
|
||||
m *sync.RWMutex // 配置数据锁
|
||||
userLock *sync.RWMutex // 用户数据独立锁,避免与配置保存操作竞争
|
||||
|
|
@ -579,6 +580,10 @@ func InitConf() {
|
|||
|
||||
Conf.DataIndexState = 0
|
||||
|
||||
if "" == Conf.CookieKey {
|
||||
Conf.CookieKey = gulu.Rand.String(16)
|
||||
}
|
||||
|
||||
Conf.Save()
|
||||
logging.SetLogLevel(Conf.LogLevel)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue