mirror of https://github.com/certd/certd
perf: 申请证书启用新的反代地址
parent
f8b99b81a2
commit
a705182b85
|
@ -128,6 +128,10 @@ export class Executor {
|
|||
this.runtime.skip(runnable);
|
||||
return resultType;
|
||||
}
|
||||
if (resultType == ResultType.disabled) {
|
||||
this.runtime.disabled(runnable);
|
||||
return resultType;
|
||||
}
|
||||
this.runtime.success(runnable);
|
||||
return ResultType.success;
|
||||
} catch (e: any) {
|
||||
|
@ -164,12 +168,14 @@ export class Executor {
|
|||
|
||||
let resList: ResultType[] = [];
|
||||
if (stage.concurrency === ConcurrencyStrategy.Parallel) {
|
||||
//并行
|
||||
const pList = [];
|
||||
for (const item of runnerList) {
|
||||
pList.push(item());
|
||||
}
|
||||
resList = await Promise.all(pList);
|
||||
} else {
|
||||
//串行
|
||||
for (let i = 0; i < runnerList.length; i++) {
|
||||
const runner = runnerList[i];
|
||||
resList[i] = await runner();
|
||||
|
@ -181,6 +187,7 @@ export class Executor {
|
|||
compositionResultType(resList: ResultType[]): ResultType {
|
||||
let hasSuccess = false;
|
||||
let hasSkip = false;
|
||||
let hasDisabled = false;
|
||||
for (const type of resList) {
|
||||
if (type === ResultType.error) {
|
||||
return ResultType.error;
|
||||
|
@ -188,8 +195,14 @@ export class Executor {
|
|||
hasSuccess = true;
|
||||
} else if (type === ResultType.skip) {
|
||||
hasSkip = true;
|
||||
} else if (type === ResultType.disabled) {
|
||||
hasDisabled = true;
|
||||
}
|
||||
}
|
||||
if (!hasSuccess && !hasSkip && hasDisabled) {
|
||||
//全是disabled
|
||||
return ResultType.disabled;
|
||||
}
|
||||
if (!hasSuccess && hasSkip) {
|
||||
//全是跳过
|
||||
return ResultType.skip;
|
||||
|
|
|
@ -150,10 +150,10 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
|
|||
|
||||
async backupSecret() {
|
||||
const settings = await this.getSettingByKey(SysSecretBackup.__key__);
|
||||
const privateSettings = await this.getPrivateSettings();
|
||||
const installInfo = await this.getSetting<SysInstallInfo>(SysInstallInfo);
|
||||
if (settings == null) {
|
||||
const backup = new SysSecretBackup();
|
||||
const privateSettings = await this.getPrivateSettings();
|
||||
const installInfo = await this.getSetting<SysInstallInfo>(SysInstallInfo);
|
||||
if (installInfo.siteId == null || privateSettings.encryptSecret == null) {
|
||||
logger.error('备份密钥失败,siteId或encryptSecret为空');
|
||||
return;
|
||||
|
@ -162,6 +162,14 @@ export class SysSettingsService extends BaseService<SysSettingsEntity> {
|
|||
backup.encryptSecret = privateSettings.encryptSecret;
|
||||
await this.saveSetting(backup);
|
||||
logger.info('备份密钥成功');
|
||||
} else {
|
||||
//校验是否有变化
|
||||
if (settings.siteId !== installInfo.siteId) {
|
||||
throw new Error(`siteId与备份不一致,可能是数据异常,请检查:backup=${settings.siteId}, current=${installInfo.siteId}`);
|
||||
}
|
||||
if (settings.encryptSecret !== privateSettings.encryptSecret) {
|
||||
throw new Error('encryptSecret与备份不一致,可能是数据异常,请检查');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,8 +92,8 @@ export class AcmeService {
|
|||
const urlMapping: UrlMapping = {
|
||||
enabled: false,
|
||||
mappings: {
|
||||
"acme-v02.api.letsencrypt.org": this.options.reverseProxy || "letsencrypt.proxy.handsfree.work",
|
||||
"dv.acme-v02.api.pki.goog": this.options.reverseProxy || "google.proxy.handsfree.work",
|
||||
"acme-v02.api.letsencrypt.org": this.options.reverseProxy || "le.px.certd.handfree.work",
|
||||
"dv.acme-v02.api.pki.goog": this.options.reverseProxy || "gg.px.certd.handfree.work",
|
||||
},
|
||||
};
|
||||
const conf = await this.getAccountConfig(email, urlMapping);
|
||||
|
|
Loading…
Reference in New Issue