This commit is contained in:
Liang Ding 2022-07-05 21:44:10 +08:00
parent a3c3ec7b83
commit 4388d8dee7
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
5 changed files with 39 additions and 3 deletions

View file

@ -66,6 +66,22 @@ func getRepoSnapshots(c *gin.Context) {
}
}
func getCloudRepoTagSnapshots(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
snapshots, err := model.GetCloudRepoTagSnapshots()
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = map[string]interface{}{
"snapshots": snapshots,
}
}
func getRepoTagSnapshots(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)

View file

@ -259,6 +259,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/repo/checkoutRepo", model.CheckAuth, checkoutRepo)
ginServer.Handle("POST", "/api/repo/getRepoSnapshots", model.CheckAuth, getRepoSnapshots)
ginServer.Handle("POST", "/api/repo/getRepoTagSnapshots", model.CheckAuth, getRepoTagSnapshots)
ginServer.Handle("POST", "/api/repo/getCloudRepoTagSnapshots", model.CheckAuth, getCloudRepoTagSnapshots)
ginServer.Handle("POST", "/api/notification/pushMsg", model.CheckAuth, pushMsg)
ginServer.Handle("POST", "/api/notification/pushErrMsg", model.CheckAuth, pushErrMsg)

View file

@ -40,7 +40,7 @@ require (
github.com/qiniu/go-sdk/v7 v7.13.0
github.com/radovskyb/watcher v1.0.7
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06
github.com/siyuan-note/dejavu v0.0.0-20220705125104-36d41a632c95
github.com/siyuan-note/dejavu v0.0.0-20220705134218-88ed5d571f17
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f
github.com/siyuan-note/filelock v0.0.0-20220704090116-54dfb035283f

View file

@ -421,8 +421,8 @@ github.com/shurcooL/httpfs v0.0.0-20190707220628-8d4bc4ba7749/go.mod h1:ZY1cvUeJ
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
github.com/shurcooL/vfsgen v0.0.0-20200824052919-0d455de96546/go.mod h1:TrYk7fJVaAttu97ZZKrO9UbRa8izdowaMIZcxYMbVaw=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/siyuan-note/dejavu v0.0.0-20220705125104-36d41a632c95 h1:anS+/6mZrID0lYZr/7KeQpuiJBpAVrjpc/UQXZg2KT8=
github.com/siyuan-note/dejavu v0.0.0-20220705125104-36d41a632c95/go.mod h1:ral+X0pNW6nSQVvIcxllUXSczCaY4UOCT2iGlO4YNg0=
github.com/siyuan-note/dejavu v0.0.0-20220705134218-88ed5d571f17 h1:jGNRM0wvFekdVPOM2+IYpuAE2NLf1QNuxz4yKrJ9jMw=
github.com/siyuan-note/dejavu v0.0.0-20220705134218-88ed5d571f17/go.mod h1:ral+X0pNW6nSQVvIcxllUXSczCaY4UOCT2iGlO4YNg0=
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676 h1:QB9TjJQFhXhZ6dAtPpY02DlzHAQm1C+WqZq6OadG8mI=
github.com/siyuan-note/encryption v0.0.0-20220612074546-f1dd94fe8676/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20220624162334-ca7c06dc771f h1:JMobMNZ7AqaKKyEK+WeWFhix/2TDQXgPZDajU00IybU=

View file

@ -193,6 +193,25 @@ func CheckoutRepo(id string) (err error) {
return
}
func GetCloudRepoTagSnapshots() (tags []*dejavu.Log, err error) {
if 1 > len(Conf.Repo.Key) {
err = errors.New(Conf.Language(26))
return
}
repo, err := newRepository()
if nil != err {
return
}
cloudInfo, err := buildCloudInfo()
if nil != err {
return
}
tags, err = repo.GetCloudRepoTagLogs(cloudInfo, map[string]interface{}{CtxPushMsg: CtxPushMsgToStatusBar})
return
}
func GetTagSnapshots() (ret []*dejavu.Log, err error) {
if 1 > len(Conf.Repo.Key) {
err = errors.New(Conf.Language(26))