diff --git a/class/core/site_api.py b/class/core/site_api.py index ad4addca4..60930b94e 100755 --- a/class/core/site_api.py +++ b/class/core/site_api.py @@ -844,18 +844,6 @@ class site_api: 'auth_to': auth_to, } - import cert_api - data = cert_api.cert_api().applyCertApi(to_args) - - if not data['status']: - msg = data['msg'] - if type(data['msg']) != str: - msg = data['msg'][0] - emsg = data['msg'][1]['challenges'][0]['error'] - msg = msg + '
响应状态:' + str(emsg['status']) + '
错误类型:' + emsg[ - 'type'] + '
错误代码:' + emsg['detail'] + '
' - return mw.returnJson(data['status'], msg, data['msg']) - src_letpath = mw.getServerDir() + '/web_conf/letsencrypt/' + siteName src_csrpath = src_letpath + "/fullchain.pem" # 生成证书路径 src_keypath = src_letpath + "/privkey.pem" # 密钥文件路径 @@ -864,6 +852,18 @@ class site_api: dst_csrpath = dst_letpath + '/fullchain.pem' dst_keypath = dst_letpath + '/privkey.pem' + if not os.path.exists(src_letpath): + import cert_api + data = cert_api.cert_api().applyCertApi(to_args) + if not data['status']: + msg = data['msg'] + if type(data['msg']) != str: + msg = data['msg'][0] + emsg = data['msg'][1]['challenges'][0]['error'] + msg = msg + '响应状态:' + str(emsg['status']) + '
错误类型:' + emsg[ + 'type'] + '
错误代码:' + emsg['detail'] + '
' + return mw.returnJson(data['status'], msg, data['msg']) + if not os.path.exists(dst_letpath): mw.execShell('mkdir -p ' + dst_letpath) mw.buildSoftLink(src_csrpath, dst_csrpath, True)