tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
27
pulls
pipelines
add dev url to map domain to local url
awarm.space
6 months ago
8894b96c
6f115f93
+21
1 changed file
expand all
collapse all
unified
split
app
lish
url
[url]
page.tsx
+21
app/lish/url/[url]/page.tsx
···
1
1
+
import { AtUri } from "@atproto/syntax";
2
2
+
import Link from "next/link";
3
3
+
import { redirect } from "next/navigation";
4
4
+
import { supabaseServerClient } from "supabase/serverClient";
5
5
+
6
6
+
export default async function AllPubs(props: {
7
7
+
params: Promise<{ url: string }>;
8
8
+
}) {
9
9
+
if (process.env.NODE_ENV === "production")
10
10
+
return new Response("Not allowed", { status: 403 });
11
11
+
let { url } = await props.params;
12
12
+
let { data: publication } = await supabaseServerClient
13
13
+
.from("publication_domains")
14
14
+
.select("*")
15
15
+
.eq("domain", url)
16
16
+
.single();
17
17
+
18
18
+
if (!publication) return <div>Publication not found</div>;
19
19
+
let uri = new AtUri(publication.publication);
20
20
+
return redirect(`/lish/${uri.host}/${uri.rkey}`);
21
21
+
}