From 61401f5e24d1f91a8baebfc5076c4b8f81c78e3c Mon Sep 17 00:00:00 2001 From: Jared Pereira Date: Thu, 4 Sep 2025 16:58:18 +0900 Subject: [PATCH] use route instead of page for local url mapper --- app/lish/url/[url]/{page.tsx => route.tsx} | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) rename app/lish/url/[url]/{page.tsx => route.tsx} (69%) diff --git a/app/lish/url/[url]/page.tsx b/app/lish/url/[url]/route.tsx similarity index 69% rename from app/lish/url/[url]/page.tsx rename to app/lish/url/[url]/route.tsx index 04ae8d61..ff83373d 100644 --- a/app/lish/url/[url]/page.tsx +++ b/app/lish/url/[url]/route.tsx @@ -1,11 +1,12 @@ import { AtUri } from "@atproto/syntax"; -import Link from "next/link"; import { redirect } from "next/navigation"; +import { NextRequest } from "next/server"; import { supabaseServerClient } from "supabase/serverClient"; -export default async function AllPubs(props: { - params: Promise<{ url: string }>; -}) { +export async function GET( + _req: NextRequest, + props: { params: Promise<{ url: string }> }, +) { if (process.env.NODE_ENV === "production") return new Response("Not allowed", { status: 403 }); let { url } = await props.params; @@ -15,7 +16,8 @@ export default async function AllPubs(props: { .eq("domain", url) .single(); - if (!publication) return
Publication not found
; + if (!publication) + return new Response("Publication not found", { status: 404 }); let uri = new AtUri(publication.publication); return redirect(`/lish/${uri.host}/${uri.rkey}`); } -- 2.51.2