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

This commit is contained in:
Vanessa 2023-06-30 10:27:00 +08:00
commit 65920afeeb
5 changed files with 21 additions and 7 deletions

View file

@ -187,7 +187,7 @@
<h1 style="margin-bottom: 48px;color:var(--b3-theme-on-background)">{{.workspace}}</h1>
<input class="b3-text-filed" id="authCode" type="password" placeholder="{{.l0}}"/><br>
<div style="position: relative;width: 240px;margin: 8px auto 0;display: none">
<img id="captchaImg" style="top: 1px;position: absolute;height: 28px;right: 1px;cursor: pointer">
<img id="captchaImg" style="top: 1px;position: absolute;height: 27px;right: 1px;cursor: pointer">
<input id="captcha" class="b3-text-filed" placeholder="{{.l3}}">
</div>
<button class="b3-button" onclick="submitAuth()">{{.l1}}</button>

View file

@ -42,18 +42,21 @@ type DisplayName struct {
Default string `json:"default"`
ZhCN string `json:"zh_CN"`
EnUS string `json:"en_US"`
ZhCHT string `json:"zh_CHT"`
}
type Description struct {
Default string `json:"default"`
ZhCN string `json:"zh_CN"`
EnUS string `json:"en_US"`
ZhCHT string `json:"zh_CHT"`
}
type Readme struct {
Default string `json:"default"`
ZhCN string `json:"zh_CN"`
EnUS string `json:"en_US"`
ZhCHT string `json:"zh_CHT"`
}
type Funding struct {
@ -140,7 +143,9 @@ func getPreferredReadme(readme *Readme) string {
ret = readme.ZhCN
}
case "zh_CHT":
if "" != readme.ZhCN {
if "" != readme.ZhCHT {
ret = readme.ZhCHT
} else if "" != readme.ZhCN {
ret = readme.ZhCN
}
case "en_US":
@ -167,7 +172,9 @@ func getPreferredName(pkg *Package) string {
ret = pkg.DisplayName.ZhCN
}
case "zh_CHT":
if "" != pkg.DisplayName.ZhCN {
if "" != pkg.DisplayName.ZhCHT {
ret = pkg.DisplayName.ZhCHT
} else if "" != pkg.DisplayName.ZhCN {
ret = pkg.DisplayName.ZhCN
}
case "en_US":
@ -194,7 +201,9 @@ func getPreferredDesc(desc *Description) string {
ret = desc.ZhCN
}
case "zh_CHT":
if "" != desc.ZhCN {
if "" != desc.ZhCHT {
ret = desc.ZhCHT
} else if "" != desc.ZhCN {
ret = desc.ZhCN
}
case "en_US":

View file

@ -108,7 +108,7 @@ func Plugins(frontend string) (plugins []*Plugin) {
return
}
func IsIncompatibleInstalledPlugin(name, frontend string) (found, incompatible bool) {
func ParseInstalledPlugin(name, frontend string) (found bool, displayName string, incompatible bool) {
pluginsPath := filepath.Join(util.DataDir, "plugins")
if !util.IsPathRegularDirOrSymlinkDir(pluginsPath) {
return
@ -135,6 +135,7 @@ func IsIncompatibleInstalledPlugin(name, frontend string) (found, incompatible b
}
found = true
displayName = getPreferredName(plugin.Package)
incompatible = isIncompatiblePlugin(plugin, frontend)
}
return

View file

@ -32,6 +32,7 @@ import (
// Petal represents a plugin's management status.
type Petal struct {
Name string `json:"name"` // Plugin name
DisplayName string `json:"displayName"` // Plugin display name
Enabled bool `json:"enabled"` // Whether enabled
Incompatible bool `json:"incompatible"` // Whether incompatible
@ -43,7 +44,7 @@ type Petal struct {
func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, err error) {
petals := getPetals()
found, incompatible := bazaar.IsIncompatibleInstalledPlugin(name, frontend)
found, displayName, incompatible := bazaar.ParseInstalledPlugin(name, frontend)
if !found {
logging.LogErrorf("plugin [%s] not found", name)
return
@ -56,6 +57,7 @@ func SetPetalEnabled(name string, enabled bool, frontend string) (ret *Petal, er
}
petals = append(petals, ret)
}
ret.DisplayName = displayName
ret.Enabled = enabled
ret.Incompatible = incompatible
@ -78,7 +80,7 @@ func LoadPetals(frontend string) (ret []*Petal) {
petals := getPetals()
for _, petal := range petals {
_, petal.Incompatible = bazaar.IsIncompatibleInstalledPlugin(petal.Name, frontend)
_, petal.DisplayName, petal.Incompatible = bazaar.ParseInstalledPlugin(petal.Name, frontend)
if !petal.Enabled || petal.Incompatible {
continue
}

View file

@ -17,6 +17,7 @@
package model
import (
"image/color"
"net/http"
"net/url"
"os"
@ -118,6 +119,7 @@ func GetCaptcha(c *gin.Context) {
options.CharPreset = "ABCDEFGHKLMNPQRSTUVWXYZ23456789"
options.Noise = 0.5
options.CurveNumber = 0
options.BackgroundColor = color.White
})
if nil != err {
logging.LogErrorf("generates captcha failed: " + err.Error())