添加网关类型GOST
This commit is contained in:
@@ -48,7 +48,8 @@ const schema = z.object({
|
||||
.or(z.literal("")),
|
||||
type: z.string().optional(),
|
||||
status: z.string().optional(),
|
||||
secret: z.string().min(1, "请填写密钥"),
|
||||
secret: z.string().optional(),
|
||||
proxy_port: z.string().optional(),
|
||||
})
|
||||
|
||||
export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
@@ -63,6 +64,7 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
type: "1",
|
||||
status: "0",
|
||||
secret: "",
|
||||
proxy_port: "",
|
||||
},
|
||||
})
|
||||
|
||||
@@ -75,7 +77,8 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
host: data?.host.trim(),
|
||||
type: data.type ? Number(data.type) : 0,
|
||||
status: data.status ? Number(data.status) : 0,
|
||||
secret: data.secret.trim(),
|
||||
secret: data.secret?.trim() ?? "",
|
||||
port: Number(data.proxy_port?.trim()) ?? "",
|
||||
}
|
||||
|
||||
const res = await createGateway(payload)
|
||||
@@ -110,6 +113,7 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
const typeOptions = [
|
||||
{ value: "1", label: "自有" },
|
||||
{ value: "2", label: "白银" },
|
||||
{ value: "3", label: "GOST" },
|
||||
]
|
||||
|
||||
return (
|
||||
@@ -186,6 +190,24 @@ export default function CreatePage(props: { onSuccess?: () => void }) {
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="proxy_port"
|
||||
render={({ field, fieldState }) => (
|
||||
<Field>
|
||||
<FieldLabel htmlFor="gateway-create-host">端口:</FieldLabel>
|
||||
<Input
|
||||
id="gateway-create-host"
|
||||
placeholder="请输入端口,如:8080"
|
||||
{...field}
|
||||
aria-invalid={fieldState.invalid}
|
||||
/>
|
||||
{fieldState.invalid && fieldState.error && (
|
||||
<FieldError errors={[fieldState.error]} />
|
||||
)}
|
||||
</Field>
|
||||
)}
|
||||
/>
|
||||
<Controller
|
||||
control={form.control}
|
||||
name="secret"
|
||||
|
||||
Reference in New Issue
Block a user