'use client' import type { MiddlewareHookReturn } from './types' interface RateLimitingTabProps { hook: MiddlewareHookReturn } export default function RateLimitingTab({ hook }: RateLimitingTabProps) { const { saving, ipList, newIP, setNewIP } = hook return (
{/* Rate Limit Config */}

Rate Limit Settings

{(() => { const config = hook.getConfig('rate_limiter') if (!config) return

Loading...

return (
{ const newConfig = { ...config.config, ip_limit: parseInt(e.target.value) } hook.updateConfig('rate_limiter', newConfig) }} className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" />
{ const newConfig = { ...config.config, user_limit: parseInt(e.target.value) } hook.updateConfig('rate_limiter', newConfig) }} className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" />
{ const newConfig = { ...config.config, auth_limit: parseInt(e.target.value) } hook.updateConfig('rate_limiter', newConfig) }} className="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" />
) })()}
{/* IP Whitelist/Blacklist */}

IP Whitelist / Blacklist

{/* Add IP Form */}
setNewIP({ ...newIP, ip_address: e.target.value })} className="flex-1 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" /> setNewIP({ ...newIP, reason: e.target.value })} className="flex-1 rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500" />
{/* IP List Table */} {ipList.length === 0 ? ( ) : ( ipList.map((ip) => ( )) )}
IP Address Type Reason Created
No IPs in whitelist/blacklist
{ip.ip_address} {ip.list_type} {ip.reason || '-'} {new Date(ip.created_at).toLocaleDateString()}
) }