From b65fc703f5e76c2cca19436503cbb438b317b92c Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 30 Jun 2023 09:09:11 +0800
Subject: [PATCH 1/3] :art: Marketplace package i18n support Traditional
Chinese Fix https://github.com/siyuan-note/siyuan/issues/8642
---
kernel/bazaar/package.go | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/kernel/bazaar/package.go b/kernel/bazaar/package.go
index 40a9c6abc..d3329868a 100644
--- a/kernel/bazaar/package.go
+++ b/kernel/bazaar/package.go
@@ -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":
From d94893f9a64e6e2e5af9971d569550bacb172061 Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 30 Jun 2023 09:33:04 +0800
Subject: [PATCH 2/3] :art: The captcha on the auth page uses a white
background Fix https://github.com/siyuan-note/siyuan/issues/8645
---
app/stage/auth.html | 2 +-
kernel/model/session.go | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/app/stage/auth.html b/app/stage/auth.html
index cb64f6231..38b3cc41d 100644
--- a/app/stage/auth.html
+++ b/app/stage/auth.html
@@ -187,7 +187,7 @@
{{.workspace}}
diff --git a/kernel/model/session.go b/kernel/model/session.go
index 420c5306c..4a5ebc65b 100644
--- a/kernel/model/session.go
+++ b/kernel/model/session.go
@@ -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())
From ba3f5fe5e5304dff47ea492862875516ee6b2a7f Mon Sep 17 00:00:00 2001
From: Daniel <845765@qq.com>
Date: Fri, 30 Jun 2023 10:26:25 +0800
Subject: [PATCH 3/3] :art: Add plugin name to command palette
https://github.com/siyuan-note/siyuan/issues/8644
---
kernel/bazaar/plugin.go | 3 ++-
kernel/model/plugin.go | 6 ++++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/kernel/bazaar/plugin.go b/kernel/bazaar/plugin.go
index 1d9b7674f..002be1dc4 100644
--- a/kernel/bazaar/plugin.go
+++ b/kernel/bazaar/plugin.go
@@ -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
diff --git a/kernel/model/plugin.go b/kernel/model/plugin.go
index 775b1d855..1bdccc709 100644
--- a/kernel/model/plugin.go
+++ b/kernel/model/plugin.go
@@ -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
}