From e1a5ac44b38f0d5c1f9aed2ea105c3a16a205b14 Mon Sep 17 00:00:00 2001 From: pengshiyu <1940607002@qq.com> Date: Wed, 30 Aug 2023 18:09:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=AF=81=E4=B9=A6?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=E5=9F=9F=E5=90=8D=E9=AA=8C=E8=AF=81=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E5=90=8E=E8=87=AA=E5=8A=A8=E5=8A=A0=E5=85=A5=E5=88=B0?= =?UTF-8?q?=E8=AF=81=E4=B9=A6=E7=9B=91=E6=8E=A7=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- domain_admin/api/issue_certificate_api.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/domain_admin/api/issue_certificate_api.py b/domain_admin/api/issue_certificate_api.py index 97ec0fb8d6..cdcd7b9c6e 100644 --- a/domain_admin/api/issue_certificate_api.py +++ b/domain_admin/api/issue_certificate_api.py @@ -4,12 +4,13 @@ @Date : 2023-07-23 """ from flask import g, request -from playhouse.shortcuts import model_to_dict +from playhouse.shortcuts import model_to_dict, chunked +from domain_admin.model.domain_model import DomainModel from domain_admin.model.host_model import HostModel from domain_admin.model.issue_certificate_model import IssueCertificateModel from domain_admin.service import issue_certificate_service -from domain_admin.utils import ip_util +from domain_admin.utils import ip_util, domain_util from domain_admin.utils.acme_util.challenge_type import ChallengeType from domain_admin.utils.flask_ext.app_exception import AppException @@ -47,6 +48,23 @@ def verify_certificate(): issue_certificate_service.renew_certificate(issue_certificate_id) + # 验证成功后,自动添加到证书监控列表 + issue_certificate_row = IssueCertificateModel.get_by_id(issue_certificate_id) + + lst = [ + { + 'domain': domain, + 'root_domain': domain_util.get_root_domain(domain), + 'port': 443, + 'alias': '', + 'user_id': current_user_id, + 'group_id': 0, + } for domain in issue_certificate_row.domains + ] + + for batch in chunked(lst, 500): + DomainModel.insert_many(batch).on_conflict_ignore().execute() + def get_certificate_challenges(): issue_certificate_id = request.json['issue_certificate_id']