From ba086b602f2e3c990b23e7aadd77efc5cbcbaf1a Mon Sep 17 00:00:00 2001 From: oiov Date: Mon, 26 May 2025 20:19:04 +0800 Subject: [PATCH] test --- middleware.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/middleware.ts b/middleware.ts index ea5b6fa..3c1f693 100644 --- a/middleware.ts +++ b/middleware.ts @@ -4,7 +4,7 @@ import { auth } from "auth"; import { NextAuthRequest } from "next-auth/lib"; import { siteConfig } from "./config/site"; -import { getGeolocation, getUserAgent } from "./lib/geo"; +import { extractRealIP, getGeolocation, getUserAgent } from "./lib/geo"; export const config = { matcher: ["/((?!api|_next/static|_next/image|favicon.ico).*)"], @@ -30,7 +30,7 @@ async function handleShortUrl(req: NextAuthRequest) { const headers = req.headers; const geo = await getGeolocation(req); - const ip = isVercel ? ipAddress(req) : geo?.ip; + const ip = isVercel ? ipAddress(req) : extractRealIP(headers); const ua = getUserAgent(req); const url = new URL(req.url);