From 56fc2d8b4423e61043ed8ad345f8e98a1148c458 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sun, 9 Mar 2025 12:57:01 +0800 Subject: [PATCH 1/5] fix: invalid version checker --- ui/src/hooks/useVersionChecker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ui/src/hooks/useVersionChecker.ts b/ui/src/hooks/useVersionChecker.ts index 5dcc96f8..9df7740d 100644 --- a/ui/src/hooks/useVersionChecker.ts +++ b/ui/src/hooks/useVersionChecker.ts @@ -4,7 +4,7 @@ import { version } from "@/domain/version"; export type UseVersionCheckerReturns = { hasNewVersion: boolean; - check: () => void; + checkNewVersion: () => void; }; const extractSemver = (vers: string) => { @@ -48,7 +48,7 @@ const useVersionChecker = () => { } const nIdx = releases.findIndex((e: any) => compareVersions(e.name, version) !== -1); - if (cIdx >= nIdx) { + if (cIdx !== -1 && cIdx <= nIdx) { return false; } @@ -63,7 +63,7 @@ const useVersionChecker = () => { return { hasNewVersion: !!data, - check: refresh, + checkNewVersion: refresh, }; }; From 643e09a4e6b19686ec04b257b5c41fa88924fdf7 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Sun, 9 Mar 2025 13:04:27 +0800 Subject: [PATCH 2/5] fix: typo --- internal/domain/workflow.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/domain/workflow.go b/internal/domain/workflow.go index 2766018d..9277e798 100644 --- a/internal/domain/workflow.go +++ b/internal/domain/workflow.go @@ -62,14 +62,14 @@ type WorkflowNode struct { } type WorkflowNodeConfigForApply struct { - Domains string `json:"domains"` // 域名列表,以半角逗号分隔 + Domains string `json:"domains"` // 域名列表,以半角分号分隔 ContactEmail string `json:"contactEmail"` // 联系邮箱 ChallengeType string `json:"challengeType"` // TODO: 验证方式。目前仅支持 dns-01 Provider string `json:"provider"` // DNS 提供商 ProviderAccessId string `json:"providerAccessId"` // DNS 提供商授权记录 ID ProviderConfig map[string]any `json:"providerConfig"` // DNS 提供商额外配置 KeyAlgorithm string `json:"keyAlgorithm"` // 密钥算法 - Nameservers string `json:"nameservers"` // DNS 服务器列表,以半角逗号分隔 + Nameservers string `json:"nameservers"` // DNS 服务器列表,以半角分号分隔 DnsPropagationTimeout int32 `json:"dnsPropagationTimeout"` // DNS 传播超时时间(零值取决于提供商的默认值) DnsTTL int32 `json:"dnsTTL"` // DNS TTL(零值取决于提供商的默认值) DisableFollowCNAME bool `json:"disableFollowCNAME"` // 是否关闭 CNAME 跟随 From f9e3797cdd92a71811bd563bf28c8a5e8d332e70 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 10 Mar 2025 15:13:41 +0800 Subject: [PATCH 3/5] feat: default set `autoRestart` on deployment to 1panel or baotapanel --- .../workflow/node/DeployNodeConfigForm1PanelConsoleConfig.tsx | 4 +++- .../node/DeployNodeConfigFormBaotaPanelConsoleConfig.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/src/components/workflow/node/DeployNodeConfigForm1PanelConsoleConfig.tsx b/ui/src/components/workflow/node/DeployNodeConfigForm1PanelConsoleConfig.tsx index 349b516e..b17150d8 100644 --- a/ui/src/components/workflow/node/DeployNodeConfigForm1PanelConsoleConfig.tsx +++ b/ui/src/components/workflow/node/DeployNodeConfigForm1PanelConsoleConfig.tsx @@ -16,7 +16,9 @@ export type DeployNodeConfigForm1PanelConsoleConfigProps = { }; const initFormModel = (): DeployNodeConfigForm1PanelConsoleConfigFieldValues => { - return {}; + return { + autoRestart: true, + }; }; const DeployNodeConfigForm1PanelConsoleConfig = ({ diff --git a/ui/src/components/workflow/node/DeployNodeConfigFormBaotaPanelConsoleConfig.tsx b/ui/src/components/workflow/node/DeployNodeConfigFormBaotaPanelConsoleConfig.tsx index 40d93b7f..ca440a27 100644 --- a/ui/src/components/workflow/node/DeployNodeConfigFormBaotaPanelConsoleConfig.tsx +++ b/ui/src/components/workflow/node/DeployNodeConfigFormBaotaPanelConsoleConfig.tsx @@ -16,7 +16,9 @@ export type DeployNodeConfigFormBaotaPanelConsoleConfigProps = { }; const initFormModel = (): DeployNodeConfigFormBaotaPanelConsoleConfigFieldValues => { - return {}; + return { + autoRestart: true, + }; }; const DeployNodeConfigFormBaotaPanelConsoleConfig = ({ From 19ccac5c054a1610045ea61039c84b5674f145e9 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 10 Mar 2025 15:22:25 +0800 Subject: [PATCH 4/5] build: set timezone in docker-compose --- docker/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 858148e8..c685e77c 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -6,5 +6,7 @@ services: ports: - 8090:8090 volumes: + - /etc/localtime:/etc/localtime:ro + - /etc/timezone:/etc/timezone:ro - ./data:/app/pb_data restart: unless-stopped From c907f22275e7a2b8a119962cd7aff41ed6134550 Mon Sep 17 00:00:00 2001 From: Fu Diwei Date: Mon, 10 Mar 2025 16:18:30 +0800 Subject: [PATCH 5/5] fix: wrong detection results of certificate key algorithm --- internal/domain/certificate.go | 68 +++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 13 deletions(-) diff --git a/internal/domain/certificate.go b/internal/domain/certificate.go index f57a2c4a..29ca6292 100644 --- a/internal/domain/certificate.go +++ b/internal/domain/certificate.go @@ -1,7 +1,10 @@ package domain import ( + "crypto/ecdsa" + "crypto/rsa" "crypto/x509" + "fmt" "strings" "time" @@ -39,19 +42,58 @@ func (c *Certificate) PopulateFromX509(certX509 *x509.Certificate) *Certificate c.EffectAt = certX509.NotBefore c.ExpireAt = certX509.NotAfter - switch certX509.SignatureAlgorithm { - case x509.SHA256WithRSA, x509.SHA256WithRSAPSS: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA2048 - case x509.SHA384WithRSA, x509.SHA384WithRSAPSS: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA3072 - case x509.SHA512WithRSA, x509.SHA512WithRSAPSS: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA4096 - case x509.ECDSAWithSHA256: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC256 - case x509.ECDSAWithSHA384: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC384 - case x509.ECDSAWithSHA512: - c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC512 + switch certX509.PublicKeyAlgorithm { + case x509.RSA: + { + len := 0 + if pubkey, ok := certX509.PublicKey.(*rsa.PublicKey); ok { + len = pubkey.N.BitLen() + } + + switch len { + case 0: + c.KeyAlgorithm = CertificateKeyAlgorithmType("RSA") + case 2048: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA2048 + case 3072: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA3072 + case 4096: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA4096 + case 8192: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeRSA8192 + default: + c.KeyAlgorithm = CertificateKeyAlgorithmType(fmt.Sprintf("RSA%d", len)) + } + } + + case x509.ECDSA: + { + len := 0 + if pubkey, ok := certX509.PublicKey.(*ecdsa.PublicKey); ok { + if pubkey.Curve != nil && pubkey.Curve.Params() != nil { + len = pubkey.Curve.Params().BitSize + } + } + + switch len { + case 0: + c.KeyAlgorithm = CertificateKeyAlgorithmType("EC") + case 256: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC256 + case 384: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC384 + case 521: + c.KeyAlgorithm = CertificateKeyAlgorithmTypeEC512 + default: + c.KeyAlgorithm = CertificateKeyAlgorithmType(fmt.Sprintf("EC%d", len)) + } + } + + case x509.Ed25519: + { + c.KeyAlgorithm = CertificateKeyAlgorithmType("ED25519") + } + default: c.KeyAlgorithm = CertificateKeyAlgorithmType("") }