From d0c7cb0a32fd6f759d5f68c6c73152c94cd5abe4 Mon Sep 17 00:00:00 2001 From: 0xJacky Date: Tue, 11 Apr 2023 11:35:47 +0800 Subject: [PATCH] fix: obtain cert --- frontend/src/views/domain/cert/IssueCert.vue | 8 ++- .../views/domain/ngx_conf/NgxConfigEditor.vue | 31 +++++++++- .../nginx/sites-available/homework.jackyu.cn | 56 +------------------ .../ssl/homework.jackyu.cn/fullchain.cer | 44 +++++++-------- .../nginx/ssl/homework.jackyu.cn/private.key | 50 ++++++++--------- 5 files changed, 83 insertions(+), 106 deletions(-) diff --git a/frontend/src/views/domain/cert/IssueCert.vue b/frontend/src/views/domain/cert/IssueCert.vue index 38a57c4b..87ccfaa2 100644 --- a/frontend/src/views/domain/cert/IssueCert.vue +++ b/frontend/src/views/domain/cert/IssueCert.vue @@ -6,7 +6,6 @@ import domain from '@/api/domain' import websocket from '@/lib/websocket' import Template from '@/views/template/Template.vue' import template from '@/api/template' -import _ from 'lodash' const {$gettext, interpolate} = useGettext() @@ -35,7 +34,7 @@ function confirm() { $gettext('Do you want to enable auto-cert renewal?'), content: enabled.value ? $gettext('We need to add the HTTPChallenge configuration to ' + 'this file and reload the Nginx. Are you sure you want to continue?') : - $gettext('We will need to remove the HTTPChallenge configuration from this file and ' + + $gettext('We will remove the HTTPChallenge configuration from this file and ' + 'reload the Nginx configuration file. Are you sure you want to continue?'), mask: false, centered: true, @@ -60,7 +59,10 @@ async function onchange(r: boolean) { v.locations.push(...r.locations) }) }) - await save_site_config() + // if ssl_certificate is empty, do not save, just use the config from last step. + if (!props.directivesMap['ssl_certificate']?.[0]) { + await save_site_config() + } job() } else { await props.ngx_config.servers.forEach((v: any) => { diff --git a/frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue b/frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue index 3f487f32..4dcda748 100644 --- a/frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue +++ b/frontend/src/views/domain/ngx_conf/NgxConfigEditor.vue @@ -1,7 +1,7 @@