diff --git a/next.config.mjs b/next.config.mjs index 3a2591a..5826c2d 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -15,10 +15,8 @@ const nextConfig = { ]; }, - // Configuración experimental para mejorar el manejo de headers - experimental: { - serverComponentsExternalPackages: ['ping'], - }, + // Configuración de paquetes externos para server components + serverExternalPackages: ['ping'], // Configuración de red env: { diff --git a/src/app/api/ping/route.js b/src/app/api/ping/route.js index ee84adf..c1f1a80 100644 --- a/src/app/api/ping/route.js +++ b/src/app/api/ping/route.js @@ -136,13 +136,13 @@ export async function POST(request) { statistics: stats, rateLimit: { limit: rateLimitResult.limit, - remaining: rateLimitResult.remaining - 1, + remaining: rateLimitResult.remaining, resetTime: rateLimitResult.resetTime } }, { headers: { 'X-RateLimit-Limit': rateLimitResult.limit.toString(), - 'X-RateLimit-Remaining': (rateLimitResult.remaining - 1).toString(), + 'X-RateLimit-Remaining': rateLimitResult.remaining.toString(), 'X-RateLimit-Reset': rateLimitResult.resetTime.toString() } }); diff --git a/src/app/components/RateLimitInfo.js b/src/app/components/RateLimitInfo.js index f29d9b2..ac01507 100644 --- a/src/app/components/RateLimitInfo.js +++ b/src/app/components/RateLimitInfo.js @@ -23,7 +23,7 @@ export default function RateLimitInfo({ rateLimitInfo }) { }; const getStatusColor = () => { - const percentage = (remaining / limit) * 100; + const percentage = Math.max(0, (remaining / limit) * 100); if (percentage > 50) { return 'bg-green-500'; @@ -35,7 +35,7 @@ export default function RateLimitInfo({ rateLimitInfo }) { }; const getTextColor = () => { - const percentage = (remaining / limit) * 100; + const percentage = Math.max(0, (remaining / limit) * 100); if (percentage > 50) { return 'text-green-700 dark:text-green-300'; @@ -47,7 +47,7 @@ export default function RateLimitInfo({ rateLimitInfo }) { }; const getBorderColor = () => { - const percentage = (remaining / limit) * 100; + const percentage = Math.max(0, (remaining / limit) * 100); if (percentage > 50) { return 'border-green-200 dark:border-green-800'; @@ -59,7 +59,7 @@ export default function RateLimitInfo({ rateLimitInfo }) { }; const getBgColor = () => { - const percentage = (remaining / limit) * 100; + const percentage = Math.max(0, (remaining / limit) * 100); if (percentage > 50) { return 'bg-green-50 dark:bg-green-900/20'; @@ -85,20 +85,20 @@ export default function RateLimitInfo({ rateLimitInfo }) {