From 7aac1460c3ca28e6fc57e651a3807615c28813f9 Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Fri, 25 Oct 2024 18:32:47 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E4=BC=98=E5=8C=96=E5=9F=9F=E5=90=8Dma?= =?UTF-8?q?tch?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/core/basic/src/utils/util.domain.ts | 12 ++-- .../components/plugins/common/api-test.vue | 62 +++++++++++++++++++ .../src/components/plugins/index.ts | 2 + 3 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 packages/ui/certd-client/src/components/plugins/common/api-test.vue diff --git a/packages/core/basic/src/utils/util.domain.ts b/packages/core/basic/src/utils/util.domain.ts index 759070835..5e1584eeb 100644 --- a/packages/core/basic/src/utils/util.domain.ts +++ b/packages/core/basic/src/utils/util.domain.ts @@ -26,21 +26,21 @@ function match(targetDomains: string | string[], inDomains: string[]) { if (!inDomain.startsWith('*.')) { //不可能匹配 - break; + continue; } //子域名匹配通配符即可 - if (targetDomain === inDomain.substring(2)) { + const firstDotIndex = targetDomain.indexOf('.'); + const targetDomainSuffix = targetDomain.substring(firstDotIndex + 1); + if (targetDomainSuffix === inDomain.substring(2)) { matched = true; break; } } //有一个没有匹配上,就失败 - if (matched) { - //这个匹配上了,检查下一个 - break; - } else { + if (!matched) { return false; } + //这个匹配上了,检查下一个 } //没有提前return 全部匹配上了 return true; diff --git a/packages/ui/certd-client/src/components/plugins/common/api-test.vue b/packages/ui/certd-client/src/components/plugins/common/api-test.vue new file mode 100644 index 000000000..7749e49f0 --- /dev/null +++ b/packages/ui/certd-client/src/components/plugins/common/api-test.vue @@ -0,0 +1,62 @@ + + + + diff --git a/packages/ui/certd-client/src/components/plugins/index.ts b/packages/ui/certd-client/src/components/plugins/index.ts index f9d811fe9..4c8bc027c 100644 --- a/packages/ui/certd-client/src/components/plugins/index.ts +++ b/packages/ui/certd-client/src/components/plugins/index.ts @@ -6,6 +6,7 @@ import DnsProviderSelector from "/@/components/plugins/cert/dns-provider-selecto import DomainsVerifyPlanEditor from "/@/components/plugins/cert/domains-verify-plan-editor/index.vue"; import AccessSelector from "/@/views/certd/access/access-selector/index.vue"; import InputPassword from "./common/input-password.vue"; +import ApiTest from "./common/api-test.vue"; export * from "./cert/index.js"; export default { install(app: any) { @@ -13,6 +14,7 @@ export default { app.component("DnsProviderSelector", DnsProviderSelector); app.component("DomainsVerifyPlanEditor", DomainsVerifyPlanEditor); app.component("AccessSelector", AccessSelector); + app.component("ApiTest", ApiTest); app.component("SynologyDeviceIdGetter", SynologyIdDeviceGetter); app.component("RemoteSelect", RemoteSelect);