Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: Brand new marketplace UI https://github.com/siyuan-note/siyuan/issues/8181

Liang Ding99c01fc9317c
diff --git a/kernel/model/plugin.go b/kernel/model/plugin.go
index 28355f9f85..f8e19a1c04 100644
--- a/kernel/model/plugin.go
+++ b/kernel/model/plugin.go
@@ -56,15 +56,28 @@ func SetPetalEnabled(name string, enabled bool) {
}
plugins := bazaar.InstalledPlugins()
- for _, plugin := range plugins {
- id := hash(plugin.URL)
- petal := getPetalByID(id, petals)
- if nil == petal {
- continue
+ var plugin *bazaar.Plugin
+ for _, p := range plugins {
+ if p.Name == name {
+ plugin = p
+ break
}
+ }
+ if nil == plugin {
+ logging.LogErrorf("plugin [%s] not found", name)
+ return
+ }
+ petal := getPetalByID(hash(plugin.Name), petals)
+ if nil == petal {
+ petal = &Petal{
+ ID: hash(plugin.Name),
+ Name: plugin.Name,
+ Enabled: enabled,
+ }
+ petals = append(petals, petal)
+ } else {
petal.Enabled = enabled
- break
}
if data, err = gulu.JSON.MarshalIndentJSON(petals, "", "\t"); nil != err {
@@ -113,7 +126,7 @@ func LoadPetals() (ret []*Petal) {
plugins := bazaar.InstalledPlugins()
for _, plugin := range plugins {
- id := hash(plugin.URL)
+ id := hash(plugin.Name)
petal := getPetalByID(id, ret)
if nil == petal {
continue