🎨 Add marketplace package config item minAppVersion https://github.com/siyuan-note/siyuan/issues/8330

This commit is contained in:
Daniel 2023-05-24 10:34:15 +08:00
parent d26bb04110
commit 7379ff1e27
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
6 changed files with 57 additions and 13 deletions

View file

@ -29,6 +29,7 @@ import (
"github.com/siyuan-note/httpclient"
"github.com/siyuan-note/logging"
"github.com/siyuan-note/siyuan/kernel/util"
"golang.org/x/mod/semver"
)
type Plugin struct {
@ -64,8 +65,15 @@ func Plugins() (plugins []*Plugin) {
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
return
}
plugin.URL = strings.TrimSuffix(plugin.URL, "/")
if "" == plugin.MinAppVersion {
plugin.MinAppVersion = defaultMinAppVersion
}
if 0 < semver.Compare("v"+plugin.MinAppVersion, "v"+util.Ver) {
return
}
plugin.URL = strings.TrimSuffix(plugin.URL, "/")
repoURLHash := strings.Split(repoURL, "@")
plugin.RepoURL = "https://github.com/" + repoURLHash[0]
plugin.RepoHash = repoURLHash[1]