diff --git a/packages/core/basic/src/utils/index.ts b/packages/core/basic/src/utils/index.ts
index ba12f73a2..fb8568817 100644
--- a/packages/core/basic/src/utils/index.ts
+++ b/packages/core/basic/src/utils/index.ts
@@ -9,7 +9,7 @@ export * from './util.merge.js';
export * from './util.cache.js';
import sleep from './util.sleep.js';
import { http } from './util.request.js';
-import { nanoid } from 'nanoid';
+
import { mergeUtils } from './util.merge.js';
import { sp } from './util.sp.js';
import { hashUtils } from './util.hash.js';
@@ -20,7 +20,8 @@ import { cache } from './util.cache.js';
import dayjs from 'dayjs';
import { domainUtils } from './util.domain.js';
import { optionsUtils } from './util.options.js';
-
+import { nanoid } from 'nanoid';
+import * as id from './util.id.js';
export const utils = {
sleep,
http,
@@ -32,6 +33,7 @@ export const utils = {
mergeUtils,
cache,
nanoid,
+ id,
dayjs,
domain: domainUtils,
options: optionsUtils,
diff --git a/packages/core/basic/src/utils/util.id.ts b/packages/core/basic/src/utils/util.id.ts
new file mode 100644
index 000000000..472d1fe2f
--- /dev/null
+++ b/packages/core/basic/src/utils/util.id.ts
@@ -0,0 +1,3 @@
+import { customAlphabet } from 'nanoid';
+
+export const simpleNanoId = customAlphabet('1234567890abcdefghijklmopqrstuvwxyz', 10);
diff --git a/packages/core/pipeline/package.json b/packages/core/pipeline/package.json
index 6ebb2c506..d66f7aa98 100644
--- a/packages/core/pipeline/package.json
+++ b/packages/core/pipeline/package.json
@@ -4,6 +4,7 @@
"version": "1.27.0",
"type": "module",
"main": "./dist/index.js",
+ "module": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"dev": "vite",
diff --git a/packages/libs/lib-server/src/system/basic/service/plus-service.ts b/packages/libs/lib-server/src/system/basic/service/plus-service.ts
index 803308d64..faa2e2ed1 100644
--- a/packages/libs/lib-server/src/system/basic/service/plus-service.ts
+++ b/packages/libs/lib-server/src/system/basic/service/plus-service.ts
@@ -12,13 +12,18 @@ export class PlusService {
plusServerBaseUrls: string[];
async getPlusRequestService() {
- const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
+ const subjectId = await this.getSubjectId();
return new PlusRequestService({
plusServerBaseUrls: this.plusServerBaseUrls,
- subjectId: installInfo.siteId,
+ subjectId,
});
}
+ async getSubjectId() {
+ const installInfo: SysInstallInfo = await this.sysSettingsService.getSetting(SysInstallInfo);
+ return installInfo.siteId;
+ }
+
async requestWithoutSign(config: any) {
const plusRequestService = await this.getPlusRequestService();
return await plusRequestService.requestWithoutSign(config);
diff --git a/packages/ui/certd-client/package.json b/packages/ui/certd-client/package.json
index a9e8da715..270299396 100644
--- a/packages/ui/certd-client/package.json
+++ b/packages/ui/certd-client/package.json
@@ -26,10 +26,10 @@
"dependencies": {
"@ant-design/colors": "^7.0.2",
"@ant-design/icons-vue": "^6.1.0",
- "@fast-crud/fast-crud": "^1.22.2",
- "@fast-crud/fast-extends": "^1.22.2",
- "@fast-crud/ui-antdv4": "^1.22.2",
- "@fast-crud/ui-interface": "^1.22.2",
+ "@fast-crud/fast-crud": "^1.22.3",
+ "@fast-crud/fast-extends": "^1.22.3",
+ "@fast-crud/ui-antdv4": "^1.22.3",
+ "@fast-crud/ui-interface": "^1.22.3",
"@iconify/vue": "^4.1.1",
"@soerenmartius/vue3-clipboard": "^0.1.2",
"@vue-js-cron/light": "^4.0.5",
diff --git a/packages/ui/certd-client/src/api/service.ts b/packages/ui/certd-client/src/api/service.ts
index df000c1f6..41c1e15af 100644
--- a/packages/ui/certd-client/src/api/service.ts
+++ b/packages/ui/certd-client/src/api/service.ts
@@ -28,6 +28,7 @@ function createService() {
// dataAxios 是 axios 返回数据中的 data
const dataAxios = response.data;
+ // @ts-ignore
if (response.config.unpack === false) {
//如果不需要解包
return dataAxios;
diff --git a/packages/ui/certd-client/src/components/cron-editor/index.vue b/packages/ui/certd-client/src/components/cron-editor/index.vue
index d9091185b..aa6e26934 100644
--- a/packages/ui/certd-client/src/components/cron-editor/index.vue
+++ b/packages/ui/certd-client/src/components/cron-editor/index.vue
@@ -48,6 +48,15 @@ const onUpdate = (value: string) => {
if (value === props.modelValue) {
return;
}
+ const arr: string[] = value.split(" ");
+ if (arr[0] === "*") {
+ arr[0] = "0";
+ }
+ if (arr[1] === "*") {
+ arr[1] = "0";
+ }
+ value = arr.join(" ");
+
emit("update:modelValue", value);
errorMessage.value = undefined;
};
diff --git a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
index 5050c142b..10fbe4aa3 100644
--- a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
+++ b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-record-info.vue
@@ -15,7 +15,11 @@
- 点击验证
+
+ 点击验证
+
+
+
不要删除CNAME
|
@@ -27,6 +31,7 @@ import { CnameRecord, GetByDomain } from "/@/components/plugins/cert/domains-ver
import { ref, watch } from "vue";
import { dict } from "@fast-crud/fast-crud";
import * as api from "./api.js";
+import CnameTip from "./cname-tip.vue";
const statusDict = dict({
data: [
{ label: "待设置CNAME", value: "cname", color: "warning" },
diff --git a/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue
new file mode 100644
index 000000000..4b56da377
--- /dev/null
+++ b/packages/ui/certd-client/src/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue
@@ -0,0 +1,19 @@
+
+
+
+
+
多试几次,如果仍然无法验证通过,请按如下步骤排查问题:
+
1. 解析记录应该添加在{{ record.domain }}域名下
+
2. 要添加的是CNAME类型的记录,不是TXT
+
3. 核对记录值是否是:{{ record.recordValue }}
+
+
+
+
+
+
+
diff --git a/packages/ui/certd-client/src/components/tutorial/tutorial-steps.vue b/packages/ui/certd-client/src/components/tutorial/tutorial-steps.vue
index 81ef87f37..4f881079f 100644
--- a/packages/ui/certd-client/src/components/tutorial/tutorial-steps.vue
+++ b/packages/ui/certd-client/src/components/tutorial/tutorial-steps.vue
@@ -64,18 +64,22 @@ const steps = ref([
{
image: "/static/doc/images/3-add-success.png",
title: "流水线创建成功",
- descriptions: ["此时证书申请任务已经建好", "点击手动触发即可测试证书申请", "接下来演示如何添加部署任务"]
+ descriptions: ["点击手动触发即可申请证书"]
+ },
+ {
+ title: "接下来演示如何自动部署证书",
+ descriptions: ["如果您只需要申请证书,那么到这一步就可以了"]
}
]
},
{
title: "添加部署证书任务",
- description: "演示部署到主机上的Nginx",
+ description: "这里演示部署证书到Nginx",
items: [
{
image: "/static/doc/images/5-1-add-host.png",
- title: "添加nginx部署任务",
- descriptions: ["演示第一个部署任务,部署到nginx"]
+ title: "添加证书部署任务",
+ descriptions: ["这里演示自动部署证书到nginx", "Certd提供茫茫多的部署插件,满足您的各种部署需求"]
},
{
image: "/static/doc/images/5-2-add-host.png",
@@ -94,8 +98,8 @@ const steps = ref([
},
{
image: "/static/doc/images/5-5-plugin-list.png",
- title: "还可以添加其他更多部署任务",
- descriptions: ["插件列表"]
+ title: "本系统提供茫茫多的部署插件",
+ descriptions: ["您可以根据自身需求将证书部署到各种应用和平台"]
}
]
},
diff --git a/packages/ui/certd-client/src/components/vip-button/index.vue b/packages/ui/certd-client/src/components/vip-button/index.vue
index fbf104234..eaca81830 100644
--- a/packages/ui/certd-client/src/components/vip-button/index.vue
+++ b/packages/ui/certd-client/src/components/vip-button/index.vue
@@ -155,7 +155,7 @@ function openUpgrade() {
title = "续期专业版/升级商业版";
}
- modal.confirm({
+ const modalRef = modal.confirm({
title,
async onOk() {
return await doActive();
@@ -206,6 +206,10 @@ function openUpgrade() {
);
}
+ function goAccount() {
+ router.push("/sys/account");
+ modalRef.destroy();
+ }
return (
@@ -226,6 +230,9 @@ function openUpgrade() {
没有激活码?
{activationCodeGetWay}
+
+ 激活码使用过一次之后,不可再次使用,如果要更换站点,请
绑定账号,然后"转移VIP"即可
+
);
diff --git a/packages/ui/certd-client/src/layout/layout-framework.vue b/packages/ui/certd-client/src/layout/layout-framework.vue
index 19060c5f4..d843b3c82 100644
--- a/packages/ui/certd-client/src/layout/layout-framework.vue
+++ b/packages/ui/certd-client/src/layout/layout-framework.vue
@@ -165,7 +165,7 @@ onMounted(async () => {
await settingStore.checkUrlBound();
});
-function menuClick(menu) {
+function menuClick(menu: any) {
routerUtils.open(menu.path);
}
diff --git a/packages/ui/certd-client/src/router/resolve.ts b/packages/ui/certd-client/src/router/resolve.ts
index 8c36cc7dd..7c53cdeae 100644
--- a/packages/ui/certd-client/src/router/resolve.ts
+++ b/packages/ui/certd-client/src/router/resolve.ts
@@ -40,11 +40,11 @@ function transformOneResource(resource: any, parent: any) {
if (route.component == null) {
route.component = LayoutPass;
}
- if (route?.meta?.cache !== false) {
+ if (route?.meta?.cache !== true) {
if (route.meta == null) {
route.meta = {};
}
- route.meta.cache = true;
+ route.meta.cache = false;
}
}
if (resource.children) {
diff --git a/packages/ui/certd-client/src/router/source/modules/certd.ts b/packages/ui/certd-client/src/router/source/modules/certd.ts
index 062d70552..bdab1c79b 100644
--- a/packages/ui/certd-client/src/router/source/modules/certd.ts
+++ b/packages/ui/certd-client/src/router/source/modules/certd.ts
@@ -1,5 +1,3 @@
-import { sysResources } from "/@/router/source/modules/sys";
-
export const certdResources = [
{
title: "证书自动化",
diff --git a/packages/ui/certd-client/src/store/modules/user.ts b/packages/ui/certd-client/src/store/modules/user.ts
index faeba1772..21d1566aa 100644
--- a/packages/ui/certd-client/src/store/modules/user.ts
+++ b/packages/ui/certd-client/src/store/modules/user.ts
@@ -82,6 +82,10 @@ export const useUserStore = defineStore({
return userInfo;
},
+ async loadUserInfo() {
+ await this.getUserInfoAction();
+ },
+
async onLoginSuccess(loginData: any) {
await this.getUserInfoAction();
const userInfo = await this.getUserInfoAction();
diff --git a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
index a19fe246f..9127b8f32 100644
--- a/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/cname/record/crud.tsx
@@ -6,7 +6,7 @@ import { AddReq, CreateCrudOptionsProps, CreateCrudOptionsRet, DelReq, dict, Edi
import { useUserStore } from "/@/store/modules/user";
import { useSettingStore } from "/@/store/modules/settings";
import { message } from "ant-design-vue";
-
+import CnameTip from "/@/components/plugins/cert/domains-verify-plan-editor/cname-tip.vue";
export default function ({ crudExpose, context }: CreateCrudOptionsProps): CreateCrudOptionsRet {
const router = useRouter();
const { t } = useI18n();
@@ -126,11 +126,18 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
component: {
onDictChange: ({ form, dict }: any) => {
if (!form.cnameProviderId) {
- const item = dict.data.find((item: any) => item.isDefault);
+ const item = dict.data.find((item: any) => item.isDefault && !item.disabled);
if (item) {
form.cnameProviderId = item.id;
}
}
+ },
+ renderLabel(item: any) {
+ if (item.title) {
+ return `${item.domain}<${item.title}>`;
+ } else {
+ return item.domain;
+ }
}
},
helper: {
@@ -147,7 +154,13 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}
},
column: {
- show: false
+ cellRender({ value }) {
+ if (value < 0) {
+ return 公共CNAME;
+ } else {
+ return 自定义CNAME;
+ }
+ }
}
},
status: {
@@ -183,6 +196,7 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
if (row.status === "valid") {
return "-";
}
+
async function doVerify() {
row._validating_ = true;
try {
@@ -199,9 +213,12 @@ export default function ({ crudExpose, context }: CreateCrudOptionsProps): Creat
}
}
return (
-
- 点击验证
-
+
);
}
}
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx
index ca686f960..ca78cf67a 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/pipeline/certd-form/crud.tsx
@@ -98,7 +98,7 @@ export default function (certPluginGroup: PluginGroup, formWrapperRef: any): Cre
vModel: "modelValue",
placeholder: "0 0 4 * * *"
},
- helper: "点击上面的按钮,选择每天几点几分定时执行,后面的分秒都要选择0。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
+ helper: "点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行",
order: 100
}
},
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/trigger-form/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/trigger-form/index.vue
index b6dacaf3d..e65a3976b 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/trigger-form/index.vue
+++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/trigger-form/index.vue
@@ -58,7 +58,7 @@
name: 'cron-editor',
vModel: 'modelValue'
},
- helper: '点击上面的按钮,选择每天几点几分定时执行,后面的分秒都要选择0。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行',
+ helper: '点击上面的按钮,选择每天几点定时执行。\n建议设置为每天触发一次,证书未到期之前任务会跳过,不会重复执行',
rules: [{ required: true, message: '此项必填' }]
}"
/>
diff --git a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
index 988172faa..3db8ecae4 100644
--- a/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
+++ b/packages/ui/certd-client/src/views/framework/home/dashboard/index.vue
@@ -205,6 +205,7 @@ async function loadPluginGroups() {
const pluginGroups = ref();
onMounted(async () => {
+ await userStore.loadUserInfo();
await loadLatestVersion();
await loadCount();
await loadPluginGroups();
diff --git a/packages/ui/certd-server/src/controller/basic/file-controller.ts b/packages/ui/certd-server/src/controller/basic/file-controller.ts
index 714b5d9e6..7c6519210 100644
--- a/packages/ui/certd-server/src/controller/basic/file-controller.ts
+++ b/packages/ui/certd-server/src/controller/basic/file-controller.ts
@@ -41,6 +41,7 @@ export class FileController extends BaseController {
}
const filePath = this.fileService.getFile(key, userId);
this.ctx.response.attachment(filePath);
+ this.ctx.response.set('Cache-Control', 'public,max-age=2592000');
await send(this.ctx, filePath);
}
}
diff --git a/packages/ui/certd-server/src/controller/cname/cname-provider-controller.ts b/packages/ui/certd-server/src/controller/cname/cname-provider-controller.ts
index 2aca6a6d6..958c40df4 100644
--- a/packages/ui/certd-server/src/controller/cname/cname-provider-controller.ts
+++ b/packages/ui/certd-server/src/controller/cname/cname-provider-controller.ts
@@ -21,7 +21,7 @@ export class CnameProviderController extends BaseController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
- const res = await this.providerService.find({});
+ const res = await this.providerService.list({});
return this.ok(res);
}
}
diff --git a/packages/ui/certd-server/src/controller/cname/cname-record-controller.ts b/packages/ui/certd-server/src/controller/cname/cname-record-controller.ts
index 7a1ad15f8..9d0e55bf5 100644
--- a/packages/ui/certd-server/src/controller/cname/cname-record-controller.ts
+++ b/packages/ui/certd-server/src/controller/cname/cname-record-controller.ts
@@ -40,7 +40,8 @@ export class CnameRecordController extends CrudController {
@Post('/list', { summary: Constants.per.authOnly })
async list(@Body(ALL) body: any) {
body.userId = this.getUserId();
- return super.list(body);
+ const list = await this.getService().list(body);
+ return this.ok(list);
}
@Post('/add', { summary: Constants.per.authOnly })
diff --git a/packages/ui/certd-server/src/modules/cname/entity/cname_provider.ts b/packages/ui/certd-server/src/modules/cname/entity/cname-provider.ts
similarity index 98%
rename from packages/ui/certd-server/src/modules/cname/entity/cname_provider.ts
rename to packages/ui/certd-server/src/modules/cname/entity/cname-provider.ts
index b64d1c5cf..4da5fb633 100644
--- a/packages/ui/certd-server/src/modules/cname/entity/cname_provider.ts
+++ b/packages/ui/certd-server/src/modules/cname/entity/cname-provider.ts
@@ -34,4 +34,6 @@ export class CnameProviderEntity {
default: () => 'CURRENT_TIMESTAMP',
})
updateTime: Date;
+
+ title: string;
}
diff --git a/packages/ui/certd-server/src/modules/cname/service/cname-provider-service.ts b/packages/ui/certd-server/src/modules/cname/service/cname-provider-service.ts
index 3352075ac..feec8ef96 100644
--- a/packages/ui/certd-server/src/modules/cname/service/cname-provider-service.ts
+++ b/packages/ui/certd-server/src/modules/cname/service/cname-provider-service.ts
@@ -1,8 +1,9 @@
import { Provide, Scope, ScopeEnum } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
-import { BaseService, ValidateException } from '@certd/lib-server';
-import { CnameProviderEntity } from '../entity/cname_provider.js';
+import { BaseService, ListReq, ValidateException } from '@certd/lib-server';
+import { CnameProviderEntity } from '../entity/cname-provider.js';
+import { CommonProviders } from './common-provider.js';
/**
* 授权
@@ -19,7 +20,7 @@ export class CnameProviderService extends BaseService {
}
async getDefault() {
- return await this.repository.findOne({ where: { isDefault: true } });
+ return await this.repository.findOne({ where: { isDefault: true, disabled: false } });
}
/**
* 新增
@@ -80,10 +81,24 @@ export class CnameProviderService extends BaseService {
if (def) {
return def;
}
- const founds = await this.repository.find({ take: 1, order: { createTime: 'DESC' } });
+ const founds = await this.repository.find({ take: 1, order: { createTime: 'DESC' }, where: { disabled: false } });
if (founds && founds.length > 0) {
return founds[0];
}
- return null;
+ return CommonProviders[0] as CnameProviderEntity;
+ }
+
+ async list(req: ListReq): Promise {
+ const list = await super.list(req);
+
+ return [...list, ...CommonProviders];
+ }
+
+ async info(id: any, infoIgnoreProperty?: any): Promise {
+ if (id < 0) {
+ //使用公共provider
+ return CommonProviders.find(p => p.id === id);
+ }
+ return await super.info(id, infoIgnoreProperty);
}
}
diff --git a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts
index e7210784c..e92f01758 100644
--- a/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts
+++ b/packages/ui/certd-server/src/modules/cname/service/cname-record-service.ts
@@ -1,16 +1,16 @@
import { Inject, Provide, Scope, ScopeEnum } from '@midwayjs/core';
import { InjectEntityModel } from '@midwayjs/typeorm';
import { Repository } from 'typeorm';
-import { BaseService, ValidateException } from '@certd/lib-server';
+import { BaseService, PlusService, ValidateException } from '@certd/lib-server';
import { CnameRecordEntity, CnameRecordStatusType } from '../entity/cname-record.js';
-import { v4 as uuidv4 } from 'uuid';
import { createDnsProvider, IDnsProvider, parseDomain } from '@certd/plugin-cert';
import { cache, CnameProvider, http, logger, utils } from '@certd/pipeline';
import { AccessService } from '../../pipeline/service/access-service.js';
import { isDev } from '../../../utils/env.js';
import { walkTxtRecord } from '@certd/acme-client';
import { CnameProviderService } from './cname-provider-service.js';
-import { CnameProviderEntity } from '../entity/cname_provider.js';
+import { CnameProviderEntity } from '../entity/cname-provider.js';
+import { CommonDnsProvider } from './common-provider.js';
type CnameCheckCacheValue = {
validating: boolean;
@@ -34,6 +34,10 @@ export class CnameRecordService extends BaseService {
@Inject()
accessService: AccessService;
+
+ @Inject()
+ plusService: PlusService;
+
//@ts-ignore
getRepository() {
return this.repository;
@@ -85,8 +89,8 @@ export class CnameRecordService extends BaseService {
}
param.hostRecord = hostRecord;
- const cnameKey = uuidv4().replaceAll('-', '');
- param.recordValue = `${cnameKey}.${cnameProvider.domain}`;
+ const cnameKey = utils.id.simpleNanoId();
+ param.recordValue = `${param.domain}.${cnameKey}.${cnameProvider.domain}`;
}
async update(param: any) {
@@ -189,6 +193,15 @@ export class CnameRecordService extends BaseService {
if (cnameProvider == null) {
throw new ValidateException(`CNAME服务:${bean.cnameProviderId} 已被删除,请修改CNAME记录,重新选择CNAME服务`);
}
+
+ if (cnameProvider.id < 0) {
+ //公共CNAME
+ return new CommonDnsProvider({
+ config: cnameProvider,
+ plusService: this.plusService,
+ });
+ }
+
const access = await this.accessService.getById(cnameProvider.accessId, cnameProvider.userId);
const context = { access, logger, http, utils };
const dnsProvider: IDnsProvider = await createDnsProvider({
diff --git a/packages/ui/certd-server/src/modules/cname/service/common-provider.ts b/packages/ui/certd-server/src/modules/cname/service/common-provider.ts
new file mode 100644
index 000000000..fb0f987b0
--- /dev/null
+++ b/packages/ui/certd-server/src/modules/cname/service/common-provider.ts
@@ -0,0 +1,61 @@
+import { CreateRecordOptions, DnsProviderContext, IDnsProvider, RemoveRecordOptions } from '@certd/plugin-cert';
+import { PlusService } from '@certd/lib-server';
+
+export type CnameProvider = {
+ id: number;
+ domain: string;
+ title: string;
+};
+export const CommonProviders = [
+ {
+ id: -1,
+ domain: 'cname.certd.com.cn',
+ title: '公共CNAME服务',
+ },
+];
+
+export class CommonDnsProvider implements IDnsProvider {
+ ctx: DnsProviderContext;
+ config: CnameProvider;
+ plusService: PlusService;
+
+ constructor(opts: { config: CnameProvider; plusService: PlusService }) {
+ this.config = opts.config;
+ this.plusService = opts.plusService;
+ }
+
+ async onInstance() {}
+ async createRecord(options: CreateRecordOptions) {
+ if (!this.config.domain.endsWith(options.domain)) {
+ throw new Error('cname服务域名不匹配');
+ }
+ const res = await this.plusService.requestWithoutSign({
+ url: '/activation/certd/cname/recordCreate',
+ data: {
+ subjectId: this.plusService.getSubjectId(),
+ domain: options.domain,
+ hostRecord: options.hostRecord,
+ recordValue: options.value,
+ providerId: this.config.id,
+ },
+ });
+ return res;
+ }
+ async removeRecord(options: RemoveRecordOptions) {
+ const res = await this.plusService.requestWithoutSign({
+ url: '/activation/certd/cname/recordRemove',
+ data: {
+ subjectId: this.plusService.getSubjectId(),
+ domain: options.recordReq.domain,
+ hostRecord: options.recordReq.hostRecord,
+ recordValue: options.recordReq.value,
+ recordId: options.recordRes.id,
+ providerId: this.config.id,
+ },
+ });
+ return res;
+ }
+ setCtx(ctx: DnsProviderContext): void {
+ this.ctx = ctx;
+ }
+}
diff --git a/packages/ui/certd-server/src/modules/pipeline/service/pipeline-service.ts b/packages/ui/certd-server/src/modules/pipeline/service/pipeline-service.ts
index fae388a8e..874cb730b 100644
--- a/packages/ui/certd-server/src/modules/pipeline/service/pipeline-service.ts
+++ b/packages/ui/certd-server/src/modules/pipeline/service/pipeline-service.ts
@@ -306,8 +306,11 @@ export class PipelineService extends BaseService {
return;
}
cron = cron.trim();
+ if (cron.startsWith('* *')) {
+ cron = cron.replace('* *', '0 0');
+ }
if (cron.startsWith('*')) {
- cron = '0' + cron.substring(1, cron.length);
+ cron = cron.replace('*', '0');
}
const triggerId = trigger.id;
const name = this.buildCronKey(pipelineId, triggerId);