Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-04-21 17:07:18 +08:00
commit 4cbb21e81a
10 changed files with 56 additions and 3 deletions

View File

@ -182,6 +182,7 @@
"keepLazyLoad": "Keep loaded content", "keepLazyLoad": "Keep loaded content",
"localSnapshot": "Local snapshot", "localSnapshot": "Local snapshot",
"localTagSnapshot": "Local tag snapshot", "localTagSnapshot": "Local tag snapshot",
"cloudSnapshot": "Cloud snapshot",
"cloudTagSnapshot": "Cloud tag snapshot", "cloudTagSnapshot": "Cloud tag snapshot",
"cloudBackupTip": "Please go to [Data History - Data Snapshot] to operate", "cloudBackupTip": "Please go to [Data History - Data Snapshot] to operate",
"snapshotMemo": "Snapshot Memo", "snapshotMemo": "Snapshot Memo",

View File

@ -182,6 +182,7 @@
"keepLazyLoad": "Mantener el contenido cargado", "keepLazyLoad": "Mantener el contenido cargado",
"localSnapshot": "Instantánea local", "localSnapshot": "Instantánea local",
"localTagSnapshot": "Instantánea de etiqueta local", "localTagSnapshot": "Instantánea de etiqueta local",
"cloudSnapshot": "Instantánea de la nube",
"cloudTagSnapshot": "Instantánea de etiquetas en la nube", "cloudTagSnapshot": "Instantánea de etiquetas en la nube",
"cloudBackupTip": "Vaya a [Historial de datos - Instantánea de datos] para operar", "cloudBackupTip": "Vaya a [Historial de datos - Instantánea de datos] para operar",
"snapshotMemo": "Memo de Instantánea", "snapshotMemo": "Memo de Instantánea",

View File

@ -181,6 +181,7 @@
"keepLazyLoad": "Conserver le contenu chargé", "keepLazyLoad": "Conserver le contenu chargé",
"localSnapshot": "Instantané local", "localSnapshot": "Instantané local",
"localTagSnapshot": "Instantané de balise locale", "localTagSnapshot": "Instantané de balise locale",
"cloudSnapshot": "Instantané cloud",
"cloudTagSnapshot": "Instantané de balise cloud", "cloudTagSnapshot": "Instantané de balise cloud",
"cloudBackupTip": "Veuillez accéder à [Historique des données - Instantané des données] pour opérer", "cloudBackupTip": "Veuillez accéder à [Historique des données - Instantané des données] pour opérer",
"snapshotMemo": "Mémo d'instantané", "snapshotMemo": "Mémo d'instantané",

View File

@ -182,6 +182,7 @@
"keepLazyLoad": "保持已載入的內容", "keepLazyLoad": "保持已載入的內容",
"localSnapshot": "本地快照", "localSnapshot": "本地快照",
"localTagSnapshot": "本地標記的快照", "localTagSnapshot": "本地標記的快照",
"cloudSnapshot": "雲端快照",
"cloudTagSnapshot": "雲端標記的快照", "cloudTagSnapshot": "雲端標記的快照",
"cloudBackupTip": "請到 [數據歷史 - 數據快照] 中進行操作", "cloudBackupTip": "請到 [數據歷史 - 數據快照] 中進行操作",
"snapshotMemo": "快照備註", "snapshotMemo": "快照備註",

View File

@ -182,6 +182,7 @@
"keepLazyLoad": "保持已加载的内容", "keepLazyLoad": "保持已加载的内容",
"localSnapshot": "本地快照", "localSnapshot": "本地快照",
"localTagSnapshot": "本地标记的快照", "localTagSnapshot": "本地标记的快照",
"cloudSnapshot": "云端快照",
"cloudTagSnapshot": "云端标记的快照", "cloudTagSnapshot": "云端标记的快照",
"cloudBackupTip": "请到 [数据历史 - 数据快照] 中进行操作", "cloudBackupTip": "请到 [数据历史 - 数据快照] 中进行操作",
"snapshotMemo": "快照备注", "snapshotMemo": "快照备注",

View File

