mirror of
https://github.com/certd/certd.git
synced 2026-06-28 14:37:32 +08:00
chore: 优化fix
This commit is contained in:
@@ -8,7 +8,7 @@ import { SuiteContentWildcardDomainCountFix } from "./suite-content-wildcard-dom
|
||||
type AutoFixTask = {
|
||||
key: string;
|
||||
fix: {
|
||||
init(): Promise<void>;
|
||||
init(): Promise<boolean>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -56,8 +56,8 @@ export class AutoFix {
|
||||
if (setting.fixed?.[task.key]) {
|
||||
continue;
|
||||
}
|
||||
await task.fix.init();
|
||||
setting.fixed[task.key] = true;
|
||||
const ret = await task.fix.init();
|
||||
setting.fixed[task.key] = ret;
|
||||
await this.sysSettingsService.saveSetting(setting);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,8 +38,10 @@ export class CertInfoWildcardDomainCountFix {
|
||||
if (fixedCount > 0) {
|
||||
logger.info(`已修复证书泛域名数量历史数据,数量=${fixedCount}`);
|
||||
}
|
||||
return true
|
||||
} catch (e: any) {
|
||||
logger.error("修复证书泛域名数量历史数据失败", e);
|
||||
}
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ export class GoogleCommonEabAccountKeyFix {
|
||||
|
||||
async init() {
|
||||
if (!isComm()) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const certApplyConfig = await this.pluginConfigService.getPluginConfig({
|
||||
@@ -56,31 +56,33 @@ export class GoogleCommonEabAccountKeyFix {
|
||||
});
|
||||
const googleCommonEabAccessId = certApplyConfig?.sysSetting?.input?.googleCommonEabAccessId;
|
||||
if (!googleCommonEabAccessId) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const eabAccess = await this.accessService.getAccessById(googleCommonEabAccessId, false);
|
||||
if (eabAccess.accountKey) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
if (!eabAccess.kid) {
|
||||
logger.info("公共Google EAB授权缺少KID,跳过历史ACME账号私钥修复");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const accountConfig = await this.getLegacyGoogleAccountConfig(eabAccess.email);
|
||||
const privateKey = accountConfig?.privateKey || accountConfig?.key || accountConfig?.accountKey;
|
||||
if (!privateKey) {
|
||||
logger.info("未找到可迁移到公共Google EAB授权的历史ACME账号私钥");
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
|
||||
const accountKey = buildEabAccountKeyValue(eabAccess.kid, privateKey);
|
||||
await this.accessService.updateAccess({ id: googleCommonEabAccessId, eabType: "google", accountKey });
|
||||
logger.info(`已修复公共Google EAB授权的ACME账号私钥,accessId=${googleCommonEabAccessId}`);
|
||||
return true;
|
||||
} catch (e: any) {
|
||||
logger.error("修复公共Google EAB授权ACME账号私钥失败", e);
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
async getLegacyGoogleAccountConfig(email?: string) {
|
||||
|
||||
@@ -41,6 +41,7 @@ export class OauthSubtypeBoundTypeFix {
|
||||
await this.convertLegacyAddonLoginTypeToArray(addonEntity, legacyLoginType, manager);
|
||||
}
|
||||
});
|
||||
return true
|
||||
} catch (e: any) {
|
||||
logger.error("修复OAuth subtype绑定历史数据失败", e);
|
||||
}
|
||||
|
||||
+2
@@ -33,9 +33,11 @@ export class SuiteContentWildcardDomainCountFix {
|
||||
if (fixedCount > 0) {
|
||||
logger.info(`已修复套餐最大泛域名数量历史数据,数量=${fixedCount}`);
|
||||
}
|
||||
return true
|
||||
} catch (e: any) {
|
||||
logger.error("修复套餐最大泛域名数量历史数据失败", e);
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
private async fixSuiteContentWildcardDomainCountByTable(entityManager: any, tableName: string) {
|
||||
|
||||
@@ -363,7 +363,6 @@ export class PipelineService extends BaseService<PipelineEntity> {
|
||||
if (!old && userSuite?.pipelineCount.max != -1 && userSuite?.pipelineCount.used + 1 > userSuite?.pipelineCount.max) {
|
||||
throw new NeedSuiteException(`对不起,您最多只能创建${userSuite?.pipelineCount.max}条流水线,请购买或升级套餐`);
|
||||
}
|
||||
|
||||
let oldDomainCount = 0;
|
||||
let oldWildcardDomainCount = 0;
|
||||
if (old?.id) {
|
||||
|
||||
Reference in New Issue
Block a user