fix: 解决申请证书超时导致的脏数据 (#604)

This commit is contained in:
zhengkunwang223 2023-04-12 23:00:30 +08:00 committed by GitHub
parent 4c276ff383
commit 0356bdbf54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -83,6 +83,8 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
return res, err
}
var websiteSSL model.WebsiteSSL
switch create.Provider {
case constant.DNSAccount:
dnsAccount, err := websiteDnsRepo.GetFirst(commonRepo.WithByID(create.DnsAccountID))
@ -92,6 +94,7 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
if err := client.UseDns(ssl.DnsType(dnsAccount.Type), dnsAccount.Authorization); err != nil {
return res, err
}
websiteSSL.AutoRenew = create.AutoRenew
case constant.Http:
appInstall, err := getAppInstallByKey(constant.AppOpenresty)
if err != nil {
@ -100,6 +103,7 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
if err := client.UseHTTP(path.Join(constant.AppInstallDir, constant.AppOpenresty, appInstall.Name, "root")); err != nil {
return res, err
}
websiteSSL.AutoRenew = create.AutoRenew
case constant.DnsManual:
if err := client.UseManualDns(); err != nil {
return res, err
@ -115,7 +119,7 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
if err != nil {
return res, err
}
var websiteSSL model.WebsiteSSL
websiteSSL.DnsAccountID = create.DnsAccountID
websiteSSL.AcmeAccountID = acmeAccount.ID
websiteSSL.Provider = create.Provider
@ -133,7 +137,6 @@ func (w WebsiteSSLService) Create(create request.WebsiteSSLCreate) (request.Webs
websiteSSL.StartDate = cert.NotBefore
websiteSSL.Type = cert.Issuer.CommonName
websiteSSL.Organization = cert.Issuer.Organization[0]
websiteSSL.AutoRenew = create.AutoRenew
if err := websiteSSLRepo.Create(context.TODO(), &websiteSSL); err != nil {
return res, err

View File

@ -100,7 +100,7 @@ export const ListSSL = (req: Website.SSLReq) => {
};
export const CreateSSL = (req: Website.SSLCreate) => {
return http.post<Website.SSLCreate>(`/websites/ssl`, req);
return http.post<Website.SSLCreate>(`/websites/ssl`, req, 60000);
};
export const DeleteSSL = (req: Website.DelReq) => {
@ -128,7 +128,7 @@ export const UpdateSSL = (req: Website.SSLUpdate) => {
};
export const GetDnsResolve = (req: Website.DNSResolveReq) => {
return http.post<Website.DNSResolve[]>(`/websites/ssl/resolve`, req);
return http.post<Website.DNSResolve[]>(`/websites/ssl/resolve`, req, 60000);
};
export const GetHTTPSConfig = (id: number) => {

View File

@ -1110,7 +1110,7 @@ const message = {
primaryPath: 'Main directory',
folderTitle: 'The main directory of the website mainly contains four folders',
wafFolder: 'Firewall Rules',
indexFolder: 'Static website root directory',
indexFolder: 'Website root directory',
logFoler: 'website log',
sslFolder: 'Website certificate',
enableOrNot: 'Enable',

View File

@ -1106,7 +1106,7 @@ const message = {
primaryPath: '主目录',
folderTitle: '网站主目录主要包含四个文件夹',
wafFolder: '防火墙规则',
indexFolder: '静态网站root目录',
indexFolder: '网站root目录',
logFoler: '网站日志',
sslFolder: '网站证书',
enableOrNot: '是否启用',