mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-03 23:49:13 +08:00
🎨 Support search installed plugins https://github.com/siyuan-note/siyuan/issues/9577
This commit is contained in:
parent
cf8e748260
commit
5fd8cb121b
@ -155,8 +155,18 @@ func getInstalledWidget(c *gin.Context) {
|
|||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyword string
|
||||||
|
if keywordArg := arg["keyword"]; nil != keywordArg {
|
||||||
|
keyword = keywordArg.(string)
|
||||||
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"packages": model.InstalledWidgets(),
|
"packages": model.InstalledWidgets(keyword),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,8 +240,18 @@ func getInstalledIcon(c *gin.Context) {
|
|||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyword string
|
||||||
|
if keywordArg := arg["keyword"]; nil != keywordArg {
|
||||||
|
keyword = keywordArg.(string)
|
||||||
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"packages": model.InstalledIcons(),
|
"packages": model.InstalledIcons(keyword),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,8 +327,18 @@ func getInstalledTemplate(c *gin.Context) {
|
|||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyword string
|
||||||
|
if keywordArg := arg["keyword"]; nil != keywordArg {
|
||||||
|
keyword = keywordArg.(string)
|
||||||
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"packages": model.InstalledTemplates(),
|
"packages": model.InstalledTemplates(keyword),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,8 +413,18 @@ func getInstalledTheme(c *gin.Context) {
|
|||||||
ret := gulu.Ret.NewResult()
|
ret := gulu.Ret.NewResult()
|
||||||
defer c.JSON(http.StatusOK, ret)
|
defer c.JSON(http.StatusOK, ret)
|
||||||
|
|
||||||
|
arg, ok := util.JsonArg(c, ret)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var keyword string
|
||||||
|
if keywordArg := arg["keyword"]; nil != keywordArg {
|
||||||
|
keyword = keywordArg.(string)
|
||||||
|
}
|
||||||
|
|
||||||
ret.Data = map[string]interface{}{
|
ret.Data = map[string]interface{}{
|
||||||
"packages": model.InstalledThemes(),
|
"packages": model.InstalledThemes(keyword),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,8 +131,9 @@ func filterWidgets(widgets []*bazaar.Widget, keyword string) (ret []*bazaar.Widg
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func InstalledWidgets() (widgets []*bazaar.Widget) {
|
func InstalledWidgets(keyword string) (widgets []*bazaar.Widget) {
|
||||||
widgets = bazaar.InstalledWidgets()
|
widgets = bazaar.InstalledWidgets()
|
||||||
|
widgets = filterWidgets(widgets, keyword)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,8 +185,9 @@ func filterIcons(icons []*bazaar.Icon, keyword string) (ret []*bazaar.Icon) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func InstalledIcons() (icons []*bazaar.Icon) {
|
func InstalledIcons(keyword string) (icons []*bazaar.Icon) {
|
||||||
icons = bazaar.InstalledIcons()
|
icons = bazaar.InstalledIcons()
|
||||||
|
icons = filterIcons(icons, keyword)
|
||||||
for _, icon := range icons {
|
for _, icon := range icons {
|
||||||
icon.Current = icon.Name == Conf.Appearance.Icon
|
icon.Current = icon.Name == Conf.Appearance.Icon
|
||||||
}
|
}
|
||||||
@ -245,8 +247,9 @@ func filterThemes(themes []*bazaar.Theme, keyword string) (ret []*bazaar.Theme)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func InstalledThemes() (ret []*bazaar.Theme) {
|
func InstalledThemes(keyword string) (ret []*bazaar.Theme) {
|
||||||
ret = bazaar.InstalledThemes()
|
ret = bazaar.InstalledThemes()
|
||||||
|
ret = filterThemes(ret, keyword)
|
||||||
for _, theme := range ret {
|
for _, theme := range ret {
|
||||||
theme.Current = theme.Name == Conf.Appearance.ThemeDark || theme.Name == Conf.Appearance.ThemeLight
|
theme.Current = theme.Name == Conf.Appearance.ThemeDark || theme.Name == Conf.Appearance.ThemeLight
|
||||||
}
|
}
|
||||||
@ -318,8 +321,9 @@ func filterTemplates(templates []*bazaar.Template, keyword string) (ret []*bazaa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func InstalledTemplates() (templates []*bazaar.Template) {
|
func InstalledTemplates(keyword string) (templates []*bazaar.Template) {
|
||||||
templates = bazaar.InstalledTemplates()
|
templates = bazaar.InstalledTemplates()
|
||||||
|
templates = filterTemplates(templates, keyword)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user