From e687f821265dee6aae3315fe1a1075d23228526a Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Fri, 1 Dec 2023 16:54:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=AF=81=E4=B9=A6=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=80=E4=BA=9B=E6=8F=90=E7=A4=BA=20(#3126?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/website_ssl.go | 10 ++++++---- backend/init/migration/migrations/v_1_9.go | 4 ++-- backend/utils/ssl/acme.go | 17 +++-------------- frontend/src/lang/modules/en.ts | 5 +++++ frontend/src/lang/modules/tw.ts | 5 +++++ frontend/src/lang/modules/zh.ts | 5 +++++ .../website/ssl/acme-account/create/index.vue | 4 ++++ frontend/src/views/website/ssl/create/index.vue | 10 +++++++++- frontend/src/views/website/ssl/index.vue | 7 ------- 9 files changed, 39 insertions(+), 28 deletions(-) diff --git a/backend/app/service/website_ssl.go b/backend/app/service/website_ssl.go index 31fd16a0b..3dd1c8f2f 100644 --- a/backend/app/service/website_ssl.go +++ b/backend/app/service/website_ssl.go @@ -153,10 +153,12 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs } create.ID = websiteSSL.ID go func() { - if err = w.ObtainSSL(request.WebsiteSSLApply{ - ID: websiteSSL.ID, - }); err != nil { - global.LOG.Errorf("obtain ssl failed, err: %v", err) + if create.Provider != constant.DnsManual { + if err = w.ObtainSSL(request.WebsiteSSLApply{ + ID: websiteSSL.ID, + }); err != nil { + global.LOG.Errorf("obtain ssl failed, err: %v", err) + } } }() return create, nil diff --git a/backend/init/migration/migrations/v_1_9.go b/backend/init/migration/migrations/v_1_9.go index ace59f6b3..53c898ad3 100644 --- a/backend/init/migration/migrations/v_1_9.go +++ b/backend/init/migration/migrations/v_1_9.go @@ -19,7 +19,7 @@ var UpdateAcmeAccount = &gormigrate.Migration{ } var AddWebsiteCA = &gormigrate.Migration{ - ID: "20231130-add-website-ca", + ID: "20231125-add-website-ca", Migrate: func(tx *gorm.DB) error { if err := tx.AutoMigrate(&model.WebsiteCA{}); err != nil { return err @@ -59,7 +59,7 @@ var AddDatabaseSSL = &gormigrate.Migration{ } var AddDefaultCA = &gormigrate.Migration{ - ID: "20231130-add-default-ca", + ID: "20231129-add-default-ca", Migrate: func(tx *gorm.DB) error { caService := service.NewIWebsiteCAService() if _, err := caService.Create(request.WebsiteCACreate{ diff --git a/backend/utils/ssl/acme.go b/backend/utils/ssl/acme.go index a8ce098ed..0d140dcf6 100644 --- a/backend/utils/ssl/acme.go +++ b/backend/utils/ssl/acme.go @@ -150,26 +150,15 @@ func NewRegisterClient(acmeAccount *model.WebsiteAcmeAccount) (*AcmeClient, erro func newConfig(user *AcmeUser, accountType string) *lego.Config { config := lego.NewConfig(user) - //switch accountType { - //case "letsencrypt": - // config.CADirURL = "https://acme-v02.api.letsencrypt.org/directory" - //case "zerossl": - // config.CADirURL = "https://acme.zerossl.com/v2/DV90" - //case "buypass": - // config.CADirURL = "https://api.buypass.com/acme/directory" - //case "google": - // config.CADirURL = "https://dv.acme-v02.api.pki.goog/directory" - //} - switch accountType { case "letsencrypt": - config.CADirURL = "https://acme-staging-v02.api.letsencrypt.org/directory" + config.CADirURL = "https://acme-v02.api.letsencrypt.org/directory" case "zerossl": config.CADirURL = "https://acme.zerossl.com/v2/DV90" case "buypass": - config.CADirURL = "https://api.test4.buypass.no/acme/directory" + config.CADirURL = "https://api.buypass.com/acme/directory" case "google": - config.CADirURL = "https://dv.acme-v02.test-api.pki.goog/directory\"" + config.CADirURL = "https://dv.acme-v02.api.pki.goog/directory" } config.UserAgent = "1Panel" diff --git a/frontend/src/lang/modules/en.ts b/frontend/src/lang/modules/en.ts index 9ba8ecb64..157451dbc 100644 --- a/frontend/src/lang/modules/en.ts +++ b/frontend/src/lang/modules/en.ts @@ -1856,6 +1856,11 @@ const message = { 'Two files will be generated in this directory, the certificate file: fullchain.pem and the key file: privkey.pem', organizationDetail: 'Organization Details', fromWebsite: 'From Websites', + dnsMauanlHelper: '手動解析模式需要在建立完之後點選申請按鈕取得 DNS 解析值', + httpHelper: 'HTTP 模式需要安裝 OpenResty', + buypassHelper: 'Buypass 大陸地區無法訪問', + googleHelper: + "如何取得EAB HmacKey 和EAB kid ", }, firewall: { create: 'Create rule', diff --git a/frontend/src/lang/modules/tw.ts b/frontend/src/lang/modules/tw.ts index 581605b64..b727ce833 100644 --- a/frontend/src/lang/modules/tw.ts +++ b/frontend/src/lang/modules/tw.ts @@ -1742,6 +1742,11 @@ const message = { pushDirHelper: '會在此目錄下產生兩個文件,憑證檔案:fullchain.pem 金鑰檔案:privkey.pem', organizationDetail: '機構詳情', fromWebsite: '從網站獲取', + dnsMauanlHelper: '手動解析模式需要在建立完之後點選申請按鈕取得 DNS 解析值', + httpHelper: 'HTTP 模式需要安裝 OpenResty', + buypassHelper: 'Buypass 大陸地區無法訪問', + googleHelper: + "如何取得EAB HmacKey 和EAB kid ", }, firewall: { create: '創建規則', diff --git a/frontend/src/lang/modules/zh.ts b/frontend/src/lang/modules/zh.ts index f41b40e37..6347b4511 100644 --- a/frontend/src/lang/modules/zh.ts +++ b/frontend/src/lang/modules/zh.ts @@ -1742,6 +1742,11 @@ const message = { pushDirHelper: '会在此目录下生成两个文件,证书文件:fullchain.pem 密钥文件:privkey.pem', organizationDetail: '机构详情', fromWebsite: '从网站中获取', + dnsMauanlHelper: '手动解析模式需要在创建完之后点击申请按钮获取 DNS 解析值', + httpHelper: 'HTTP 模式需要安装 OpenResty', + buypassHelper: 'Buypass 大陆地区无法访问', + googleHelper: + "如何获取 EAB HmacKey 和 EAB kid ", }, firewall: { create: '创建规则', diff --git a/frontend/src/views/website/ssl/acme-account/create/index.vue b/frontend/src/views/website/ssl/acme-account/create/index.vue index 8a4c2afcf..9a83b0828 100644 --- a/frontend/src/views/website/ssl/acme-account/create/index.vue +++ b/frontend/src/views/website/ssl/acme-account/create/index.vue @@ -21,6 +21,9 @@ :value="acme.value" > + + {{ $t('ssl.buypassHelper') }} + @@ -39,6 +42,7 @@ + diff --git a/frontend/src/views/website/ssl/create/index.vue b/frontend/src/views/website/ssl/create/index.vue index 54c1c135a..443ae16cb 100644 --- a/frontend/src/views/website/ssl/create/index.vue +++ b/frontend/src/views/website/ssl/create/index.vue @@ -61,6 +61,12 @@ {{ $t('website.dnsManual') }} HTTP + + {{ $t('ssl.dnsMauanlHelper') }} + + + {{ $t('ssl.httpHelper') }} + { loading.value = true; CreateSSL(ssl.value) .then((res: any) => { + if (ssl.value.provider != 'dnsManual') { + em('submit', res.data.id); + } handleClose(); - em('submit', res.data.id); MsgSuccess(i18n.global.t('commons.msg.createSuccess')); }) .finally(() => { diff --git a/frontend/src/views/website/ssl/index.vue b/frontend/src/views/website/ssl/index.vue index bf1e39c75..a135a1aee 100644 --- a/frontend/src/views/website/ssl/index.vue +++ b/frontend/src/views/website/ssl/index.vue @@ -2,13 +2,6 @@
-