diff --git a/app/(auth)/login/page.tsx b/app/(auth)/login/page.tsx index ba8adb2..f1a28e5 100644 --- a/app/(auth)/login/page.tsx +++ b/app/(auth)/login/page.tsx @@ -2,6 +2,7 @@ import { Suspense } from "react"; import { Metadata } from "next"; import Link from "next/link"; +import { siteConfig } from "@/config/site"; import { cn } from "@/lib/utils"; import { buttonVariants } from "@/components/ui/button"; import { UserAuthForm } from "@/components/forms/user-auth-form"; @@ -29,10 +30,13 @@ export default function LoginPage() {
Enter your email to sign in to your account
diff --git a/app/(marketing)/s/page.tsx b/app/(marketing)/s/page.tsx deleted file mode 100644 index b2432e2..0000000 --- a/app/(marketing)/s/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function IndexPage() { - return <>>; -} diff --git a/app/api/record/update/route.ts b/app/api/record/update/route.ts index 06b30b6..3d46381 100644 --- a/app/api/record/update/route.ts +++ b/app/api/record/update/route.ts @@ -18,7 +18,6 @@ export async function POST(req: Request) { } const { record, recordId } = await req.json(); - console.log(record, recordId); const data = await updateDNSRecord( CLOUDFLARE_ZONE_ID, diff --git a/app/api/s/route.ts b/app/api/s/route.ts new file mode 100644 index 0000000..53e24c7 --- /dev/null +++ b/app/api/s/route.ts @@ -0,0 +1,31 @@ +import { NextRequest, NextResponse } from "next/server"; + +import { createUserShortUrlMeta, getUrlBySuffix } from "@/lib/dto/short-urls"; + +export async function GET(req: NextRequest) { + try { + console.log("[api/s]", req.ip, req.geo); + + const url = new URL(req.url); + const slug = url.searchParams.get("slug"); + if (!slug) return Response.json(null); + + const res = await getUrlBySuffix(slug); + if (res?.target && res?.active === 1) { + await createUserShortUrlMeta({ + urlId: res.id, + click: 1, + ip: req.ip ?? "127.0.0.0", + city: req.geo?.city ?? "", + region: req.geo?.region ?? "", + country: req.geo?.country ?? "", + latitude: req.geo?.latitude ?? "", + longitude: req.geo?.longitude ?? "", + }); + return Response.json(res.target); + } + return Response.json(null); + } catch (error) { + return Response.json(null); + } +} diff --git a/auth.config.ts b/auth.config.ts index 95322ab..36041b6 100644 --- a/auth.config.ts +++ b/auth.config.ts @@ -22,7 +22,7 @@ export default { }), Resend({ apiKey: env.RESEND_API_KEY, - from: "wrdo- Required. Use @ for root + Required. Use @ for root.
)}
- © 2024{" "}
-
- oiov
-
- .
Built with{" "}
-
- Nextjs
- {" "}
- &{" "}
-
- Cloudflare
-
- .
-
+ © 2024{" "}
+
+ oiov
+
+ .
Built with{" "}
+
+ Nextjs
+ {" "}
+ &{" "}
+
+ Cloudflare
+
+ .
+