diff --git a/packages/core/pipeline/src/core/license.ts b/packages/core/pipeline/src/core/license.ts
index 23cdbc6a..01bef9a3 100644
--- a/packages/core/pipeline/src/core/license.ts
+++ b/packages/core/pipeline/src/core/license.ts
@@ -1,4 +1,10 @@
import { logger } from "../utils/index.js";
-import { setLogger } from "@certd/plus";
+import { setLogger, isPlus } from "@certd/plus";
setLogger(logger);
export * from "@certd/plus";
+
+export function checkPlus() {
+ if (!isPlus()) {
+ throw new Error("此为专业版功能,请升级到专业版");
+ }
+}
diff --git a/packages/ui/Dockerfile b/packages/ui/Dockerfile
index 427d2a36..c1fe92cc 100644
--- a/packages/ui/Dockerfile
+++ b/packages/ui/Dockerfile
@@ -10,6 +10,7 @@ RUN cd /workspace/certd-server && pnpm install && npm run build-on-docker
FROM node:20-alpine
+RUN apk add --no-cache openssl
WORKDIR /app/
COPY --from=builder /workspace/certd-server/ /app/
RUN chmod +x /app/tools/linux/*
diff --git a/packages/ui/certd-client/src/components/index.ts b/packages/ui/certd-client/src/components/index.ts
index 07e3fce0..3df02964 100644
--- a/packages/ui/certd-client/src/components/index.ts
+++ b/packages/ui/certd-client/src/components/index.ts
@@ -3,7 +3,7 @@ import PiAccessSelector from "../views/certd/access/access-selector/index.vue";
import PiDnsProviderSelector from "./dns-provider-selector/index.vue";
import PiOutputSelector from "../views/certd/pipeline/pipeline/component/output-selector/index.vue";
import PiEditable from "./editable.vue";
-import VipButton from "./vip-button/index.vue";
+import vip from "./vip-button/install.js";
import { CheckCircleOutlined, InfoCircleOutlined, UndoOutlined } from "@ant-design/icons-vue";
import CronEditor from "./cron-editor/index.vue";
import { CronLight } from "@vue-js-cron/light";
@@ -15,12 +15,14 @@ export default {
app.component("PiEditable", PiEditable);
app.component("PiOutputSelector", PiOutputSelector);
app.component("PiDnsProviderSelector", PiDnsProviderSelector);
- app.component("VipButton", VipButton);
+
app.component("CronLight", CronLight);
app.component("CronEditor", CronEditor);
app.component("CheckCircleOutlined", CheckCircleOutlined);
app.component("InfoCircleOutlined", InfoCircleOutlined);
app.component("UndoOutlined", UndoOutlined);
+
+ app.use(vip);
}
};
diff --git a/packages/ui/certd-client/src/components/vip-button/directive.ts b/packages/ui/certd-client/src/components/vip-button/directive.ts
new file mode 100644
index 00000000..bf6f28de
--- /dev/null
+++ b/packages/ui/certd-client/src/components/vip-button/directive.ts
@@ -0,0 +1,23 @@
+import { message, notification } from "ant-design-vue";
+import { useUserStore } from "/@/store/modules/user";
+export default {
+ mounted(el: any, binding: any, vnode: any) {
+ const { value } = binding;
+ const userStore = useUserStore();
+ el.className = el.className + " need-plus";
+ if (!userStore.isPlus) {
+ function checkPlus() {
+ // 事件处理代码
+ notification.warn({
+ message: "此为专业版功能,请升级到专业版"
+ });
+ }
+ el.addEventListener("click", function (event: any) {
+ checkPlus();
+ });
+ el.addEventListener("move", function (event: any) {
+ checkPlus();
+ });
+ }
+ }
+};
diff --git a/packages/ui/certd-client/src/components/vip-button/install.ts b/packages/ui/certd-client/src/components/vip-button/install.ts
new file mode 100644
index 00000000..5dfa93d7
--- /dev/null
+++ b/packages/ui/certd-client/src/components/vip-button/install.ts
@@ -0,0 +1,6 @@
+import VipButton from "./index.vue";
+import plus from "./directive.js";
+export default function (app: any) {
+ app.component("VipButton", VipButton);
+ app.directive("plus", plus);
+}
diff --git a/packages/ui/certd-client/src/store/modules/user.ts b/packages/ui/certd-client/src/store/modules/user.ts
index 06c1ad9b..019b78d0 100644
--- a/packages/ui/certd-client/src/store/modules/user.ts
+++ b/packages/ui/certd-client/src/store/modules/user.ts
@@ -7,7 +7,7 @@ import * as UserApi from "/src/api/modules/api.user";
import { RegisterReq } from "/src/api/modules/api.user";
// @ts-ignore
import { LoginReq, UserInfoRes } from "/@/api/modules/api.user";
-import { Modal, notification } from "ant-design-vue";
+import { message, Modal, notification } from "ant-design-vue";
import { useI18n } from "vue-i18n";
import { mitter } from "/src/utils/util.mitt";
@@ -67,7 +67,14 @@ export const useUserStore = defineStore({
LocalStorage.remove(TOKEN_KEY);
LocalStorage.remove(USER_INFO_KEY);
},
-
+ checkPlus() {
+ if (!this.isPlus) {
+ notification.warn({
+ message: "此为专业版功能,请先升级到专业版"
+ });
+ throw new Error("此为专业版功能,请升级到专业版");
+ }
+ },
async register(user: RegisterReq) {
await UserApi.register(user);
notification.success({
diff --git a/packages/ui/certd-client/src/style/common.less b/packages/ui/certd-client/src/style/common.less
index 68712ee4..52db4981 100644
--- a/packages/ui/certd-client/src/style/common.less
+++ b/packages/ui/certd-client/src/style/common.less
@@ -161,4 +161,8 @@ h1, h2, h3, h4, h5, h6 {
align-items: center;
justify-content: center;
}
-}
\ No newline at end of file
+}
+
+.need-plus {
+ color: #c5913f !important;
+}
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
index bfd1df90..eaf59228 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
+++ b/packages/ui/certd-client/src/views/certd/pipeline/crud.tsx
@@ -191,6 +191,7 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
},
copy: {
click: async (context) => {
+ userStore.checkPlus();
const { ui } = useUi();
// @ts-ignore
let row = context[ui.tableColumn.row];
@@ -200,7 +201,8 @@ export default function ({ crudExpose, context: { certdFormRef } }: CreateCrudOp
row: row,
index: context.index
});
- }
+ },
+ class: "need-plus"
},
config: {
order: 1,
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue
index c2e0b45c..352cebe4 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue
+++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/component/task-form/index.vue
@@ -43,7 +43,7 @@
添加步骤
-
+
@@ -54,7 +54,7 @@
编辑
复制
删除
-
+
@@ -83,6 +83,7 @@ import PiStepForm from "../step-form/index.vue";
import { Modal } from "ant-design-vue";
import { CopyOutlined } from "@ant-design/icons-vue";
import VDraggable from "vuedraggable";
+import { useUserStore } from "/@/store/modules/user";
export default {
name: "PiTaskForm",
components: { CopyOutlined, PiStepForm, VDraggable },
@@ -94,6 +95,7 @@ export default {
},
emits: ["update"],
setup(props: any, ctx: any) {
+ const userStore = useUserStore();
function useStep() {
const stepFormRef: Ref = ref(null);
const currentStepIndex = ref(0);
@@ -248,6 +250,7 @@ export default {
};
}
return {
+ userStore,
labelCol: { span: 6 },
wrapperCol: { span: 16 },
...useTaskForm(),
diff --git a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue
index a76a3fbb..072396f8 100644
--- a/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue
+++ b/packages/ui/certd-client/src/views/certd/pipeline/pipeline/index.vue
@@ -20,7 +20,7 @@
-
+
@@ -69,11 +69,11 @@
-
-
+
-
@@ -264,6 +264,7 @@ import { PipelineDetail, PipelineOptions, PluginGroups, RunHistory } from "./typ
import type { Runnable } from "@certd/pipeline";
import PiHistoryTimelineItem from "/@/views/certd/pipeline/pipeline/component/history-timeline-item.vue";
import { FsIcon } from "@fast-crud/fast-crud";
+import { useUserStore } from "/@/store/modules/user";
export default defineComponent({
name: "PipelineEdit",
// eslint-disable-next-line vue/no-unused-components
@@ -298,6 +299,8 @@ export default defineComponent({
router.back();
}
+ const userStore = useUserStore();
+
const loadCurrentHistoryDetail = async () => {
console.log("load history logs");
const detail: RunHistory = await props.options?.getHistoryDetail({ historyId: currentHistory.value.id });
@@ -653,6 +656,7 @@ export default defineComponent({
currentHistory,
histories,
goBack,
+ userStore,
...useTaskRet,
...useStageRet,
...useTrigger(),
diff --git a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts
index 8bb3c3e1..01d49c3e 100644
--- a/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts
+++ b/packages/ui/certd-server/src/plugins/plugin-host/plugin/host-shell-execute/index.ts
@@ -31,7 +31,7 @@ export class HostShellExecutePlugin extends AbstractTaskPlugin {
vModel: 'value',
rows: 6,
},
- helper:"注意:如果目标主机是windows,且终端是cmd,系统会自动将多行命令通过“&&”连接成一行",
+ helper: '注意:如果目标主机是windows,且终端是cmd,系统会自动将多行命令通过“&&”连接成一行',
required: true,
})
script!: string;
diff --git a/test/docker/Dockerfile b/test/docker/Dockerfile
new file mode 100644
index 00000000..1f72dc27
--- /dev/null
+++ b/test/docker/Dockerfile
@@ -0,0 +1,3 @@
+FROM node:20-alpine
+RUN apk add --no-cache openssl
+WORKDIR /app/
diff --git a/test/docker/docker-compose.yaml b/test/docker/docker-compose.yaml
new file mode 100644
index 00000000..1c797958
--- /dev/null
+++ b/test/docker/docker-compose.yaml
@@ -0,0 +1,14 @@
+version: '3.3' # 指定docker-compose 版本
+services: # 要拉起的服务们
+ certdtest:
+ build:
+ context: ./
+ dockerfile: Dockerfile
+ image: certd-test:1
+ container_name: certdtest # 容器名
+ volumes:
+ - ./data:/app/data
+ command: ["tail", "-f", "/dev/null"]
+ environment:
+ - TZ=Asia/Shanghai
+