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) {
{/* 全局操作 */}
-