mirror of
https://github.com/usual2970/certimate.git
synced 2025-06-21 11:50:01 +00:00
fix: #786
This commit is contained in:
parent
3ec0ba7052
commit
08ea915d24
@ -23,7 +23,7 @@ type DeployerConfig struct {
|
|||||||
SecretKey string `json:"secretKey"`
|
SecretKey string `json:"secretKey"`
|
||||||
// 站点 ID。
|
// 站点 ID。
|
||||||
ZoneId string `json:"zoneId"`
|
ZoneId string `json:"zoneId"`
|
||||||
// 加速域名(不支持泛域名)。
|
// 加速域名(支持泛域名)。
|
||||||
Domain string `json:"domain"`
|
Domain string `json:"domain"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ const DeployNodeConfigFormTencentCloudEOConfig = ({
|
|||||||
.trim(),
|
.trim(),
|
||||||
domain: z
|
domain: z
|
||||||
.string({ message: t("workflow_node.deploy.form.tencentcloud_eo_domain.placeholder") })
|
.string({ message: t("workflow_node.deploy.form.tencentcloud_eo_domain.placeholder") })
|
||||||
.refine((v) => validDomainName(v), t("common.errmsg.domain_invalid")),
|
.refine((v) => validDomainName(v, { allowWildcard: true }), t("common.errmsg.domain_invalid")),
|
||||||
});
|
});
|
||||||
const formRule = createSchemaFieldRule(formSchema);
|
const formRule = createSchemaFieldRule(formSchema);
|
||||||
|
|
||||||
|
@ -667,7 +667,7 @@
|
|||||||
"workflow_node.deploy.form.tencentcloud_eo_zone_id.placeholder": "请输入腾讯云 EdgeOne 站点 ID",
|
"workflow_node.deploy.form.tencentcloud_eo_zone_id.placeholder": "请输入腾讯云 EdgeOne 站点 ID",
|
||||||
"workflow_node.deploy.form.tencentcloud_eo_zone_id.tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/edgeone\" target=\"_blank\">https://console.cloud.tencent.com/edgeone</a>",
|
"workflow_node.deploy.form.tencentcloud_eo_zone_id.tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/edgeone\" target=\"_blank\">https://console.cloud.tencent.com/edgeone</a>",
|
||||||
"workflow_node.deploy.form.tencentcloud_eo_domain.label": "腾讯云 EdgeOne 加速域名",
|
"workflow_node.deploy.form.tencentcloud_eo_domain.label": "腾讯云 EdgeOne 加速域名",
|
||||||
"workflow_node.deploy.form.tencentcloud_eo_domain.placeholder": "请输入腾讯云 EdgeOne 加速域名",
|
"workflow_node.deploy.form.tencentcloud_eo_domain.placeholder": "请输入腾讯云 EdgeOne 加速域名(支持泛域名)",
|
||||||
"workflow_node.deploy.form.tencentcloud_eo_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/edgeone\" target=\"_blank\">https://console.cloud.tencent.com/edgeone</a>",
|
"workflow_node.deploy.form.tencentcloud_eo_domain.tooltip": "这是什么?请参阅 <a href=\"https://console.cloud.tencent.com/edgeone\" target=\"_blank\">https://console.cloud.tencent.com/edgeone</a>",
|
||||||
"workflow_node.deploy.form.tencentcloud_scf_region.label": "腾讯云 SCF 产品地域",
|
"workflow_node.deploy.form.tencentcloud_scf_region.label": "腾讯云 SCF 产品地域",
|
||||||
"workflow_node.deploy.form.tencentcloud_scf_region.placeholder": "输入腾讯云 SCF 产品地域(例如:ap-guangzhou)",
|
"workflow_node.deploy.form.tencentcloud_scf_region.placeholder": "输入腾讯云 SCF 产品地域(例如:ap-guangzhou)",
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import { validCronExpression as _validCronExpression } from "./cron";
|
import { z } from "zod";
|
||||||
|
|
||||||
|
import { validCronExpression as _validCronExpression } from "./cron";
|
||||||
|
|
||||||
export const validCronExpression = (value: string) => {
|
export const validCronExpression = (value: string) => {
|
||||||
return _validCronExpression(value);
|
return _validCronExpression(value);
|
||||||
@ -10,20 +12,30 @@ export const validDomainName = (value: string, { allowWildcard = false }: { allo
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const validEmailAddress = (value: string) => {
|
export const validEmailAddress = (value: string) => {
|
||||||
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
try {
|
||||||
return re.test(value);
|
z.string().email().parse(value);
|
||||||
|
return true;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const validIPv4Address = (value: string) => {
|
export const validIPv4Address = (value: string) => {
|
||||||
const re =
|
try {
|
||||||
/^(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])$/;
|
z.string().ip({ version: "v4" }).parse(value);
|
||||||
return re.test(value);
|
return true;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const validIPv6Address = (value: string) => {
|
export const validIPv6Address = (value: string) => {
|
||||||
const re =
|
try {
|
||||||
/^([\da-fA-F]{1,4}:){6}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)|::([\da−fA−F]1,4:)0,4((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|::([\da−fA−F]1,4:)0,4((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|^([\da-fA-F]{1,4}:):([\da-fA-F]{1,4}:){0,3}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)|([\da−fA−F]1,4:)2:([\da−fA−F]1,4:)0,2((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|([\da−fA−F]1,4:)2:([\da−fA−F]1,4:)0,2((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|^([\da-fA-F]{1,4}:){3}:([\da-fA-F]{1,4}:){0,1}((25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(25[0-5]|2[0-4]\d|[01]?\d\d?)|([\da−fA−F]1,4:)4:((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|([\da−fA−F]1,4:)4:((25[0−5]|2[0−4]\d|[01]?\d\d?)\.)3(25[0−5]|2[0−4]\d|[01]?\d\d?)|^([\da-fA-F]{1,4}:){7}[\da-fA-F]{1,4}|:((:[\da−fA−F]1,4)1,6|:)|:((:[\da−fA−F]1,4)1,6|:)|^[\da-fA-F]{1,4}:((:[\da-fA-F]{1,4}){1,5}|:)|([\da−fA−F]1,4:)2((:[\da−fA−F]1,4)1,4|:)|([\da−fA−F]1,4:)2((:[\da−fA−F]1,4)1,4|:)|^([\da-fA-F]{1,4}:){3}((:[\da-fA-F]{1,4}){1,3}|:)|([\da−fA−F]1,4:)4((:[\da−fA−F]1,4)1,2|:)|([\da−fA−F]1,4:)4((:[\da−fA−F]1,4)1,2|:)|^([\da-fA-F]{1,4}:){5}:([\da-fA-F]{1,4})?|([\da−fA−F]1,4:)6:|([\da−fA−F]1,4:)6:/;
|
z.string().ip({ version: "v6" }).parse(value);
|
||||||
return re.test(value);
|
return true;
|
||||||
|
} catch (_) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const validHttpOrHttpsUrl = (value: string) => {
|
export const validHttpOrHttpsUrl = (value: string) => {
|
||||||
@ -36,5 +48,5 @@ export const validHttpOrHttpsUrl = (value: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const validPortNumber = (value: string | number) => {
|
export const validPortNumber = (value: string | number) => {
|
||||||
return parseInt(value + "") === +value && +value >= 1 && +value <= 65535;
|
return parseInt(value + "") === +value && String(+value) === String(value) && +value >= 1 && +value <= 65535;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user