mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-17 15:10:12 +01:00
🎨 Add marketplace package config item minAppVersion https://github.com/siyuan-note/siyuan/issues/8330
This commit is contained in:
parent
7379ff1e27
commit
8cbe54c2ab
6 changed files with 13 additions and 25 deletions
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"golang.org/x/mod/semver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Icon struct {
|
type Icon struct {
|
||||||
|
|
@ -64,10 +63,7 @@ func Icons() (icons []*Icon) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" == icon.MinAppVersion {
|
if disallowDisplayBazaarPackage(icon.MinAppVersion) {
|
||||||
icon.MinAppVersion = defaultMinAppVersion
|
|
||||||
}
|
|
||||||
if 0 < semver.Compare("v"+icon.MinAppVersion, "v"+util.Ver) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package bazaar
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
"golang.org/x/mod/semver"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
@ -653,3 +654,10 @@ func getBazaarIndex() map[string]*bazaarPackage {
|
||||||
// defaultMinAppVersion 如果集市包中缺失 minAppVersion 项,则使用该值作为最低支持的版本号,小于该版本号时不显示集市包
|
// defaultMinAppVersion 如果集市包中缺失 minAppVersion 项,则使用该值作为最低支持的版本号,小于该版本号时不显示集市包
|
||||||
// Add marketplace package config item `minAppVersion` https://github.com/siyuan-note/siyuan/issues/8330
|
// Add marketplace package config item `minAppVersion` https://github.com/siyuan-note/siyuan/issues/8330
|
||||||
const defaultMinAppVersion = "2.9.0"
|
const defaultMinAppVersion = "2.9.0"
|
||||||
|
|
||||||
|
func disallowDisplayBazaarPackage(minAppVersion string) bool {
|
||||||
|
if "" == minAppVersion {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return 0 > semver.Compare("v"+minAppVersion, "v"+util.Ver)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"golang.org/x/mod/semver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Plugin struct {
|
type Plugin struct {
|
||||||
|
|
@ -66,10 +65,7 @@ func Plugins() (plugins []*Plugin) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" == plugin.MinAppVersion {
|
if disallowDisplayBazaarPackage(plugin.MinAppVersion) {
|
||||||
plugin.MinAppVersion = defaultMinAppVersion
|
|
||||||
}
|
|
||||||
if 0 < semver.Compare("v"+plugin.MinAppVersion, "v"+util.Ver) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,6 @@ import (
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"golang.org/x/mod/semver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Template struct {
|
type Template struct {
|
||||||
|
|
@ -65,10 +64,7 @@ func Templates() (templates []*Template) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" == template.MinAppVersion {
|
if disallowDisplayBazaarPackage(template.MinAppVersion) {
|
||||||
template.MinAppVersion = defaultMinAppVersion
|
|
||||||
}
|
|
||||||
if 0 < semver.Compare("v"+template.MinAppVersion, "v"+util.Ver) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"golang.org/x/mod/semver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Theme struct {
|
type Theme struct {
|
||||||
|
|
@ -66,10 +65,7 @@ func Themes() (ret []*Theme) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" == theme.MinAppVersion {
|
if disallowDisplayBazaarPackage(theme.MinAppVersion) {
|
||||||
theme.MinAppVersion = defaultMinAppVersion
|
|
||||||
}
|
|
||||||
if 0 < semver.Compare("v"+theme.MinAppVersion, "v"+util.Ver) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ import (
|
||||||
"github.com/siyuan-note/httpclient"
|
"github.com/siyuan-note/httpclient"
|
||||||
"github.com/siyuan-note/logging"
|
"github.com/siyuan-note/logging"
|
||||||
"github.com/siyuan-note/siyuan/kernel/util"
|
"github.com/siyuan-note/siyuan/kernel/util"
|
||||||
"golang.org/x/mod/semver"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type Widget struct {
|
type Widget struct {
|
||||||
|
|
@ -65,10 +64,7 @@ func Widgets() (widgets []*Widget) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if "" == widget.MinAppVersion {
|
if disallowDisplayBazaarPackage(widget.MinAppVersion) {
|
||||||
widget.MinAppVersion = defaultMinAppVersion
|
|
||||||
}
|
|
||||||
if 0 < semver.Compare("v"+widget.MinAppVersion, "v"+util.Ver) {
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue