@@ -25,7 +25,7 @@ import {
2525 getFollowers ,
2626 removeFollower ,
2727} from "../models/follower.ts" ;
28- import { countPosts , getPosts , toArticle } from "../models/post.ts" ;
28+ import { countPosts , getPost , getPosts , toArticle } from "../models/post.ts" ;
2929import { openKv } from "../models/kv.ts" ;
3030import { getLogger } from "@logtape/logtape" ;
3131
@@ -91,6 +91,21 @@ federation.setActorDispatcher("/users/{handle}", async (ctx, handle, key) => {
9191 } ;
9292 } ) ;
9393
94+ // Registers the object dispatcher, which is responsible for creating an
95+ // `Article` object for a given post UUID:
96+ federation . setObjectDispatcher (
97+ Article ,
98+ "/posts/{uuid}" ,
99+ async ( ctx , { uuid } ) => {
100+ const blog = await getBlog ( ) ;
101+ if ( blog == null ) return null ;
102+ const post = await getPost ( uuid ) ;
103+ if ( post == null ) return null ;
104+ const comments = await getComments ( post . uuid ) ;
105+ return toArticle ( ctx , blog , post , comments ) ;
106+ } ,
107+ ) ;
108+
94109// Registers the outbox dispatcher, which is responsible for listing
95110// activities in the outbox:
96111federation . setOutboxDispatcher (
0 commit comments