🎨 集市已下载包在配置文件不正确的情况下不应该显示更新按钮 https://github.com/siyuan-note/siyuan/issues/5838

This commit is contained in:
Liang Ding 2022-09-07 12:18:39 +08:00
parent 05cbc28185
commit 215c70db23
No known key found for this signature in database
GPG key ID: 136F30F901A2231D

View file

@ -180,6 +180,12 @@ func isOutdatedTheme(theme *Theme, bazaarThemes []*Theme) bool {
return false
}
repo := strings.TrimPrefix(theme.URL, "https://github.com/")
parts := strings.Split(repo, "/")
if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
return false
}
for _, pkg := range bazaarThemes {
if theme.URL == pkg.URL && theme.Name == pkg.Name && theme.Author == pkg.Author && theme.Version != pkg.Version {
theme.RepoHash = pkg.RepoHash
@ -194,6 +200,12 @@ func isOutdatedIcon(icon *Icon, bazaarIcons []*Icon) bool {
return false
}
repo := strings.TrimPrefix(icon.URL, "https://github.com/")
parts := strings.Split(repo, "/")
if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
return false
}
for _, pkg := range bazaarIcons {
if icon.URL == pkg.URL && icon.Name == pkg.Name && icon.Author == pkg.Author && icon.Version != pkg.Version {
icon.RepoHash = pkg.RepoHash
@ -208,6 +220,12 @@ func isOutdatedWidget(widget *Widget, bazaarWidgets []*Widget) bool {
return false
}
repo := strings.TrimPrefix(widget.URL, "https://github.com/")
parts := strings.Split(repo, "/")
if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
return false
}
for _, pkg := range bazaarWidgets {
if widget.URL == pkg.URL && widget.Name == pkg.Name && widget.Author == pkg.Author && widget.Version != pkg.Version {
widget.RepoHash = pkg.RepoHash
@ -222,6 +240,12 @@ func isOutdatedTemplate(template *Template, bazaarTemplates []*Template) bool {
return false
}
repo := strings.TrimPrefix(template.URL, "https://github.com/")
parts := strings.Split(repo, "/")
if 2 != len(parts) || "" == strings.TrimSpace(parts[1]) {
return false
}
for _, pkg := range bazaarTemplates {
if template.URL == pkg.URL && template.Name == pkg.Name && template.Author == pkg.Author && template.Version != pkg.Version {
template.RepoHash = pkg.RepoHash