From d9790c6d15a2a4d2dcd02f83bce31eccb2d137ed Mon Sep 17 00:00:00 2001 From: Eamon <17516219072@163.com> Date: Thu, 11 Jun 2026 09:38:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BD=91=E5=85=B3=E7=B1=BB?= =?UTF-8?q?=E5=9E=8BGOST?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/actions/gateway.ts | 3 ++- src/app/(root)/gateway/create.tsx | 26 ++++++++++++++++++++++++-- src/app/(root)/gateway/page.tsx | 10 +++++++++- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/actions/gateway.ts b/src/actions/gateway.ts index 25f3d0e..ed0f0aa 100644 --- a/src/actions/gateway.ts +++ b/src/actions/gateway.ts @@ -14,7 +14,8 @@ export async function createGateway(data: { host?: string type: number status: number - secret: string + secret?: string + port?: number }) { return callByUser("/api/admin/proxy/create", data) } diff --git a/src/app/(root)/gateway/create.tsx b/src/app/(root)/gateway/create.tsx index db51c9d..8c83702 100644 --- a/src/app/(root)/gateway/create.tsx +++ b/src/app/(root)/gateway/create.tsx @@ -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 }) { )} /> + ( + + 端口: + + {fieldState.invalid && fieldState.error && ( + + )} + + )} + /> (row.original.type === 1 ? "自有" : "白银"), + cell: ({ row }) => { + const typeMap: Record = { + 1: "自有", + 2: "白银", + 3: "GOST", + } + return typeMap[row.original.type] ?? "" + }, }, { header: "状态",