@ -177,6 +177,30 @@ func getRepoSnapshots(c *gin.Context) {
} }
} }
func getCloudRepoSnapshots(c *gin.Context) {
ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret)
arg, ok := util.JsonArg(c, ret)
if !ok {
return
}
marker := arg["marker"].(string)
snapshots, nextMarker, err := model.GetCloudRepoSnapshots(marker)
if nil != err {
ret.Code = -1
ret.Msg = err.Error()
return
}
ret.Data = map[string]interface{}{
"snapshots": snapshots,
"nextMarker": nextMarker,
}
}
func getCloudRepoTagSnapshots(c *gin.Context) { func getCloudRepoTagSnapshots(c *gin.Context) {
ret := gulu.Ret.NewResult() ret := gulu.Ret.NewResult()
defer c.JSON(http.StatusOK, ret) defer c.JSON(http.StatusOK, ret)

View File

@ -305,6 +305,7 @@ func ServeAPI(ginServer *gin.Engine) {
ginServer.Handle("POST", "/api/repo/getRepoTagSnapshots", model.CheckAuth, getRepoTagSnapshots) ginServer.Handle("POST", "/api/repo/getRepoTagSnapshots", model.CheckAuth, getRepoTagSnapshots)
ginServer.Handle("POST", "/api/repo/removeRepoTagSnapshot", model.CheckAuth, model.CheckReadonly, removeRepoTagSnapshot) ginServer.Handle("POST", "/api/repo/removeRepoTagSnapshot", model.CheckAuth, model.CheckReadonly, removeRepoTagSnapshot)
ginServer.Handle("POST", "/api/repo/getCloudRepoTagSnapshots", model.CheckAuth, getCloudRepoTagSnapshots) ginServer.Handle("POST", "/api/repo/getCloudRepoTagSnapshots", model.CheckAuth, getCloudRepoTagSnapshots)
ginServer.Handle("POST", "/api/repo/getCloudRepoSnapshots", model.CheckAuth, getCloudRepoSnapshots)
ginServer.Handle("POST", "/api/repo/removeCloudRepoTagSnapshot", model.CheckAuth, model.CheckReadonly, removeCloudRepoTagSnapshot) ginServer.Handle("POST", "/api/repo/removeCloudRepoTagSnapshot", model.CheckAuth, model.CheckReadonly, removeCloudRepoTagSnapshot)
ginServer.Handle("POST", "/api/repo/uploadCloudSnapshot", model.CheckAuth, model.CheckReadonly, uploadCloudSnapshot) ginServer.Handle("POST", "/api/repo/uploadCloudSnapshot", model.CheckAuth, model.CheckReadonly, uploadCloudSnapshot)
ginServer.Handle("POST", "/api/repo/downloadCloudSnapshot", model.CheckAuth, model.CheckReadonly, downloadCloudSnapshot) ginServer.Handle("POST", "/api/repo/downloadCloudSnapshot", model.CheckAuth, model.CheckReadonly, downloadCloudSnapshot)

View File

@ -44,7 +44,7 @@ require (
github.com/radovskyb/watcher v1.0.7 github.com/radovskyb/watcher v1.0.7
github.com/sashabaranov/go-gpt3 v1.4.0 github.com/sashabaranov/go-gpt3 v1.4.0
github.com/shirou/gopsutil/v3 v3.23.2 github.com/shirou/gopsutil/v3 v3.23.2
github.com/siyuan-note/dejavu v0.0.0-20230420114155-e49d9fac7e77 github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9 github.com/siyuan-note/filelock v0.0.0-20230417044524-125ee78b5cc9

View File

@ -277,8 +277,8 @@ github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5g
github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d h1:lvCTyBbr36+tqMccdGMwuEU+hjux/zL6xSmf5S9ITaA=
github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw= github.com/shurcooL/gofontwoff v0.0.0-20181114050219-180f79e6909d/go.mod h1:05UtEgK5zq39gLST6uB0cf3NEHjETfB4Fgr3Gx5R9Vw=
github.com/siyuan-note/dejavu v0.0.0-20230420114155-e49d9fac7e77 h1:WTmknB4+c/mTn8h0c6GRtEZEi6APUaPTIA+veJbo/Lg= github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6 h1:s2BtWsabaCqDlS1D5A7zx63OCzpKjCW6Ke6rwpYhXCg=
github.com/siyuan-note/dejavu v0.0.0-20230420114155-e49d9fac7e77/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI= github.com/siyuan-note/dejavu v0.0.0-20230421090246-20abbaa745d6/go.mod h1:R3PnH4Y9/0TollG4g0tX7jGW7lvhNIEL9hYi5zQ4+sI=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29LW+Fm0cHc0J1NO1cZqyJwljSWVmfOqVZgaE=
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw= github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg= github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=

View File

@ -672,6 +672,29 @@ func GetCloudRepoTagSnapshots() (ret []*dejavu.Log, err error) {
return return
} }
func GetCloudRepoSnapshots(marker string) (ret []*dejavu.Log, nextMarker string, err error) {
ret = []*dejavu.Log{}
if 1 > len(Conf.Repo.Key) {
err = errors.New(Conf.Language(26))
return
}
repo, err := newRepository()
if nil != err {
return
}
logs, nextMarker, err := repo.GetCloudRepoLogs(marker)
if nil != err {
return
}
ret = logs
if 1 > len(ret) {
ret = []*dejavu.Log{}
}
return
}
func GetTagSnapshots() (ret []*Snapshot, err error) { func GetTagSnapshots() (ret []*Snapshot, err error) {
ret = []*Snapshot{} ret = []*Snapshot{}
if 1 > len(Conf.Repo.Key) { if 1 > len(Conf.Repo.Key) {