mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 支持通过密码短语派生数据仓库密钥 https://github.com/siyuan-note/siyuan/issues/5478
This commit is contained in:
parent
bd30383be5
commit
25d3985ed0
3 changed files with 58 additions and 0 deletions
|
|
@ -252,6 +252,28 @@ func importRepoKey(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func initRepoKeyFromPassphrase(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
pass := arg["pass"].(string)
|
||||
if err := model.InitRepoKeyFromPassphrase(pass); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = fmt.Sprintf(model.Conf.Language(137), err)
|
||||
ret.Data = map[string]interface{}{"closeTimeout": 5000}
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"key": model.Conf.Repo.Key,
|
||||
}
|
||||
}
|
||||
|
||||
func initRepoKey(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue