mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-03 07:18:49 +01:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
808247e11d
6 changed files with 45 additions and 13 deletions
|
|
@ -62,8 +62,12 @@ func Icons() (icons []*Icon) {
|
|||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
return
|
||||
}
|
||||
icon.URL = strings.TrimSuffix(icon.URL, "/")
|
||||
|
||||
if disallowDisplayBazaarPackage(icon.MinAppVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
icon.URL = strings.TrimSuffix(icon.URL, "/")
|
||||
repoURLHash := strings.Split(repoURL, "@")
|
||||
icon.RepoURL = "https://github.com/" + repoURLHash[0]
|
||||
icon.RepoHash = repoURLHash[1]
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package bazaar
|
|||
import (
|
||||
"bytes"
|
||||
"errors"
|
||||
"golang.org/x/mod/semver"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
|
@ -64,14 +65,14 @@ type Funding struct {
|
|||
}
|
||||
|
||||
type Package struct {
|
||||
Author string `json:"author"`
|
||||
URL string `json:"url"`
|
||||
Version string `json:"version"`
|
||||
DisplayName *DisplayName `json:"displayName"`
|
||||
Description *Description `json:"description"`
|
||||
Readme *Readme `json:"readme"`
|
||||
Funding *Funding `json:"funding"`
|
||||
I18N []string `json:"i18n"`
|
||||
Author string `json:"author"`
|
||||
URL string `json:"url"`
|
||||
Version string `json:"version"`
|
||||
MinAppVersion string `json:"minAppVersion"`
|
||||
DisplayName *DisplayName `json:"displayName"`
|
||||
Description *Description `json:"description"`
|
||||
Readme *Readme `json:"readme"`
|
||||
Funding *Funding `json:"funding"`
|
||||
|
||||
PreferredFunding string `json:"preferredFunding"`
|
||||
PreferredName string `json:"preferredName"`
|
||||
|
|
@ -649,3 +650,14 @@ func getBazaarIndex() map[string]*bazaarPackage {
|
|||
bazaarIndexCacheTime = now
|
||||
return cachedBazaarIndex
|
||||
}
|
||||
|
||||
// defaultMinAppVersion 如果集市包中缺失 minAppVersion 项,则使用该值作为最低支持的版本号,小于该版本号时不显示集市包
|
||||
// Add marketplace package config item `minAppVersion` https://github.com/siyuan-note/siyuan/issues/8330
|
||||
const defaultMinAppVersion = "2.9.0"
|
||||
|
||||
func disallowDisplayBazaarPackage(minAppVersion string) bool {
|
||||
if "" == minAppVersion { // 目前暂时放过所有不带 minAppVersion 的集市包,后续版本会使用 defaultMinAppVersion
|
||||
return false
|
||||
}
|
||||
return 0 > semver.Compare("v"+minAppVersion, "v"+util.Ver)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,8 +64,12 @@ func Plugins() (plugins []*Plugin) {
|
|||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
return
|
||||
}
|
||||
plugin.URL = strings.TrimSuffix(plugin.URL, "/")
|
||||
|
||||
if disallowDisplayBazaarPackage(plugin.MinAppVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
plugin.URL = strings.TrimSuffix(plugin.URL, "/")
|
||||
repoURLHash := strings.Split(repoURL, "@")
|
||||
plugin.RepoURL = "https://github.com/" + repoURLHash[0]
|
||||
plugin.RepoHash = repoURLHash[1]
|
||||
|
|
|
|||
|
|
@ -63,8 +63,12 @@ func Templates() (templates []*Template) {
|
|||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
return
|
||||
}
|
||||
template.URL = strings.TrimSuffix(template.URL, "/")
|
||||
|
||||
if disallowDisplayBazaarPackage(template.MinAppVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
template.URL = strings.TrimSuffix(template.URL, "/")
|
||||
repoURLHash := strings.Split(repoURL, "@")
|
||||
template.RepoURL = "https://github.com/" + repoURLHash[0]
|
||||
template.RepoHash = repoURLHash[1]
|
||||
|
|
|
|||
|
|
@ -64,8 +64,12 @@ func Themes() (ret []*Theme) {
|
|||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
return
|
||||
}
|
||||
theme.URL = strings.TrimSuffix(theme.URL, "/")
|
||||
|
||||
if disallowDisplayBazaarPackage(theme.MinAppVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
theme.URL = strings.TrimSuffix(theme.URL, "/")
|
||||
repoURLHash := strings.Split(repoURL, "@")
|
||||
theme.RepoURL = "https://github.com/" + repoURLHash[0]
|
||||
theme.RepoHash = repoURLHash[1]
|
||||
|
|
|
|||
|
|
@ -63,8 +63,12 @@ func Widgets() (widgets []*Widget) {
|
|||
logging.LogErrorf("get bazaar package [%s] failed: %d", innerU, innerResp.StatusCode)
|
||||
return
|
||||
}
|
||||
widget.URL = strings.TrimSuffix(widget.URL, "/")
|
||||
|
||||
if disallowDisplayBazaarPackage(widget.MinAppVersion) {
|
||||
return
|
||||
}
|
||||
|
||||
widget.URL = strings.TrimSuffix(widget.URL, "/")
|
||||
repoURLHash := strings.Split(repoURL, "@")
|
||||
widget.RepoURL = "https://github.com/" + repoURLHash[0]
|
||||
widget.RepoHash = repoURLHash[1]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue