mirror of
https://github.com/certd/certd.git
synced 2026-04-15 21:40:53 +08:00
perf: 授权配置支持加密
原本已经添加的授权配置,再次编辑保存即变成加密配置
This commit is contained in:
@@ -7,7 +7,7 @@ import { IContext } from "@certd/pipeline";
|
||||
import { IDnsProvider } from "../../dns-provider/index.js";
|
||||
import psl from "psl";
|
||||
import { ClientExternalAccountBindingOptions, UrlMapping } from "@certd/acme-client";
|
||||
|
||||
import { utils } from "@certd/pipeline";
|
||||
export type CertInfo = {
|
||||
crt: string;
|
||||
key: string;
|
||||
@@ -90,6 +90,13 @@ export class AcmeService {
|
||||
}
|
||||
if (this.options.useMappingProxy) {
|
||||
urlMapping.enabled = true;
|
||||
} else {
|
||||
//测试directory是否可以访问
|
||||
const isOk = await this.testDirectory(directoryUrl);
|
||||
if (!isOk) {
|
||||
this.logger.info("测试访问失败,自动使用代理");
|
||||
urlMapping.enabled = true;
|
||||
}
|
||||
}
|
||||
const client = new acme.Client({
|
||||
directoryUrl: directoryUrl,
|
||||
@@ -295,4 +302,19 @@ export class AcmeService {
|
||||
altNames,
|
||||
};
|
||||
}
|
||||
|
||||
private async testDirectory(directoryUrl: string) {
|
||||
try {
|
||||
await utils.http({
|
||||
url: directoryUrl,
|
||||
method: "GET",
|
||||
timeout: 5000,
|
||||
});
|
||||
} catch (e) {
|
||||
this.logger.error(`${directoryUrl},测试访问失败`, e);
|
||||
return false;
|
||||
}
|
||||
this.logger.info(`${directoryUrl},测试访问成功`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,8 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
|
||||
name: "pi-dns-provider-selector",
|
||||
},
|
||||
required: true,
|
||||
helper: "请选择dns解析提供商",
|
||||
helper:
|
||||
"请选择dns解析提供商,您的域名是在哪里注册的,或者域名的dns解析服务器属于哪个平台\n如果这里没有您的dns解析提供商,您可以将域名解析服务器设置成上面的任意一个提供商",
|
||||
})
|
||||
dnsProviderType!: string;
|
||||
|
||||
@@ -108,7 +109,6 @@ export class CertApplyPlugin extends CertApplyBasePlugin {
|
||||
name: "a-switch",
|
||||
vModel: "checked",
|
||||
},
|
||||
maybeNeed: true,
|
||||
helper: "如果acme-v02.api.letsencrypt.org或dv.acme-v02.api.pki.goog被墙无法访问,请尝试开启此选项",
|
||||
})
|
||||
useProxy = false;
|
||||
|
||||
Reference in New Issue
Block a user