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 standard.site validation
awarm.space
1 month ago
c1168189
8dc7f9b8
+41
-4
2 changed files
expand all
collapse all
unified
split
app
lish
[did]
[publication]
.well-known
site.standard.publication
route.ts
p
[didOrHandle]
[rkey]
page.tsx
+34
app/lish/[did]/[publication]/.well-known/site.standard.publication/route.ts
···
1
1
+
import { publicationNameOrUriFilter } from "src/utils/uriHelpers";
2
2
+
import { supabaseServerClient } from "supabase/serverClient";
3
3
+
4
4
+
export async function GET(
5
5
+
req: Request,
6
6
+
props: {
7
7
+
params: Promise<{ publication: string; did: string }>;
8
8
+
},
9
9
+
) {
10
10
+
let params = await props.params;
11
11
+
let did = decodeURIComponent(params.did);
12
12
+
let publication_name = decodeURIComponent(params.publication);
13
13
+
let [{ data: publications }] = await Promise.all([
14
14
+
supabaseServerClient
15
15
+
.from("publications")
16
16
+
.select(
17
17
+
`*,
18
18
+
publication_subscriptions(*),
19
19
+
documents_in_publications(documents(
20
20
+
*,
21
21
+
comments_on_documents(count),
22
22
+
document_mentions_in_bsky(count)
23
23
+
))
24
24
+
`,
25
25
+
)
26
26
+
.eq("identity_did", did)
27
27
+
.or(publicationNameOrUriFilter(did, publication_name))
28
28
+
.order("uri", { ascending: false })
29
29
+
.limit(1),
30
30
+
]);
31
31
+
let publication = publications?.[0];
32
32
+
if (!did || !publication) return new Response(null, { status: 404 });
33
33
+
return new Response(publication.uri);
34
34
+
}
+7
-4
app/p/[didOrHandle]/[rkey]/page.tsx
···
38
38
39
39
return {
40
40
icons: {
41
41
-
other: {
42
42
-
rel: "alternate",
43
43
-
url: document.uri,
44
44
-
},
41
41
+
other: [
42
42
+
{
43
43
+
rel: "alternate",
44
44
+
url: document.uri,
45
45
+
},
46
46
+
{ rel: "site.standard.document", url: document.uri },
47
47
+
],
45
48
},
46
49
title: docRecord.title,
47
50
description: docRecord?.description || "",