Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
Vanessa 2023-08-30 21:54:56 +08:00
commit a6f80dfcbd

View File

@ -19,7 +19,6 @@ package bazaar
import ( import (
"bytes" "bytes"
"errors" "errors"
"golang.org/x/mod/semver"
"os" "os"
"path/filepath" "path/filepath"
"strings" "strings"
@ -34,6 +33,7 @@ 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"
textUnicode "golang.org/x/text/encoding/unicode" textUnicode "golang.org/x/text/encoding/unicode"
"golang.org/x/text/transform" "golang.org/x/text/transform"
) )
@ -390,7 +390,7 @@ func isOutdatedTheme(theme *Theme, bazaarThemes []*Theme) bool {
} }
for _, pkg := range bazaarThemes { for _, pkg := range bazaarThemes {
if theme.URL == pkg.URL && theme.Name == pkg.Name && theme.Author == pkg.Author && theme.Version < pkg.Version { if theme.URL == pkg.URL && theme.Name == pkg.Name && theme.Author == pkg.Author && 0 > semver.Compare("v"+theme.Version, "v"+pkg.Version) {
theme.RepoHash = pkg.RepoHash theme.RepoHash = pkg.RepoHash
return true return true
} }
@ -410,7 +410,7 @@ func isOutdatedIcon(icon *Icon, bazaarIcons []*Icon) bool {
} }
for _, pkg := range bazaarIcons { for _, pkg := range bazaarIcons {
if icon.URL == pkg.URL && icon.Name == pkg.Name && icon.Author == pkg.Author && icon.Version < pkg.Version { if icon.URL == pkg.URL && icon.Name == pkg.Name && icon.Author == pkg.Author && 0 > semver.Compare("v"+icon.Version, "v"+pkg.Version) {
icon.RepoHash = pkg.RepoHash icon.RepoHash = pkg.RepoHash
return true return true
} }
@ -430,7 +430,7 @@ func isOutdatedPlugin(plugin *Plugin, bazaarPlugins []*Plugin) bool {
} }
for _, pkg := range bazaarPlugins { for _, pkg := range bazaarPlugins {
if plugin.URL == pkg.URL && plugin.Name == pkg.Name && plugin.Author == pkg.Author && plugin.Version < pkg.Version { if plugin.URL == pkg.URL && plugin.Name == pkg.Name && plugin.Author == pkg.Author && 0 > semver.Compare("v"+plugin.Version, "v"+pkg.Version) {
plugin.RepoHash = pkg.RepoHash plugin.RepoHash = pkg.RepoHash
return true return true
} }
@ -450,7 +450,7 @@ func isOutdatedWidget(widget *Widget, bazaarWidgets []*Widget) bool {
} }
for _, pkg := range bazaarWidgets { for _, pkg := range bazaarWidgets {
if widget.URL == pkg.URL && widget.Name == pkg.Name && widget.Author == pkg.Author && widget.Version < pkg.Version { if widget.URL == pkg.URL && widget.Name == pkg.Name && widget.Author == pkg.Author && 0 > semver.Compare("v"+widget.Version, "v"+pkg.Version) {
widget.RepoHash = pkg.RepoHash widget.RepoHash = pkg.RepoHash
return true return true
} }
@ -470,7 +470,7 @@ func isOutdatedTemplate(template *Template, bazaarTemplates []*Template) bool {
} }
for _, pkg := range bazaarTemplates { for _, pkg := range bazaarTemplates {
if template.URL == pkg.URL && template.Name == pkg.Name && template.Author == pkg.Author && template.Version < pkg.Version { if template.URL == pkg.URL && template.Name == pkg.Name && template.Author == pkg.Author && 0 > semver.Compare("v"+template.Version, "v"+pkg.Version) {
template.RepoHash = pkg.RepoHash template.RepoHash = pkg.RepoHash
return true return true
} }