From 3437d62f3182400873b0f084cd421889e1d2c17d Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:21:54 +0800 Subject: [PATCH] feat: Website SSL DNS Type support WestCN (#8305) --- backend/utils/ssl/client.go | 11 +++++++++++ frontend/src/global/mimetype.ts | 4 ++++ frontend/src/lang/modules/en.ts | 1 + frontend/src/lang/modules/ja.ts | 2 ++ frontend/src/lang/modules/ko.ts | 1 + frontend/src/lang/modules/ms.ts | 1 + frontend/src/lang/modules/pt-br.ts | 2 ++ frontend/src/lang/modules/ru.ts | 1 + frontend/src/lang/modules/tw.ts | 1 + frontend/src/lang/modules/zh.ts | 1 + .../views/website/ssl/dns-account/create/index.vue | 11 ++++++++++- go.mod | 1 + go.sum | 2 ++ 13 files changed, 38 insertions(+), 1 deletion(-) diff --git a/backend/utils/ssl/client.go b/backend/utils/ssl/client.go index 751d8e501..a7eb3cd1d 100644 --- a/backend/utils/ssl/client.go +++ b/backend/utils/ssl/client.go @@ -3,6 +3,7 @@ package ssl import ( "crypto" "encoding/json" + "github.com/go-acme/lego/v4/providers/dns/westcn" "os" "strings" "time" @@ -85,6 +86,7 @@ const ( TencentCloud DnsType = "TencentCloud" HuaweiCloud DnsType = "HuaweiCloud" RainYun DnsType = "RainYun" + WestCN DnsType = "WestCN" ) type DNSParam struct { @@ -103,6 +105,7 @@ type DNSParam struct { AuthID string `json:"authID"` SubAuthID string `json:"subAuthID"` AuthPassword string `json:"authPassword"` + Username string `json:"username"` } var ( @@ -233,6 +236,14 @@ func (c *AcmeClient) UseDns(dnsType DnsType, params string, websiteSSL model.Web rainyunConfig.PollingInterval = pollingInterval rainyunConfig.TTL = ttl p, err = rainyun.NewDNSProviderConfig(rainyunConfig) + case WestCN: + westcnConfig := westcn.NewDefaultConfig() + westcnConfig.Username = param.Username + westcnConfig.Password = param.Password + westcnConfig.PropagationTimeout = propagationTimeout + westcnConfig.PollingInterval = pollingInterval + westcnConfig.TTL = ttl + p, err = westcn.NewDNSProviderConfig(westcnConfig) } if err != nil { return err diff --git a/frontend/src/global/mimetype.ts b/frontend/src/global/mimetype.ts index 059d8c6e7..e47de260a 100644 --- a/frontend/src/global/mimetype.ts +++ b/frontend/src/global/mimetype.ts @@ -212,6 +212,10 @@ export const DNSTypes = [ label: i18n.global.t('website.rainyun'), value: 'RainYun', }, + { + label: i18n.global.t('website.westCN'), + value: 'WestCN', + }, ]; export const Fields = [ diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index aa32167c1..cb0661b00 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -2261,6 +2261,7 @@ const message = { "When the reverse proxy backend is HTTPS, you might need to set the origin SNI. Please refer to the CDN service provider's documentation for details.", huaweicloud: 'Huawei Cloud', rainyun: 'Rain Yun', + westCN: 'West CN', }, php: { short_open_tag: 'Short tag support', diff --git a/frontend/src/lang/modules/ja.ts b/frontend/src/lang/modules/ja.ts index dd7ed4b04..558277092 100644 --- a/frontend/src/lang/modules/ja.ts +++ b/frontend/src/lang/modules/ja.ts @@ -2233,6 +2233,8 @@ const message = { sniHelper: '逆プロキシバックエンドがHTTPSの場合、Origin SNIを設定する必要がある場合があります。詳細については、CDNサービスプロバイダーのドキュメントを参照してください。', huaweicloud: 'huaweiCloud', + rainyun: 'Rain Yun', + westCN: 'West CN', }, php: { short_open_tag: '短いタグサポート', diff --git a/frontend/src/lang/modules/ko.ts b/frontend/src/lang/modules/ko.ts index 2a89a48ed..3c4283898 100644 --- a/frontend/src/lang/modules/ko.ts +++ b/frontend/src/lang/modules/ko.ts @@ -2195,6 +2195,7 @@ const message = { '역방향 프록시 백엔드가 HTTPS 인 경우 원본 SNI 를 설정해야 할 수 있습니다. 자세한 내용은 CDN 서비스 제공자의 문서를 참조하세요.', huaweicloud: '화웨이 클라우드', rainyun: '레인윤', + westCN: 'West CN', }, php: { short_open_tag: '짧은 태그 지원', diff --git a/frontend/src/lang/modules/ms.ts b/frontend/src/lang/modules/ms.ts index 0d09a0c9d..6f98667bd 100644 --- a/frontend/src/lang/modules/ms.ts +++ b/frontend/src/lang/modules/ms.ts @@ -2284,6 +2284,7 @@ const message = { 'Apabila backend proksi terbalik adalah HTTPS, anda mungkin perlu menetapkan sumber SNI. Sila rujuk dokumentasi penyedia perkhidmatan CDN untuk butiran.', huaweicloud: 'Huawei Cloud', rainyun: 'Rain Yun', + westCN: 'West CN', }, php: { short_open_tag: 'Sokongan tag pendek', diff --git a/frontend/src/lang/modules/pt-br.ts b/frontend/src/lang/modules/pt-br.ts index 9f9356396..ba4974724 100644 --- a/frontend/src/lang/modules/pt-br.ts +++ b/frontend/src/lang/modules/pt-br.ts @@ -2280,6 +2280,8 @@ const message = { sniHelper: 'Quando o proxy reverso de backend for HTTPS, você pode precisar configurar o SNI de origem. Consulte a documentação do provedor de serviços CDN para mais detalhes.', huaweicloud: 'Huawei Cloud', + rainyun: 'Rain Yun', + westCN: 'West CN', }, php: { short_open_tag: 'Suporte para short tags', diff --git a/frontend/src/lang/modules/ru.ts b/frontend/src/lang/modules/ru.ts index 39c5127ed..43a276f61 100644 --- a/frontend/src/lang/modules/ru.ts +++ b/frontend/src/lang/modules/ru.ts @@ -2281,6 +2281,7 @@ const message = { 'Когда бэкенд обратного прокси использует HTTPS, может потребоваться установить origin SNI. Подробности см. в документации провайдера CDN.', huaweicloud: 'Huawei Cloud', rainyun: 'Rain Yun', + westCN: 'West CN', }, php: { short_open_tag: 'Поддержка коротких тегов', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 1aff6c702..33cd9b781 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -2116,6 +2116,7 @@ const message = { sniHelper: '反代後端為 https 的時候可能需要設定回源 SNI,具體需要看 CDN 服務商文件', huaweicloud: '華為雲', rainyun: '雨雲', + westCN: '西部數據', }, php: { short_open_tag: '短標籤支援', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index d21de5427..c6b1f33cf 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -2117,6 +2117,7 @@ const message = { sniHelper: '反代后端为 https 的时候可能需要设置回源 SNI,具体需要看 CDN 服务商文档', huaweicloud: '华为云', rainyun: '雨云', + westCN: '西部数码', }, php: { short_open_tag: '短标签支持', diff --git a/frontend/src/views/website/ssl/dns-account/create/index.vue b/frontend/src/views/website/ssl/dns-account/create/index.vue index 26e89a702..8beb016a7 100644 --- a/frontend/src/views/website/ssl/dns-account/create/index.vue +++ b/frontend/src/views/website/ssl/dns-account/create/index.vue @@ -130,6 +130,14 @@ +
+ + + + + + +
@@ -181,6 +189,7 @@ const rules = ref({ email: [Rules.email], password: [Rules.requiredInput], authPassword: [Rules.requiredInput], + username: [Rules.requiredInput], }, }); const account = ref({ @@ -230,7 +239,7 @@ const submit = async (formEl: FormInstance | undefined) => { return; } if (account.value.type === 'ClouDNS') { - if (!account.value.authorization.authID && !account.value.authorization.subAuthID) { + if (!account.value.authorization['authID'] && !account.value.authorization['subAuthID']) { MsgError('Please input Auth ID or Sub Auth ID'); return; } diff --git a/go.mod b/go.mod index fc69cd971..28a31958b 100644 --- a/go.mod +++ b/go.mod @@ -198,6 +198,7 @@ require ( github.com/ncruces/go-strftime v0.1.9 // indirect github.com/nrdcg/dnspod-go v0.4.0 // indirect github.com/nrdcg/freemyip v0.3.0 // indirect + github.com/nrdcg/mailinabox v0.2.0 // indirect github.com/nrdcg/namesilo v0.2.1 // indirect github.com/nwaples/rardecode/v2 v2.0.0-beta.2 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect diff --git a/go.sum b/go.sum index 96ae8ce8a..4ea1501f3 100644 --- a/go.sum +++ b/go.sum @@ -760,6 +760,8 @@ github.com/nrdcg/dnspod-go v0.4.0 h1:c/jn1mLZNKF3/osJ6mz3QPxTudvPArXTjpkmYj0uK6U github.com/nrdcg/dnspod-go v0.4.0/go.mod h1:vZSoFSFeQVm2gWLMkyX61LZ8HI3BaqtHZWgPTGKr6KQ= github.com/nrdcg/freemyip v0.3.0 h1:0D2rXgvLwe2RRaVIjyUcQ4S26+cIS2iFwnhzDsEuuwc= github.com/nrdcg/freemyip v0.3.0/go.mod h1:c1PscDvA0ukBF0dwelU/IwOakNKnVxetpAQ863RMJoM= +github.com/nrdcg/mailinabox v0.2.0 h1:IKq8mfKiVwNW2hQii/ng1dJ4yYMMv3HAP3fMFIq2CFk= +github.com/nrdcg/mailinabox v0.2.0/go.mod h1:0yxqeYOiGyxAu7Sb94eMxHPIOsPYXAjTeA9ZhePhGnc= github.com/nrdcg/namesilo v0.2.1 h1:kLjCjsufdW/IlC+iSfAqj0iQGgKjlbUUeDJio5Y6eMg= github.com/nrdcg/namesilo v0.2.1/go.mod h1:lwMvfQTyYq+BbjJd30ylEG4GPSS6PII0Tia4rRpRiyw= github.com/nwaples/rardecode/v2 v2.0.0-beta.2 h1:e3mzJFJs4k83GXBEiTaQ5HgSc/kOK8q0rDaRO0MPaOk=