Loading examples/blog/routes/posts/[uuid].tsx +5 −3 Original line number Diff line number Diff line Loading @@ -41,11 +41,13 @@ export const handler: Handler<PostPageData> = async (req, ctx) => { accept === "application/ld+json" || accept === "application/json" ) { const fedCtx = federation.createContext(req); const note = toArticle(fedCtx, blog, post, comments); const jsonLd = await note.toJsonLd(fedCtx); const article = toArticle(fedCtx, blog, post, comments); const jsonLd = await article.toJsonLd(fedCtx); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": "application/ld+json", "Content-Type": "application/activity+json", Link: `<${article.id}>; rel="alternate"; type="application/activity+json"`, Vary: "Accept", }, }); Loading federation/handler.ts +3 −5 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ export async function handleActor<TContextData>( const jsonLd = await actor.toJsonLd({ documentLoader }); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', "Content-Type": "application/activity+json", Vary: "Accept", }, }); Loading Loading @@ -204,8 +203,7 @@ export async function handleCollection< const jsonLd = await collection.toJsonLd({ documentLoader }); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', "Content-Type": "application/activity+json", Vary: "Accept", }, }); Loading Loading @@ -254,7 +252,7 @@ export async function handleInbox<TContextData>( } const keyId = await verify(request, documentLoader); if (keyId == null) { const response = new Response("Failed to verify the reuqest signature.", { const response = new Response("Failed to verify the request signature.", { status: 401, headers: { "Content-Type": "text/plain; charset=utf-8" }, }); Loading Loading
examples/blog/routes/posts/[uuid].tsx +5 −3 Original line number Diff line number Diff line Loading @@ -41,11 +41,13 @@ export const handler: Handler<PostPageData> = async (req, ctx) => { accept === "application/ld+json" || accept === "application/json" ) { const fedCtx = federation.createContext(req); const note = toArticle(fedCtx, blog, post, comments); const jsonLd = await note.toJsonLd(fedCtx); const article = toArticle(fedCtx, blog, post, comments); const jsonLd = await article.toJsonLd(fedCtx); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": "application/ld+json", "Content-Type": "application/activity+json", Link: `<${article.id}>; rel="alternate"; type="application/activity+json"`, Vary: "Accept", }, }); Loading
federation/handler.ts +3 −5 Original line number Diff line number Diff line Loading @@ -66,8 +66,7 @@ export async function handleActor<TContextData>( const jsonLd = await actor.toJsonLd({ documentLoader }); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', "Content-Type": "application/activity+json", Vary: "Accept", }, }); Loading Loading @@ -204,8 +203,7 @@ export async function handleCollection< const jsonLd = await collection.toJsonLd({ documentLoader }); return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"', "Content-Type": "application/activity+json", Vary: "Accept", }, }); Loading Loading @@ -254,7 +252,7 @@ export async function handleInbox<TContextData>( } const keyId = await verify(request, documentLoader); if (keyId == null) { const response = new Response("Failed to verify the reuqest signature.", { const response = new Response("Failed to verify the request signature.", { status: 401, headers: { "Content-Type": "text/plain; charset=utf-8" }, }); Loading