From 402e00150d97f2293b9065319ef8aedd3b09a900 Mon Sep 17 00:00:00 2001 From: jinnrry Date: Mon, 8 Jul 2024 10:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=AF=81=E4=B9=A6=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/controllers/setup.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/server/controllers/setup.go b/server/controllers/setup.go index b1aadcd..ed9eff2 100644 --- a/server/controllers/setup.go +++ b/server/controllers/setup.go @@ -143,19 +143,22 @@ func Setup(ctx *context.Context, w http.ResponseWriter, req *http.Request) { } if reqData["step"] == "ssl" && reqData["action"] == "set" { - keyPath := reqData["key_path"] - crtPath := reqData["crt_path"] - _, err := os.Stat(keyPath) - if err != nil { - response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w) - return - } + if reqData["ssl_type"] == config.SSLTypeUser { + keyPath := reqData["key_path"] + crtPath := reqData["crt_path"] - _, err = os.Stat(crtPath) - if err != nil { - response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w) - return + _, err := os.Stat(keyPath) + if err != nil { + response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w) + return + } + + _, err = os.Stat(crtPath) + if err != nil { + response.NewErrorResponse(response.ServerError, err.Error(), "").FPrint(w) + return + } } err = ssl.SetSSL(reqData["ssl_type"], reqData["key_path"], reqData["crt_path"])