mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 初始化数据仓库密钥时自动创建第一个数据快照
This commit is contained in:
parent
a9651ad07e
commit
719aa13838
2 changed files with 20 additions and 8 deletions
|
|
@ -20,7 +20,6 @@ import (
|
|||
"encoding/hex"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
@ -95,31 +94,24 @@ func importRepoKey(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
msgId := util.PushMsg(model.Conf.Language(136), 1000*7)
|
||||
hexKey := arg["key"].(string)
|
||||
if err := model.ImportRepoKey(hexKey); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(137)
|
||||
return
|
||||
}
|
||||
time.Sleep(1 * time.Second)
|
||||
util.PushUpdateMsg(msgId, model.Conf.Language(138), 3000)
|
||||
}
|
||||
|
||||
func initRepoKey(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
msgId := util.PushMsg(model.Conf.Language(136), 1000*7)
|
||||
if err := model.InitRepoKey(); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = model.Conf.Language(137)
|
||||
return
|
||||
}
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
util.PushUpdateMsg(msgId, model.Conf.Language(138), 3000)
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"key": hex.EncodeToString(model.Conf.Repo.Key),
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue