From 62751bee7a5e00245bb4dd840a5f4ea35565616a Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Sun, 18 Oct 2026 17:15:16 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=96=B0=E5=A2=9E=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E9=87=91=E5=B1=B1=E4=BA=91KCM=20SLB=E8=AF=81=E4=B9=A6=E6=8F=92?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .trae/skills/certd-online-plugin-dev/SKILL.md | 9 +++++- .../references/online-yaml-format.md | 9 ++++++ .../langs/en-US/certd/apply-template.ts | 1 - .../plugins/common/output-selector/index.vue | 4 +++ .../plugins/common/remote-select.vue | 17 ++++++++-- .../src/locales/langs/zh-CN/certd/pipeline.ts | 1 - .../src/store/plugin/api.plugin.ts | 23 +++----------- .../certd-client/src/store/plugin/define.ts | 28 +++++++++++++++++ .../ui/certd-client/src/store/plugin/index.ts | 31 ++----------------- .../pipeline/component/status-show.vue | 3 ++ .../pipeline/component/step-form/index.vue | 2 ++ packages/ui/certd-server/package.json | 1 + .../src/plugins/plugin-ksyun/access.ts | 1 - .../src/plugins/plugin-ksyun/client.ts | 29 ++++++++++++----- 14 files changed, 97 insertions(+), 62 deletions(-) delete mode 100644 client/src/locales/langs/en-US/certd/apply-template.ts create mode 100644 packages/ui/certd-client/src/store/plugin/define.ts diff --git a/.trae/skills/certd-online-plugin-dev/SKILL.md b/.trae/skills/certd-online-plugin-dev/SKILL.md index 205f16faf..3863cc292 100644 --- a/.trae/skills/certd-online-plugin-dev/SKILL.md +++ b/.trae/skills/certd-online-plugin-dev/SKILL.md @@ -122,7 +122,7 @@ const response = await fetch(`${apiBase}/scoped/sys/ai/plugin/find`, { ## YAML 和脚本规范 -插件始终以完整 YAML 传递和保存,脚本源码放在顶层 `content` 字段。 +插件始终以完整 YAML 传递和保存,脚本源码放在顶层 `content` 字段。`content` 必须使用 YAML 字面块 `|` 保留 JavaScript 换行,禁止使用折叠块 `>`,避免语句拼接导致 `Unexpected token 'const'` 等解析错误。 - 新插件的 `author` 必须使用启动提示词中给出的插件作者,不要自行编造作者名;修改已有插件时保留原 `author`,不要改成其他作者。 - 统一使用 `await _ctx.import(...)` 引用模块。 @@ -133,6 +133,13 @@ const response = await fetch(`${apiBase}/scoped/sys/ai/plugin/find`, { - 使用 `this.ctx.http` 访问 HTTP 能力;默认返回响应体 `response.data`,需要响应头、状态码或 Cookie 时必须设置 `returnOriginRes: true`,再从 `response.data` 读取响应体。详见 `references/context-utils.md`。 - 优先复用 `this.ctx.utils` 中的现成工具,尤其是 `this.ctx.utils.hash` 的摘要和编码方法;完整分类见 `references/context-utils.md`。 - 失败时抛出 `Error`。 +- 日志打印对象时必须使用 `JSON.stringify(value)`,禁止直接字符串拼接对象导致输出 `[object Object]`;需要可读日志时先构造明确的 JSON 字符串。 + +### 证书域名匹配与列表组件 + +- 需要从前置证书获取域名时,优先在 `input` 前置配置 `certDomains` 字段,使用 `cert-domains-getter`,并通过 `inputKey` 指向证书字段。 +- 远程证书或资源列表如果需要按证书域名匹配,必须为每个选项提供 `domain` 字段;`domain` 可以是单个域名字符串,也可以是域名数组。只有满足此前提,才能使用 `this.ctx.utils.options.buildGroupOptions(options, this.certDomains)` 返回分组后的列表。 +- 如果服务商接口不支持分页或服务端搜索,列表组件不要设置 `pager: true` 或 `search: true`;确需搜索时在插件中获取完整列表后执行本地过滤。 需要字段格式时读取 `references/online-yaml-format.md`。 需要组件示例时读取 `references/component-examples.md`。 diff --git a/.trae/skills/certd-online-plugin-dev/references/online-yaml-format.md b/.trae/skills/certd-online-plugin-dev/references/online-yaml-format.md index e9f8ce2ce..91c7004fc 100644 --- a/.trae/skills/certd-online-plugin-dev/references/online-yaml-format.md +++ b/.trae/skills/certd-online-plugin-dev/references/online-yaml-format.md @@ -47,6 +47,8 @@ content: | ### `content` 规则 +- `content` 必须使用 YAML 字面块 `|` 保留脚本换行,禁止使用折叠块 `>`;折叠换行可能导致多个 JavaScript 语句拼接,出现 `Unexpected token 'const'` 等解析错误。 + - 统一使用 `await _ctx.import(...)` 加载模块。 - 使用 `_ctx.import("/@/...")` 以绝对路径加载 `certd-server/src/` 下的模块,`/@` 代表 `certd-server/src` 根路径。 - 需要确认模块时使用 `_ctx.logger`,插件执行过程使用 `this.logger`。 @@ -56,9 +58,16 @@ content: | - HTTP 使用 `this.ctx.http`。默认 `request()` 返回响应体 `response.data`;需要 headers、status 或 Set-Cookie 时设置 `returnOriginRes: true`,此时返回原始响应对象,响应体从 `response.data` 读取。请求扩展参数 `skipSslVerify`、`skipCheckRes`、`logReq`、`logParams`、`logRes`、`logData`、`httpProxy`、`returnOriginRes` 的说明见 `context-utils.md`。 - 优先使用 `this.ctx.utils` 中已有的哈希、编码、字符串、域名和请求工具,详见 `context-utils.md`。 - 不要使用 `console.log`。 +- 日志打印对象时使用 `JSON.stringify(value)`,不要直接拼接对象输出 `[object Object]`。 - 读取授权使用 `await this.getAccess(accessId)` 或目标基类规定的授权方式。 - 失败时抛出 `Error`,不要吞掉错误。 +### 证书域名与列表选项 + +- 需要使用前置证书域名时,在列表字段之前配置 `certDomains`,组件使用 `cert-domains-getter`,并通过 `inputKey` 绑定证书字段。 +- 列表选项可按证书域名匹配时,必须为每个选项设置 `domain`;该字段支持单个域名字符串或域名数组。只有配置该字段后,才使用 `this.ctx.utils.options.buildGroupOptions(options, this.certDomains)`。 +- 服务商接口不支持翻页或服务端搜索时,远程选择组件不要配置 `pager: true`、`search: true`;本地搜索可在获取完整列表后过滤。 + ### 编辑规则 - 修改已有插件时保留 `name`、`author`、`pluginType` 和已有兼容字段。 diff --git a/client/src/locales/langs/en-US/certd/apply-template.ts b/client/src/locales/langs/en-US/certd/apply-template.ts deleted file mode 100644 index 7aa78b134..000000000 --- a/client/src/locales/langs/en-US/certd/apply-template.ts +++ /dev/null @@ -1 +0,0 @@ -export default { setSuccess: "Settings saved", editTitle: "Edit Certificate Application Template", addTitle: "Add Certificate Application Template", name: "Template Name", default: "Default", setDefault: "Set as Default", disabled: "Disabled", createTime: "Created At", config: "Configuration" }; diff --git a/packages/ui/certd-client/src/components/plugins/common/output-selector/index.vue b/packages/ui/certd-client/src/components/plugins/common/output-selector/index.vue index 785cdfd85..f01ee2428 100644 --- a/packages/ui/certd-client/src/components/plugins/common/output-selector/index.vue +++ b/packages/ui/certd-client/src/components/plugins/common/output-selector/index.vue @@ -8,6 +8,7 @@ import { usePluginStore } from "/@/store/plugin"; export default { name: "OutputSelector", + // inheritAttrs: false, props: { modelValue: { type: String, @@ -30,6 +31,9 @@ export default { const pluginStore = usePluginStore(); + // const attrs = ctx.attrs; + // console.log(attrs); + async function onCreate() { await pluginStore.init(); options.value = pluginStore.group.getPreStepOutputOptions({ diff --git a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue index 6ab9b97b1..b4eb2cdac 100644 --- a/packages/ui/certd-client/src/components/plugins/common/remote-select.vue +++ b/packages/ui/certd-client/src/components/plugins/common/remote-select.vue @@ -37,7 +37,7 @@