🎨 Improve the fallback logic of the marketplace (#16601)

This commit is contained in:
Jeffrey Chen 2025-12-16 20:35:15 +08:00 committed by GitHub
parent 7217c66636
commit 5a3ad845d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 1 deletions

View file

@ -244,6 +244,8 @@ func getPreferredReadme(readme *Readme) string {
defaultReadme := strings.TrimSpace(readme.Default)
if defaultReadme != "" {
ret = defaultReadme
} else if "" != readme.EnUS {
ret = readme.EnUS
} else {
ret = "README.md"
}
@ -323,6 +325,8 @@ func GetPreferredName(pkg *Package) string {
defaultName := strings.TrimSpace(pkg.DisplayName.Default)
if defaultName != "" {
ret = defaultName
} else if "" != pkg.DisplayName.EnUS {
ret = pkg.DisplayName.EnUS
} else {
ret = pkg.Name
}
@ -402,6 +406,8 @@ func getPreferredDesc(desc *Description) string {
defaultDesc := strings.TrimSpace(desc.Default)
if defaultDesc != "" {
ret = defaultDesc
} else if "" != desc.EnUS {
ret = desc.EnUS
}
}
return ret

View file

@ -247,9 +247,10 @@ func isIncompatiblePlugin(plugin *Plugin, currentFrontend string) bool {
return false
}
currentBackend := getCurrentBackend()
backendOk := false
for _, backend := range plugin.Backends {
if backend == getCurrentBackend() || "all" == backend {
if backend == currentBackend || "all" == backend {
backendOk = true
break
}