From 591177e7a1fdf9c84b9ae5fb9b1537cb17e95905 Mon Sep 17 00:00:00 2001 From: Eamon-meng <17516219072@163.com> Date: Mon, 1 Dec 2025 19:21:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=8F=90=E5=8F=96IP=E8=A1=A8?= =?UTF-8?q?=E6=A0=BC=E5=AD=97=E6=AE=B5=E5=92=8C=E9=A1=B5=E9=9D=A2=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=20&=20=E5=89=8D=E7=AB=AF=E8=AE=BE=E7=BD=AE=E7=99=BD?= =?UTF-8?q?=E5=90=8D=E5=8D=95=E6=B7=BB=E5=8A=A0=E6=95=B0=E9=87=8F=E9=99=90?= =?UTF-8?q?=E5=88=B6=20&=20=E4=BF=AE=E5=A4=8D=E9=95=BF=E6=95=88=E5=A5=97?= =?UTF-8?q?=E9=A4=90=E8=B4=AD=E4=B9=B0=E6=95=B0=E9=87=8F=E5=92=8C=E6=8F=90?= =?UTF-8?q?=E5=8F=96=E6=95=B0=E9=87=8F=E9=BB=98=E8=AE=A4=E5=80=BC=E5=92=8C?= =?UTF-8?q?=E9=80=92=E5=A2=9E=E5=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/admin/channels/page.tsx | 56 ++++++--- src/app/admin/whitelist/page.tsx | 11 +- src/components/composites/extract/index.tsx | 9 +- .../composites/purchase/long/center.tsx | 117 ++++++++++-------- src/lib/models/models.ts | 16 +++ 5 files changed, 130 insertions(+), 79 deletions(-) diff --git a/src/app/admin/channels/page.tsx b/src/app/admin/channels/page.tsx index 85681e4..926e788 100644 --- a/src/app/admin/channels/page.tsx +++ b/src/app/admin/channels/page.tsx @@ -155,34 +155,52 @@ export default function ChannelsPage(props: ChannelsPageProps) { }} columns={[ { - header: '代理地址', cell: ({row}) => `${row.original.proxy_host}:${row.original.proxy_port}`, + header: '代理地址', cell: ({row}) => { + const channel = row.original + const ip = channel.proxy?.ip + const port = channel.port + return `${ip}:${port}` + }, }, { - header: '认证方式', cell: ({row}) => { + header: '认证方式', + cell: ({row}) => { + const channel = row.original + const hasWhitelist = channel.whitelists && channel.whitelists.trim() !== '' + const hasAuth = channel.username && channel.password + return ( -
- {row.original.auth_ip && ( - <> - IP 白名单 - {row.original.whitelists.replaceAll(',', ', ')} - - )} - {row.original.auth_pass && ( - <> - 账号密码 - - {row.original.username} - : - {row.original.password} - - +
+ {hasWhitelist ? ( +
+ 白名单 +
+ {channel.whitelists.split(',').map((ip, index) => ( + + {ip.trim()} + + ))} +
+
+ ) : hasAuth ? ( +
+ 账号密码 +
+ {channel.username}:{channel.password} +
+
+ ) : ( + 无认证 )}
) }, }, { - header: '过期时间', cell: ({row}) => format(row.original.expiration, 'yyyy-MM-dd HH:mm:ss'), + header: '过期时间', cell: ({row}) => format(row.original.expired_at, 'yyyy-MM-dd HH:mm:ss'), }, { header: '操作', cell: ({row}) => -, diff --git a/src/app/admin/whitelist/page.tsx b/src/app/admin/whitelist/page.tsx index e79e360..f853f8a 100644 --- a/src/app/admin/whitelist/page.tsx +++ b/src/app/admin/whitelist/page.tsx @@ -33,6 +33,8 @@ type SchemaType = z.infer export type WhitelistPageProps = {} +const MAX_WHITELIST_COUNT = 5 + export default function WhitelistPage(props: WhitelistPageProps) { const [wait, setWait] = useState(false) @@ -53,6 +55,8 @@ export default function WhitelistPage(props: WhitelistPageProps) { setWait(true) try { const resp = await listWhitelist({page, size}) + console.log(resp, '白名单resp') + if (!resp.success) { throw new Error(resp.message) } @@ -227,9 +231,10 @@ export default function WhitelistPage(props: WhitelistPageProps) { {/* 全局操作 */}
- {/* + diff --git a/src/components/composites/purchase/long/center.tsx b/src/components/composites/purchase/long/center.tsx index 51175b4..863c678 100644 --- a/src/components/composites/purchase/long/center.tsx +++ b/src/components/composites/purchase/long/center.tsx @@ -76,33 +76,37 @@ export default function Center() { className="space-y-4" name="quota" label="IP 购买数量"> - {({id, field}) => ( -
- - - -
- )} + {({id, field}) => { + const value = Number(field.value) || 500 + const minValue = 500 + const step = 100 + return ( +
+ + +
+ {value} +
+ + +
+ ) + }} ) : ( <> @@ -133,33 +137,38 @@ export default function Center() { className="space-y-4" name="daily_limit" label="每日提取上限"> - {({id, field}) => ( -
- - - -
- )} + {({id, field}) => { + const value = Number(field.value) || 100 + const minValue = 100 + const step = 100 + + return ( +
+ + +
+ {value} +
+ + +
+ ) + }} )} diff --git a/src/lib/models/models.ts b/src/lib/models/models.ts index 0c83336..309feec 100644 --- a/src/lib/models/models.ts +++ b/src/lib/models/models.ts @@ -88,6 +88,22 @@ export type Channel = { expiration: Date created_at: Date updated_at: Date + proxy: Proxy + port: number + expired_at: Date +} +export type Proxy = { + id: number + ip: string + msc: string + secret: string + type: number + status: number + created_at: Date + updated_at: Date + deleted_at: Date | null + channels: Channel[] | null + version: number } export type Announcement = {