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: Improve minimum version requirements for marketplace packages https://github.com/siyuan-note/siyuan/issues/16688
Daniel818846025ba3
diff --git a/kernel/bazaar/icon.go b/kernel/bazaar/icon.goindex 5372ea632a..92af7c44b7 100644--- a/kernel/bazaar/icon.go+++ b/kernel/bazaar/icon.go@@ -86,6 +86,9 @@ func Icons() (icons []*Icon) {}icon.DisallowInstall = disallowInstallBazaarPackage(icon.Package)+ icon.DisallowUpdate = disallowInstallBazaarPackage(icon.Package)+ icon.UpdateRequiredMinAppVer = icon.MinAppVersion+icon.URL = strings.TrimSuffix(icon.URL, "/")repoURLHash := strings.Split(repoURL, "@")icon.RepoURL = "https://github.com/" + repoURLHash[0]@@ -157,6 +160,10 @@ func InstalledIcons() (ret []*Icon) {}icon.DisallowInstall = disallowInstallBazaarPackage(icon.Package)+ if bazaarPkg := getBazaarIcon(icon.Name, bazaarIcons); nil != bazaarPkg {+ icon.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)+ icon.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion+ }installPath := filepath.Join(util.IconsPath, dirName)icon.Installed = true@@ -192,6 +199,15 @@ func isBuiltInIcon(dirName string) bool {return "ant" == dirName || "material" == dirName}+func getBazaarIcon(name string, icon []*Icon) *Icon {+ for _, p := range icon {+ if p.Name == name {+ return p+ }+ }+ return nil+}+func InstallIcon(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHashdata, err := downloadPackage(repoURLHash, true, systemID)diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.goindex dd53ef4735..85a132e362 100644--- a/kernel/bazaar/package.go+++ b/kernel/bazaar/package.go@@ -130,20 +130,22 @@ type Package struct {PreviewURLThumb string `json:"previewURLThumb"`IconURL string `json:"iconURL"`- Installed bool `json:"installed"`- Outdated bool `json:"outdated"`- Current bool `json:"current"`- Updated string `json:"updated"`- Stars int `json:"stars"`- OpenIssues int `json:"openIssues"`- Size int64 `json:"size"`- HSize string `json:"hSize"`- InstallSize int64 `json:"installSize"`- HInstallSize string `json:"hInstallSize"`- HInstallDate string `json:"hInstallDate"`- HUpdated string `json:"hUpdated"`- Downloads int `json:"downloads"`- DisallowInstall bool `json:"disallowInstall"`+ Installed bool `json:"installed"`+ Outdated bool `json:"outdated"`+ Current bool `json:"current"`+ Updated string `json:"updated"`+ Stars int `json:"stars"`+ OpenIssues int `json:"openIssues"`+ Size int64 `json:"size"`+ HSize string `json:"hSize"`+ InstallSize int64 `json:"installSize"`+ HInstallSize string `json:"hInstallSize"`+ HInstallDate string `json:"hInstallDate"`+ HUpdated string `json:"hUpdated"`+ Downloads int `json:"downloads"`+ DisallowInstall bool `json:"disallowInstall"`+ DisallowUpdate bool `json:"disallowUpdate"`+ UpdateRequiredMinAppVer string `json:"updateRequiredMinAppVer"`Incompatible bool `json:"incompatible"`}diff --git a/kernel/bazaar/plugin.go b/kernel/bazaar/plugin.goindex bfaa44c157..4f19627492 100644--- a/kernel/bazaar/plugin.go+++ b/kernel/bazaar/plugin.go@@ -88,6 +88,8 @@ func Plugins(frontend string) (plugins []*Plugin) {}plugin.DisallowInstall = disallowInstallBazaarPackage(plugin.Package)+ plugin.DisallowUpdate = disallowInstallBazaarPackage(plugin.Package)+ plugin.UpdateRequiredMinAppVer = plugin.MinAppVersionplugin.Incompatible = isIncompatiblePlugin(plugin, frontend)plugin.URL = strings.TrimSuffix(plugin.URL, "/")@@ -166,7 +168,7 @@ func ParseInstalledPlugin(name, frontend string) (found bool, displayName stringreturn}-func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {+func InstalledPlugins(frontend string) (ret []*Plugin) {ret = []*Plugin{}pluginsPath := filepath.Join(util.DataDir, "plugins")@@ -180,10 +182,7 @@ func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {return}- var bazaarPlugins []*Plugin- if checkUpdate {- bazaarPlugins = Plugins(frontend)- }+ bazaarPlugins := Plugins(frontend)for _, pluginDir := range pluginDirs {if !util.IsDirRegularOrSymlink(pluginDir) {@@ -197,6 +196,10 @@ func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {}plugin.DisallowInstall = disallowInstallBazaarPackage(plugin.Package)+ if bazaarPkg := getBazaarPlugin(plugin.Name, bazaarPlugins); nil != bazaarPkg {+ plugin.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)+ plugin.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion+ }installPath := filepath.Join(util.DataDir, "plugins", dirName)plugin.Installed = true@@ -229,6 +232,15 @@ func InstalledPlugins(frontend string, checkUpdate bool) (ret []*Plugin) {return}+func getBazaarPlugin(name string, plugins []*Plugin) *Plugin {+ for _, p := range plugins {+ if p.Name == name {+ return p+ }+ }+ return nil+}+func InstallPlugin(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHashdata, err := downloadPackage(repoURLHash, true, systemID)diff --git a/kernel/bazaar/template.go b/kernel/bazaar/template.goindex 519251efc9..b36de3a04e 100644--- a/kernel/bazaar/template.go+++ b/kernel/bazaar/template.go@@ -87,6 +87,8 @@ func Templates() (templates []*Template) {}template.DisallowInstall = disallowInstallBazaarPackage(template.Package)+ template.DisallowUpdate = disallowInstallBazaarPackage(template.Package)+ template.UpdateRequiredMinAppVer = template.MinAppVersiontemplate.URL = strings.TrimSuffix(template.URL, "/")repoURLHash := strings.Split(repoURL, "@")@@ -159,6 +161,10 @@ func InstalledTemplates() (ret []*Template) {}template.DisallowInstall = disallowInstallBazaarPackage(template.Package)+ if bazaarPkg := getBazaarTemplate(template.Name, bazaarTemplates); nil != bazaarPkg {+ template.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)+ template.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion+ }installPath := filepath.Join(util.DataDir, "templates", dirName)template.Installed = true@@ -190,6 +196,15 @@ func InstalledTemplates() (ret []*Template) {return}+func getBazaarTemplate(name string, templates []*Template) *Template {+ for _, p := range templates {+ if p.Name == name {+ return p+ }+ }+ return nil+}+func InstallTemplate(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHashdata, err := downloadPackage(repoURLHash, true, systemID)diff --git a/kernel/bazaar/theme.go b/kernel/bazaar/theme.goindex 12653318d4..083a7573af 100644--- a/kernel/bazaar/theme.go+++ b/kernel/bazaar/theme.go@@ -88,6 +88,8 @@ func Themes() (ret []*Theme) {}theme.DisallowInstall = disallowInstallBazaarPackage(theme.Package)+ theme.DisallowUpdate = disallowInstallBazaarPackage(theme.Package)+ theme.UpdateRequiredMinAppVer = theme.MinAppVersiontheme.URL = strings.TrimSuffix(theme.URL, "/")repoURLHash := strings.Split(repoURL, "@")@@ -160,6 +162,10 @@ func InstalledThemes() (ret []*Theme) {}theme.DisallowInstall = disallowInstallBazaarPackage(theme.Package)+ if bazaarPkg := getBazaarTheme(theme.Name, bazaarThemes); nil != bazaarPkg {+ theme.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)+ theme.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion+ }installPath := filepath.Join(util.ThemesPath, dirName)theme.Installed = true@@ -195,6 +201,15 @@ func isBuiltInTheme(dirName string) bool {return "daylight" == dirName || "midnight" == dirName}+func getBazaarTheme(name string, themes []*Theme) *Theme {+ for _, p := range themes {+ if p.Name == name {+ return p+ }+ }+ return nil+}+func InstallTheme(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHashdata, err := downloadPackage(repoURLHash, true, systemID)diff --git a/kernel/bazaar/widget.go b/kernel/bazaar/widget.goindex 2e8561fc7e..6561ccb4d0 100644--- a/kernel/bazaar/widget.go+++ b/kernel/bazaar/widget.go@@ -86,6 +86,8 @@ func Widgets() (widgets []*Widget) {}widget.DisallowInstall = disallowInstallBazaarPackage(widget.Package)+ widget.DisallowUpdate = disallowInstallBazaarPackage(widget.Package)+ widget.UpdateRequiredMinAppVer = widget.MinAppVersionwidget.URL = strings.TrimSuffix(widget.URL, "/")repoURLHash := strings.Split(repoURL, "@")@@ -156,6 +158,10 @@ func InstalledWidgets() (ret []*Widget) {}widget.DisallowInstall = disallowInstallBazaarPackage(widget.Package)+ if bazaarPkg := getBazaarWidget(widget.Name, bazaarWidgets); nil != bazaarPkg {+ widget.DisallowUpdate = disallowInstallBazaarPackage(bazaarPkg.Package)+ widget.UpdateRequiredMinAppVer = bazaarPkg.MinAppVersion+ }installPath := filepath.Join(util.DataDir, "widgets", dirName)widget.Installed = true@@ -187,6 +193,15 @@ func InstalledWidgets() (ret []*Widget) {return}+func getBazaarWidget(name string, widegets []*Widget) *Widget {+ for _, p := range widegets {+ if p.Name == name {+ return p+ }+ }+ return nil+}+func InstallWidget(repoURL, repoHash, installPath string, systemID string) error {repoURLHash := repoURL + "@" + repoHashdata, err := downloadPackage(repoURLHash, true, systemID)diff --git a/kernel/model/bazzar.go b/kernel/model/bazzar.goindex a597c0d573..aeb1f67e17 100644--- a/kernel/model/bazzar.go+++ b/kernel/model/bazzar.go@@ -201,6 +201,8 @@ func BazaarPlugins(frontend, keyword string) (plugins []*bazaar.Plugin) {if pluginConf, err := bazaar.PluginJSON(plugin.Name); err == nil && nil != plugin {plugin.Outdated = 0 > semver.Compare("v"+pluginConf.Version, "v"+plugin.Version)}+ } else {+ plugin.Outdated = false}}return@@ -218,7 +220,7 @@ func filterPlugins(plugins []*bazaar.Plugin, keyword string) (ret []*bazaar.Plug}func InstalledPlugins(frontend, keyword string) (plugins []*bazaar.Plugin) {- plugins = bazaar.InstalledPlugins(frontend, true)+ plugins = bazaar.InstalledPlugins(frontend)plugins = filterPlugins(plugins, keyword)petals := getPetals()for _, plugin := range plugins {@@ -270,6 +272,8 @@ func BazaarWidgets(keyword string) (widgets []*bazaar.Widget) {if widgetConf, err := bazaar.WidgetJSON(widget.Name); err == nil && nil != widget {widget.Outdated = 0 > semver.Compare("v"+widgetConf.Version, "v"+widget.Version)}+ } else {+ widget.Outdated = false}}return@@ -458,6 +462,8 @@ func BazaarTemplates(keyword string) (templates []*bazaar.Template) {if templateConf, err := bazaar.TemplateJSON(template.Name); err == nil && nil != templateConf {template.Outdated = 0 > semver.Compare("v"+templateConf.Version, "v"+template.Version)}+ } else {+ template.Outdated = false}}return