mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 22:50:13 +01:00
🎨 Community marketplace adds plugin section https://github.com/siyuan-note/siyuan/issues/8043
This commit is contained in:
parent
0384261c95
commit
4a5f3ea104
5 changed files with 320 additions and 0 deletions
|
|
@ -41,6 +41,71 @@ func getBazaarPackageREAME(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
func getBazaarPlugin(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"packages": model.BazaarPlugins(),
|
||||
}
|
||||
}
|
||||
|
||||
func getInstalledPlugin(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"packages": model.InstalledPlugins(),
|
||||
}
|
||||
}
|
||||
|
||||
func installBazaarPlugin(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
repoURL := arg["repoURL"].(string)
|
||||
repoHash := arg["repoHash"].(string)
|
||||
packageName := arg["packageName"].(string)
|
||||
err := model.InstallBazaarPlugin(repoURL, repoHash, packageName)
|
||||
if nil != err {
|
||||
ret.Code = 1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
util.PushMsg(model.Conf.Language(69), 3000)
|
||||
ret.Data = map[string]interface{}{
|
||||
"packages": model.BazaarPlugins(),
|
||||
}
|
||||
}
|
||||
|
||||
func uninstallBazaarPlugin(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
||||
arg, ok := util.JsonArg(c, ret)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
packageName := arg["packageName"].(string)
|
||||
err := model.UninstallBazaarPlugin(packageName)
|
||||
if nil != err {
|
||||
ret.Code = -1
|
||||
ret.Msg = err.Error()
|
||||
return
|
||||
}
|
||||
|
||||
ret.Data = map[string]interface{}{
|
||||
"packages": model.BazaarPlugins(),
|
||||
}
|
||||
}
|
||||
|
||||
func getBazaarWidget(c *gin.Context) {
|
||||
ret := gulu.Ret.NewResult()
|
||||
defer c.JSON(http.StatusOK, ret)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue