mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-30 13:28:48 +01:00
🎨 Support one-click enable/disable of all downloaded plugins https://github.com/siyuan-note/siyuan/issues/8523
This commit is contained in:
parent
6fa4245819
commit
d54195a943
3 changed files with 74 additions and 0 deletions
|
|
@ -61,3 +61,29 @@ func setPetalEnabled(c *gin.Context) {
|
|||
|
||||
ret.Data = data
|
||||
}
|
||||
|
||||
func setPetalConf(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
param, err := gulu.JSON.MarshalJSON(arg)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
conf := &model.PetalConf{}
|
||||
if err = gulu.JSON.UnmarshalJSON(param, conf); nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
conf.Save()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -363,4 +363,5 @@ func ServeAPI(ginServer *gin.Engine) {
|
|||
|
||||
ginServer.Handle("POST", "/api/petal/loadPetals", model.CheckAuth, model.CheckReadonly, loadPetals)
|
||||
ginServer.Handle("POST", "/api/petal/setPetalEnabled", model.CheckAuth, model.CheckReadonly, setPetalEnabled)
|
||||
ginServer.Handle("POST", "/api/petal/setPetalConf", model.CheckAuth, model.CheckReadonly, setPetalConf)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue