mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-19 21:48:06 +01:00
🎨 Automatic purge for local data repo https://github.com/siyuan-note/siyuan/issues/13091
This commit is contained in:
parent
93b687a407
commit
6a442ad85d
23 changed files with 259 additions and 15 deletions
|
|
@ -29,6 +29,40 @@ import (
|
|||
"github.com/siyuan-note/siyuan/kernel/util"
|
||||
)
|
||||
|
||||
func setRepoIndexRetentionDays(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
days := int(arg["days"].(float64))
|
||||
if 1 > days {
|
||||
days = 180
|
||||
}
|
||||
|
||||
model.Conf.Repo.IndexRetentionDays = days
|
||||
model.Conf.Save()
|
||||
}
|
||||
|
||||
func setRetentionIndexesDaily(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
indexes := int(arg["indexes"].(float64))
|
||||
if 1 > indexes {
|
||||
indexes = 180
|
||||
}
|
||||
|
||||
model.Conf.Repo.RetentionIndexesDaily = indexes
|
||||
model.Conf.Save()
|
||||
}
|
||||
|
||||
func getRepoFile(c *gin.Context) {
|
||||
// Add internal kernel API `/api/repo/getRepoFile` https://github.com/siyuan-note/siyuan/issues/10101
|
||||
|
||||
|
|
|
|||
|
|
@ -390,6 +390,8 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
ginServer.Handle("POST", "/api/repo/diffRepoSnapshots", model.CheckAuth, model.CheckAdminRole, diffRepoSnapshots)
|
||||
ginServer.Handle("POST", "/api/repo/openRepoSnapshotDoc", model.CheckAuth, model.CheckAdminRole, openRepoSnapshotDoc)
|
||||
ginServer.Handle("POST", "/api/repo/getRepoFile", model.CheckAuth, model.CheckAdminRole, getRepoFile)
|
||||
ginServer.Handle("POST", "/api/repo/setRepoIndexRetentionDays", model.CheckAuth, model.CheckAdminRole, setRepoIndexRetentionDays)
|
||||
ginServer.Handle("POST", "/api/repo/setRetentionIndexesDaily", model.CheckAuth, model.CheckAdminRole, setRetentionIndexesDaily)
|
||||
|
||||
ginServer.Handle("POST", "/api/riff/createRiffDeck", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, createRiffDeck)
|
||||
ginServer.Handle("POST", "/api/riff/renameRiffDeck", model.CheckAuth, model.CheckAdminRole, model.CheckReadonly, renameRiffDeck)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue