From 1eb9bd34fd2a838671a7a6ae542f5806a31e15d6 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 20 May 2025 09:36:13 +0800 Subject: [PATCH 01/13] docs: --- docker/run/docker-compose.yaml | 2 +- docs/guide/qa/index.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/run/docker-compose.yaml b/docker/run/docker-compose.yaml index 2192012d..12e99ec7 100644 --- a/docker/run/docker-compose.yaml +++ b/docker/run/docker-compose.yaml @@ -16,7 +16,7 @@ services: - "7001:7001" # ↓↓↓↓ ---------------------------------------------------------- https端口,可以根据实际情况,是否暴露该端口 - "7002:7002" - #↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo ENOTFOUND错误,可以尝试设置dns + #↓↓↓↓ -------------------------------------------------------------- 如果出现getaddrinfo EAI_AGAIN 或 getaddrinfo ENOTFOUND 错误,可以尝试设置dns # dns: # - 223.5.5.5 # 阿里云公共dns # - 223.6.6.6 diff --git a/docs/guide/qa/index.md b/docs/guide/qa/index.md index adab1b3e..7171795b 100644 --- a/docs/guide/qa/index.md +++ b/docs/guide/qa/index.md @@ -1,12 +1,12 @@ # 常见报错解决 ## 1. getaddrinfo ENOTFOUND错误 -如果出现`getaddrinfo ENOTFOUND`错误,可以尝试在`docker-compose.yaml`中设置dns +如果出现`getaddrinfo ENOTFOUND`/`getaddrinfo EAI_AGAIN`错误,可以尝试在`docker-compose.yaml`中设置dns ```yaml version: '3.3' # 兼容旧版docker-compose services: certd: - #↓↓↓↓ ------------ # 如果出现getaddrinfo ENOTFOUND错误,可以尝试设置dns + #↓↓↓↓ ------------ # 如果出现getaddrinfo ENOTFOUND 或 EAI_AGAIN错误,可以尝试设置dns dns: - 223.5.5.5 # 阿里云公共dns - 223.6.6.6 From a3086e6a5bec8b07f5e1d21a2ca8bd969c75bd5c Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 20 May 2025 23:19:50 +0800 Subject: [PATCH 02/13] =?UTF-8?q?fix(cert):=20=E4=BF=AE=E6=AD=A3=E8=AF=81?= =?UTF-8?q?=E4=B9=A6=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/plugin/cert-plugin/base.ts | 3 ++- .../plugin-cert/test/cert-plugin.test.mjs | 27 +++++++++++++++++++ .../ui/certd-client/src/style/antdv4.less | 6 +++++ 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 packages/plugins/plugin-cert/test/cert-plugin.test.mjs diff --git a/packages/plugins/plugin-cert/src/plugin/cert-plugin/base.ts b/packages/plugins/plugin-cert/src/plugin/cert-plugin/base.ts index 46bf9efb..da387e0e 100644 --- a/packages/plugins/plugin-cert/src/plugin/cert-plugin/base.ts +++ b/packages/plugins/plugin-cert/src/plugin/cert-plugin/base.ts @@ -145,7 +145,8 @@ export abstract class CertApplyBasePlugin extends CertApplyBaseConvertPlugin { throw new Error("过期时间不能为空"); } // 检查有效期 - const leftDays = dayjs(expires).diff(dayjs(), "day"); + const leftDays = Math.floor((expires - dayjs().valueOf()) / (1000 * 60 * 60 * 24)); + this.logger.info(`证书剩余天数:${leftDays}`); return { isWillExpire: leftDays <= maxDays, leftDays, diff --git a/packages/plugins/plugin-cert/test/cert-plugin.test.mjs b/packages/plugins/plugin-cert/test/cert-plugin.test.mjs new file mode 100644 index 00000000..7af120ee --- /dev/null +++ b/packages/plugins/plugin-cert/test/cert-plugin.test.mjs @@ -0,0 +1,27 @@ +import { expect } from "chai"; +import { CertApplyPlugin } from "../dist/index.js"; +import dayjs from "dayjs"; +import { logger } from "@certd/basic"; + +describe("test/cert-plugin.ts", () => { + const certApplyPlugin = new CertApplyPlugin(); + certApplyPlugin.logger = logger; + it("should throw error when expires is null or undefined", () => { + expect(() => { + // @ts-ignore + certApplyPlugin.isWillExpire(undefined); + }).throw("过期时间不能为空"); + + expect(() => { + // @ts-ignore + certApplyPlugin.isWillExpire(null); + }).throw("过期时间不能为空"); + }); + + it("isWillExpire", () => { + const now = dayjs().add(36, "day") - 10000; + const res = certApplyPlugin.isWillExpire(now.valueOf(), 35); + console.log(res); + expect(res.isWillExpire).eq(true); + }); +}); diff --git a/packages/ui/certd-client/src/style/antdv4.less b/packages/ui/certd-client/src/style/antdv4.less index 40c79d3b..227c9096 100644 --- a/packages/ui/certd-client/src/style/antdv4.less +++ b/packages/ui/certd-client/src/style/antdv4.less @@ -65,4 +65,10 @@ footer{ .ant-select-multiple .ant-select-selection-item-remove{ display: flex; align-items: center; +} + + +.ant-progress.ant-progress-show-info .ant-progress-outer { + margin-inline-end: calc(-3em - 8px); + padding-inline-end: calc(3em + 8px); } \ No newline at end of file From bb22f062ed4ab4b5b71938270fe4cc666af6b8e7 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Tue, 20 May 2025 23:28:09 +0800 Subject: [PATCH 03/13] =?UTF-8?q?perf:=20=E4=BA=8C=E6=AC=A1=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E9=A1=B5=E9=9D=A2=E4=B8=AD=EF=BC=8C=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E9=AA=8C=E8=AF=81=E7=A0=81=E8=BE=93=E5=85=A5?= =?UTF-8?q?=E6=A1=86=E7=9A=84=E7=84=A6=E7=82=B9=E6=8E=A7=E5=88=B6=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/ui/certd-client/src/layout/layout-basic.vue | 7 +++++++ .../ui/certd-client/src/views/framework/login/index.vue | 9 +++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/ui/certd-client/src/layout/layout-basic.vue b/packages/ui/certd-client/src/layout/layout-basic.vue index 0a549702..c38fd64d 100644 --- a/packages/ui/certd-client/src/layout/layout-basic.vue +++ b/packages/ui/certd-client/src/layout/layout-basic.vue @@ -21,6 +21,13 @@ const menus = computed(() => [ icon: "fa-solid:book", text: "账号信息", }, + { + handler: () => { + router.push("/certd/mine/security"); + }, + icon: "fluent:shield-keyhole-16-regular", + text: "认证安全设置", + }, ]); const avatar = computed(() => { diff --git a/packages/ui/certd-client/src/views/framework/login/index.vue b/packages/ui/certd-client/src/views/framework/login/index.vue index 6ccc92fa..a748bde7 100644 --- a/packages/ui/certd-client/src/views/framework/login/index.vue +++ b/packages/ui/certd-client/src/views/framework/login/index.vue @@ -54,7 +54,7 @@