🔒 内核接口 api/system/getConf 脱敏处理 Fix https://github.com/siyuan-note/siyuan/issues/6088

This commit is contained in:
Liang Ding 2022-10-08 10:57:20 +08:00
parent 2fa3944459
commit c048bde330
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 35 additions and 1 deletions

View file

@ -146,8 +146,15 @@ func getConf(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
maskedConf, err := model.GetMaskedConf()
if nil != err {
ret.Code = -1
ret.Msg = "get conf failed: " + err.Error()
return
}
ret.Data = map[string]interface{}{
"conf": model.Conf,
"conf": maskedConf,
"start": start,
}
@ -193,6 +200,10 @@ func setAccessAuthCode(c *gin.Context) {
}
aac := arg["accessAuthCode"].(string)
if model.MaskedAccessAuthCode == aac {
aac = model.Conf.AccessAuthCode
}
model.Conf.AccessAuthCode = aac
model.Conf.Save()