This commit is contained in:
Liang Ding 2022-12-15 11:07:42 +08:00
parent a3718bbbfc
commit d880f155c6
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 111 additions and 18 deletions

View file

@ -26,6 +26,31 @@ import (
"github.com/siyuan-note/siyuan/kernel/util"
)
func openRepoSnapshotDoc(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
id := arg["id"].(string)
id, rootID, content, isLargeDoc, err := model.OpenRepoSnapshotDoc(id)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = map[string]interface{}{
"id": id,
"rootID": rootID,
"content": content,
"isLargeDoc": isLargeDoc,
}
}
func diffRepoSnapshots(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -298,6 +298,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/repo/uploadCloudSnapshot", model.CheckAuth, uploadCloudSnapshot)
ginServer.Handle("POST", "/api/repo/downloadCloudSnapshot", model.CheckAuth, downloadCloudSnapshot)
ginServer.Handle("POST", "/api/repo/diffRepoSnapshots", model.CheckAuth, diffRepoSnapshots)
ginServer.Handle("POST", "/api/repo/openRepoSnapshotDoc", model.CheckAuth, openRepoSnapshotDoc)
ginServer.Handle("POST", "/api/notification/pushMsg", model.CheckAuth, pushMsg)
ginServer.Handle("POST", "/api/notification/pushErrMsg", model.CheckAuth, pushErrMsg)