This commit is contained in:
Max Zhao
2026-05-25 16:54:41 +08:00
committed by GitHub
parent 9c6d175ad1
commit c1de7c9dd2
30 changed files with 62 additions and 62 deletions
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Select, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -70,7 +70,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiVersion: z.string().nonempty(),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -53,7 +53,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
endpoint: z.httpUrl(),
endpoint: z.url({ protocol: core.regexes.httpProtocol }),
eabKid: z.string().nullish(),
eabHmacKey: z.string().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod/v4";
import { core, z } from "zod";
import FileTextInput from "@/components/FileTextInput";
import { isJsonObject } from "@/utils/validator";
@@ -53,7 +53,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
credentials: z.string().refine((v) => isJsonObject(v), t("common.errmsg.json_invalid")),
});
};
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Select } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -77,7 +77,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
endpoint: z.httpUrl(),
endpoint: z.url({ protocol: core.regexes.httpProtocol }),
mode: z.string().nullish(),
username: z.string().nullish(),
password: z.string().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -60,7 +60,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -60,7 +60,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -60,7 +60,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -64,7 +64,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
username: z.string().nonempty(),
apiToken: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -70,7 +70,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
apiSecret: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Checkbox, Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import CodeTextInput from "@/components/CodeTextInput";
import { isJsonObject } from "@/utils/validator";
@@ -103,7 +103,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
return z
.object({
webhookUrl: z.httpUrl(),
webhookUrl: z.url({ protocol: core.regexes.httpProtocol }),
secret: z.string().nullish(),
useCustomPayload: z.boolean().nullish(),
customPayload: z.string().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Radio, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -75,7 +75,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiRole: z.enum(["user", "admin"]),
accessKeyId: z.string().nonempty(),
accessKey: z.string().nonempty(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Radio, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -75,7 +75,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiRole: z.enum(["user", "admin"]),
accessKeyId: z.string().nonempty(),
accessKey: z.string().nonempty(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -54,7 +54,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiToken: z.string().nullish(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Checkbox, Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import CodeTextInput from "@/components/CodeTextInput";
import { isJsonObject } from "@/utils/validator";
@@ -103,7 +103,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
return z
.object({
webhookUrl: z.httpUrl(),
webhookUrl: z.url({ protocol: core.regexes.httpProtocol }),
secret: z.string().nullish(),
useCustomPayload: z.boolean().nullish(),
customPayload: z.string().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Radio, Select, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -68,7 +68,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiVersion: z.enum(["v3"]),
apiRole: z.enum(["client", "master"]),
username: z.string().nonempty(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -71,7 +71,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
username: z.string().nonempty(),
password: z.string().nonempty(),
channelId: z.string().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Radio, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import Show from "@/components/Show";
@@ -101,7 +101,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
return z
.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
authMethod: z.enum([AUTH_METHOD_PASSWORD, AUTH_METHOD_TOKEN]),
username: z.string().nullish(),
password: z.string().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -69,7 +69,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiToken: z.string().nonempty(),
apiTokenSecret: z.string().nullish(),
allowInsecureConnections: z.boolean().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -71,7 +71,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
accessTokenId: z.coerce.number().int().positive(),
accessToken: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiToken: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiKey: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -79,7 +79,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
username: z.string().nonempty(),
password: z.string().nonempty(),
totpSecret: z
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Form, Input, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import { useFormNestedFieldsContext } from "./_context";
@@ -59,7 +59,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t: _ } = i18n;
return z.object({
serverUrl: z.httpUrl(),
serverUrl: z.url({ protocol: core.regexes.httpProtocol }),
apiToken: z.string().nonempty(),
allowInsecureConnections: z.boolean().nullish(),
});
@@ -1,7 +1,7 @@
import { getI18n, useTranslation } from "react-i18next";
import { Checkbox, Form, Input } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import CodeTextInput from "@/components/CodeTextInput";
import { isJsonObject } from "@/utils/validator";
@@ -92,7 +92,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
return z
.object({
webhookUrl: z.httpUrl(),
webhookUrl: z.url({ protocol: core.regexes.httpProtocol }),
useCustomPayload: z.boolean().nullish(),
customPayload: z.string().nullish(),
})
@@ -2,7 +2,7 @@ import { getI18n, useTranslation } from "react-i18next";
import { IconChevronDown } from "@tabler/icons-react";
import { Button, Dropdown, Form, Input, Select, Switch } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import CodeTextInput from "@/components/CodeTextInput";
import Show from "@/components/Show";
@@ -398,7 +398,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n: ReturnType<typeof getI18n> }) =
const { t } = i18n;
return z.object({
url: z.httpUrl(),
url: z.url({ protocol: core.regexes.httpProtocol }),
method: z.enum(["GET", "POST", "PUT", "PATCH", "DELETE"]),
headers: z
.string()
@@ -3,7 +3,7 @@ import { getI18n, useTranslation } from "react-i18next";
import { type FlowNodeEntity } from "@flowgram.ai/fixed-layout-editor";
import { type AnchorProps, Form, type FormInstance, Input, Radio } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { z } from "zod";
import { core, z } from "zod";
import FileTextInput from "@/components/FileTextInput";
import Show from "@/components/Show";
@@ -203,7 +203,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
case UPLOAD_SOURCE_URL:
{
const scCertificate = z.httpUrl();
const scCertificate = z.url({ protocol: core.regexes.httpProtocol });
const spCertificate = scCertificate.safeParse(values.certificate);
if (!spCertificate.success) {
ctx.addIssue({
@@ -213,7 +213,7 @@ const getSchema = ({ i18n = getI18n() }: { i18n?: ReturnType<typeof getI18n> })
});
}
const scPrivateKey = z.httpUrl();
const scPrivateKey = z.url({ protocol: core.regexes.httpProtocol });
const spPrivateKey = scPrivateKey.safeParse(values.privateKey);
if (!spPrivateKey.success) {
ctx.addIssue({
@@ -4,7 +4,7 @@ import { useMount } from "ahooks";
import { App, Button, Card, Divider, Form, Input, Select, Skeleton } from "antd";
import { createSchemaFieldRule } from "antd-zod";
import { produce } from "immer";
import { z } from "zod";
import { core, z } from "zod";
import Show from "@/components/Show";
import Tips from "@/components/Tips";
@@ -286,7 +286,7 @@ const InternalCASharedFormEabFields = ({ i18nKey }: { i18nKey: string }) => {
const hasGuide = i18n.exists(`access.form.${i18nKey}_eab.guide`);
const formSchema = z.object({
endpoint: z.httpUrl(),
endpoint: z.url({ protocol: core.regexes.httpProtocol }),
eabKid: z.string().nonempty(),
eabHmacKey: z.string().nonempty(),
});
@@ -411,7 +411,7 @@ const InternalCASettingsFormProviderACMECA = () => {
const { t } = useTranslation();
const formSchema = z.object({
endpoint: z.httpUrl(),
endpoint: z.url({ protocol: core.regexes.httpProtocol }),
eabKid: z.string().nullish(),
eabHmacKey: z.string().nullish(),
});