From 3f8abf8ad8e417940fee5c3e9d717e81ab2df602 Mon Sep 17 00:00:00 2001
From: ssongliu <73214554+ssongliu@users.noreply.github.com>
Date: Fri, 8 Dec 2023 17:26:07 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E8=BF=9C=E7=A8=8B=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E5=BA=93=E5=A2=9E=E5=8A=A0=E6=98=AF=E5=90=A6=E5=BC=80=E5=90=AF?=
=?UTF-8?q?=20CA=20=E9=AA=8C=E8=AF=81=E9=80=89=E9=A1=B9=20(#3232)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
backend/utils/mysql/client/info.go | 6 +++--
frontend/src/api/interface/database.ts | 1 +
frontend/src/lang/modules/en.ts | 1 +
frontend/src/lang/modules/tw.ts | 1 +
frontend/src/lang/modules/zh.ts | 1 +
.../container/container/operate/index.vue | 4 +--
.../database/mysql/remote/operate/index.vue | 25 +++++++++++++------
7 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/backend/utils/mysql/client/info.go b/backend/utils/mysql/client/info.go
index d4f20e90a..58455adcc 100644
--- a/backend/utils/mysql/client/info.go
+++ b/backend/utils/mysql/client/info.go
@@ -149,8 +149,10 @@ func ConnWithSSL(ssl, skipVerify bool, clientKey, clientCert, rootCert string) (
return "", nil
}
pool := x509.NewCertPool()
- if ok := pool.AppendCertsFromPEM([]byte(rootCert)); !ok {
- return "", errors.New("unable to append root cert to pool")
+ if len(rootCert) != 0 {
+ if ok := pool.AppendCertsFromPEM([]byte(rootCert)); !ok {
+ return "", errors.New("unable to append root cert to pool")
+ }
}
cert, err := tls.X509KeyPair([]byte(clientCert), []byte(clientKey))
if err != nil {
diff --git a/frontend/src/api/interface/database.ts b/frontend/src/api/interface/database.ts
index 0e6138b3a..6e3a77e19 100644
--- a/frontend/src/api/interface/database.ts
+++ b/frontend/src/api/interface/database.ts
@@ -215,6 +215,7 @@ export namespace Database {
password: string;
ssl: boolean;
+ hasCA: boolean;
rootCert: string;
clientKey: string;
clientCert: string;
diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts
index fc8e559df..562aaf1de 100644
--- a/frontend/src/lang/modules/en.ts
+++ b/frontend/src/lang/modules/en.ts
@@ -396,6 +396,7 @@ const message = {
clientKey: 'Client Private Key',
clientCert: 'Client Certificate',
caCert: 'CA Certificate',
+ hasCA: 'Has CA Certificate',
skipVerify: 'Ignore Certificate Validity Check',
formatHelper:
diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts
index 98ada819d..62b20514e 100644
--- a/frontend/src/lang/modules/tw.ts
+++ b/frontend/src/lang/modules/tw.ts
@@ -388,6 +388,7 @@ const message = {
clientKey: '客户端私钥',
clientCert: '客户端证书',
caCert: 'CA 证书',
+ hasCA: '擁有 CA 證書',
skipVerify: '忽略校验证书可用性检测',
formatHelper: '當前資料庫字符集為 {0},字符集不一致可能導致恢復失敗',
diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts
index cd6562917..8dd121de8 100644
--- a/frontend/src/lang/modules/zh.ts
+++ b/frontend/src/lang/modules/zh.ts
@@ -387,6 +387,7 @@ const message = {
ssl: '使用 SSL',
clientKey: '客户端私钥',
clientCert: '客户端证书',
+ hasCA: '拥有 CA 证书',
caCert: 'CA 证书',
skipVerify: '忽略校验证书可用性检测',
diff --git a/frontend/src/views/container/container/operate/index.vue b/frontend/src/views/container/container/operate/index.vue
index d26585c8a..32fbe88d4 100644
--- a/frontend/src/views/container/container/operate/index.vue
+++ b/frontend/src/views/container/container/operate/index.vue
@@ -184,9 +184,9 @@
{{ $t('container.autoRemove') }}
-