An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Community marketplace adds plugin section https://github.com/siyuan-note/siyuan/issues/8043
Liang Ding88d70b0c00c7
diff --git a/kernel/model/appearance.go b/kernel/model/appearance.goindex b9dc19db39..c70e1bcd58 100644--- a/kernel/model/appearance.go+++ b/kernel/model/appearance.go@@ -17,7 +17,6 @@package modelimport (- "errors""fmt""os""path/filepath"@@ -142,72 +141,6 @@ func loadThemes() {}}-func iconJSON(iconName string) (ret map[string]interface{}, err error) {- p := filepath.Join(util.IconsPath, iconName, "icon.json")- if !gulu.File.IsExist(p) {- err = os.ErrNotExist- return- }- data, err := os.ReadFile(p)- if nil != err {- logging.LogErrorf("read icon.json [%s] failed: %s", p, err)- return- }- if err = gulu.JSON.UnmarshalJSON(data, &ret); nil != err {- logging.LogErrorf("parse icon.json [%s] failed: %s", p, err)- return- }- if 4 > len(ret) {- logging.LogWarnf("invalid icon.json [%s]", p)- return nil, errors.New("invalid icon.json")- }- return-}--func templateJSON(templateName string) (ret map[string]interface{}, err error) {- p := filepath.Join(util.DataDir, "templates", templateName, "template.json")- if !gulu.File.IsExist(p) {- err = os.ErrNotExist- return- }- data, err := os.ReadFile(p)- if nil != err {- logging.LogErrorf("read template.json [%s] failed: %s", p, err)- return- }- if err = gulu.JSON.UnmarshalJSON(data, &ret); nil != err {- logging.LogErrorf("parse template.json [%s] failed: %s", p, err)- return- }- if 4 > len(ret) {- logging.LogWarnf("invalid template.json [%s]", p)- return nil, errors.New("invalid template.json")- }- return-}--func widgetJSON(widgetName string) (ret map[string]interface{}, err error) {- p := filepath.Join(util.DataDir, "widgets", widgetName, "widget.json")- if !gulu.File.IsExist(p) {- err = os.ErrNotExist- return- }- data, err := os.ReadFile(p)- if nil != err {- logging.LogErrorf("read widget.json [%s] failed: %s", p, err)- return- }- if err = gulu.JSON.UnmarshalJSON(data, &ret); nil != err {- logging.LogErrorf("parse widget.json [%s] failed: %s", p, err)- return- }- if 4 > len(ret) {- logging.LogWarnf("invalid widget.json [%s]", p)- return nil, errors.New("invalid widget.json")- }- return-}-func loadIcons() {iconDirs, err := os.ReadDir(util.IconsPath)if nil != err {@@ -222,7 +155,7 @@ func loadIcons() {continue}name := iconDir.Name()- iconConf, err := iconJSON(name)+ iconConf, err := bazaar.IconJSON(name)if nil != err || nil == iconConf {continue}diff --git a/kernel/model/bazzar.go b/kernel/model/bazzar.goindex a3130e274d..a7c6f4b6ca 100644--- a/kernel/model/bazzar.go+++ b/kernel/model/bazzar.go@@ -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}