mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 07:00:12 +01:00
🎨 One-click upgrade of downloaded marketplace packages https://github.com/siyuan-note/siyuan/issues/8390
This commit is contained in:
parent
77350cc6fa
commit
c45e80b9e0
3 changed files with 30 additions and 0 deletions
|
|
@ -25,6 +25,26 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func getBazaarPackages(c *gin.Context) {
|
||||||
|
ret := gulu.Ret.NewResult()
|
||||||
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
frontend := arg["frontend"].(string)
|
||||||
|
plugins, widgets, icons, themes, templates := model.BazaarPackages(frontend)
|
||||||
|
ret.Data = map[string]interface{}{
|
||||||
|
"plugins": plugins,
|
||||||
|
"widgets": widgets,
|
||||||
|
"icons": icons,
|
||||||
|
"themes": themes,
|
||||||
|
"templates": templates,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getBazaarPackageREAME(c *gin.Context) {
|
func getBazaarPackageREAME(c *gin.Context) {
|
||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
|
||||||
|
|
@ -330,6 +330,7 @@ func ServeAPI(ginServer *gin.Engine) {
|
||||||
ginServer.Handle("POST", "/api/graph/getGraph", model.CheckAuth, getGraph)
|
ginServer.Handle("POST", "/api/graph/getGraph", model.CheckAuth, getGraph)
|
||||||
ginServer.Handle("POST", "/api/graph/getLocalGraph", model.CheckAuth, getLocalGraph)
|
ginServer.Handle("POST", "/api/graph/getLocalGraph", model.CheckAuth, getLocalGraph)
|
||||||
|
|
||||||
|
ginServer.Handle("POST", "/api/bazaar/getBazaarPackages", model.CheckAuth, getBazaarPackages)
|
||||||
ginServer.Handle("POST", "/api/bazaar/getBazaarPlugin", model.CheckAuth, getBazaarPlugin)
|
ginServer.Handle("POST", "/api/bazaar/getBazaarPlugin", model.CheckAuth, getBazaarPlugin)
|
||||||
ginServer.Handle("POST", "/api/bazaar/getInstalledPlugin", model.CheckAuth, getInstalledPlugin)
|
ginServer.Handle("POST", "/api/bazaar/getInstalledPlugin", model.CheckAuth, getInstalledPlugin)
|
||||||
ginServer.Handle("POST", "/api/bazaar/installBazaarPlugin", model.CheckAuth, model.CheckReadonly, installBazaarPlugin)
|
ginServer.Handle("POST", "/api/bazaar/installBazaarPlugin", model.CheckAuth, model.CheckReadonly, installBazaarPlugin)
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,15 @@ import (
|
||||||
"github.com/siyuan-note/siyuan/kernel/bazaar"
|
"github.com/siyuan-note/siyuan/kernel/bazaar"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func BazaarPackages(frontend string) (plugins []*bazaar.Plugin, widgets []*bazaar.Widget, icons []*bazaar.Icon, themes []*bazaar.Theme, templates []*bazaar.Template) {
|
||||||
|
plugins = BazaarPlugins(frontend, "")
|
||||||
|
widgets = BazaarWidgets("")
|
||||||
|
icons = BazaarIcons("")
|
||||||
|
themes = BazaarThemes("")
|
||||||
|
templates = BazaarTemplates("")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
func GetPackageREADME(repoURL, repoHash, packageType string) (ret string) {
|
func GetPackageREADME(repoURL, repoHash, packageType string) (ret string) {
|
||||||
ret = bazaar.GetPackageREADME(repoURL, repoHash, packageType)
|
ret = bazaar.GetPackageREADME(repoURL, repoHash, packageType)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue