🎨 Improve minimum version requirements for marketplace packages https://github.com/siyuan-note/siyuan/issues/16688

Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
Daniel 2025-12-27 12:41:03 +08:00
parent c64e976419
commit 3f5c0762e8
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 17 additions and 8 deletions

View file

@ -36,6 +36,7 @@ type Petal struct {
Enabled bool `json:"enabled"` // Whether enabled
Incompatible bool `json:"incompatible"` // Whether incompatible
DisabledInPublish bool `json:"disabledInPublish"` // Whether disabled in publish mode
DisallowInstall bool `json:"disallowInstall"` // Whether disallow install
JS string `json:"js"` // JS code
CSS string `json:"css"` // CSS code
@ -45,7 +46,7 @@ type Petal struct {
func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, err error) {
petals := getPetals()
found, displayName, incompatible, disabledInPublish := bazaar.ParseInstalledPlugin(name, frontend)
found, displayName, incompatible, disabledInPublish, disallowInstall := bazaar.ParseInstalledPlugin(name, frontend)
if !found {
logging.LogErrorf("plugin [%s] not found", name)
return
@ -62,6 +63,7 @@ func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, er
ret.Enabled = enabled
ret.Incompatible = incompatible
ret.DisabledInPublish = disabledInPublish
ret.DisallowInstall = disallowInstall
if incompatible {
err = fmt.Errorf(Conf.Language(205))
@ -100,8 +102,8 @@ func LoadPetals(frontend string, isPublish bool) (ret []*Petal) {
petals := getPetals()
for _, petal := range petals {
_, petal.DisplayName, petal.Incompatible, petal.DisabledInPublish = bazaar.ParseInstalledPlugin(petal.Name, frontend)
if !petal.Enabled || petal.Incompatible || (isPublish && petal.DisabledInPublish) {
_, petal.DisplayName, petal.Incompatible, petal.DisabledInPublish, petal.DisallowInstall = bazaar.ParseInstalledPlugin(petal.Name, frontend)
if !petal.Enabled || petal.Incompatible || (isPublish && petal.DisabledInPublish) || petal.DisallowInstall {
continue
}