mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-22 15:04:07 +01:00
🔒 内核接口 api/system/getConf 脱敏处理 Fix https://github.com/siyuan-note/siyuan/issues/6088
This commit is contained in:
parent
2fa3944459
commit
c048bde330
2 changed files with 35 additions and 1 deletions
|
|
@ -582,6 +582,29 @@ func IsSubscriber() bool {
|
|||
return nil != Conf.User && (-1 == Conf.User.UserSiYuanProExpireTime || 0 < Conf.User.UserSiYuanProExpireTime) && 0 == Conf.User.UserSiYuanSubscriptionStatus
|
||||
}
|
||||
|
||||
const (
|
||||
MaskedUserData = ""
|
||||
MaskedAccessAuthCode = "*******"
|
||||
)
|
||||
|
||||
func GetMaskedConf() (ret *AppConf, err error) {
|
||||
// 脱敏处理
|
||||
data, err := gulu.JSON.MarshalIndentJSON(Conf, "", " ")
|
||||
if nil != err {
|
||||
logging.LogErrorf("marshal conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
ret = &AppConf{}
|
||||
if err = gulu.JSON.UnmarshalJSON(data, ret); nil != err {
|
||||
logging.LogErrorf("unmarshal conf failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
ret.UserData = MaskedUserData
|
||||
ret.AccessAuthCode = MaskedAccessAuthCode
|
||||
return
|
||||
}
|
||||
|
||||
func clearWorkspaceTemp() {
|
||||
os.RemoveAll(filepath.Join(util.TempDir, "bazaar"))
|
||||
os.RemoveAll(filepath.Join(util.TempDir, "export"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue