This commit is contained in:
Daniel 2023-11-02 09:49:29 +08:00
parent 50b2cef690
commit a952fd7e83
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
2 changed files with 7 additions and 3 deletions

View file

@ -72,9 +72,13 @@ func getInstalledPlugin(c *gin.Context) {
} }
frontend := arg["frontend"].(string) frontend := arg["frontend"].(string)
var keyword string
if keywordArg := arg["keyword"]; nil != keywordArg {
keyword = keywordArg.(string)
}
ret.Data = map[string]interface{}{ ret.Data = map[string]interface{}{
"packages": model.InstalledPlugins(frontend), "packages": model.InstalledPlugins(frontend, keyword),
} }
} }

View file

@ -60,9 +60,9 @@ func filterPlugins(plugins []*bazaar.Plugin, keyword string) (ret []*bazaar.Plug
return return
} }
func InstalledPlugins(frontend string) (plugins []*bazaar.Plugin) { func InstalledPlugins(frontend, keyword string) (plugins []*bazaar.Plugin) {
plugins = bazaar.InstalledPlugins(frontend, true) plugins = bazaar.InstalledPlugins(frontend, true)
plugins = filterPlugins(plugins, keyword)
petals := getPetals() petals := getPetals()
for _, plugin := range plugins { for _, plugin := range plugins {
petal := getPetalByName(plugin.Name, petals) petal := getPetalByName(plugin.Name, petals)