🎨 Community marketplace adds plugin section https://github.com/siyuan-note/siyuan/issues/8043

This commit is contained in:
Liang Ding 2023-04-25 18:56:27 +08:00
parent 4a5f3ea104
commit 88d70b0c00
No known key found for this signature in database
GPG key ID: 136F30F901A2231D
2 changed files with 13 additions and 80 deletions

View file

@ -32,15 +32,15 @@ func GetPackageREADME(repoURL, repoHash string) (ret string) {
return
}
func BazaarPlugins() (widgets []*bazaar.Widget) {
widgets = bazaar.Widgets()
for _, widget := range widgets {
widget.Installed = gulu.File.IsDir(filepath.Join(util.DataDir, "widgets", widget.Name))
if widget.Installed {
if widget.Installed {
if widgetConf, err := widgetJSON(widget.Name); nil == err && nil != widget {
if widget.Version != widgetConf["version"].(string) {
widget.Outdated = true
func BazaarPlugins() (plugins []*bazaar.Plugin) {
plugins = bazaar.Plugins()
for _, plugin := range plugins {
plugin.Installed = gulu.File.IsDir(filepath.Join(util.DataDir, "plugins", plugin.Name))
if plugin.Installed {
if plugin.Installed {
if pluginConf, err := bazaar.PluginJSON(plugin.Name); nil == err && nil != plugin {
if plugin.Version != pluginConf["version"].(string) {
plugin.Outdated = true
}
}
}
@ -78,7 +78,7 @@ func BazaarWidgets() (widgets []*bazaar.Widget) {
widget.Installed = gulu.File.IsDir(filepath.Join(util.DataDir, "widgets", widget.Name))
if widget.Installed {
if widget.Installed {
if widgetConf, err := widgetJSON(widget.Name); nil == err && nil != widget {
if widgetConf, err := bazaar.WidgetJSON(widget.Name); nil == err && nil != widget {
if widget.Version != widgetConf["version"].(string) {
widget.Outdated = true
}
@ -118,7 +118,7 @@ func BazaarIcons() (icons []*bazaar.Icon) {
for _, icon := range icons {
if installed == icon.Name {
icon.Installed = true
if themeConf, err := iconJSON(icon.Name); nil == err {
if themeConf, err := bazaar.IconJSON(icon.Name); nil == err {
if icon.Version != themeConf["version"].(string) {
icon.Outdated = true
}
@ -230,7 +230,7 @@ func BazaarTemplates() (templates []*bazaar.Template) {
for _, template := range templates {
template.Installed = gulu.File.IsExist(filepath.Join(util.DataDir, "templates", template.Name))
if template.Installed {
if themeConf, err := templateJSON(template.Name); nil == err && nil != themeConf {
if themeConf, err := bazaar.TemplateJSON(template.Name); nil == err && nil != themeConf {
if template.Version != themeConf["version"].(string) {
template.Outdated = true
}