From b4c05c4ba3ee409dfa929fe3d1b36b0cdd343711 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 20 Mar 2024 13:23:55 -0500 Subject: [PATCH] publicTimelineController: support remote timelines --- src/controllers/api/timelines.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/controllers/api/timelines.ts b/src/controllers/api/timelines.ts index ebea935..9a209f5 100644 --- a/src/controllers/api/timelines.ts +++ b/src/controllers/api/timelines.ts @@ -18,17 +18,19 @@ const homeTimelineController: AppController = async (c) => { const publicQuerySchema = z.object({ local: booleanParamSchema.catch(false), + instance: z.string().optional().catch(undefined), }); const publicTimelineController: AppController = (c) => { const params = paginationSchema.parse(c.req.query()); - const { local } = publicQuerySchema.parse(c.req.query()); - const { host } = Conf.url; + const { local, instance } = publicQuerySchema.parse(c.req.query()); const filter: NostrFilter = { kinds: [1], ...params }; if (local) { - filter.search = `domain:${host}`; + filter.search = `domain:${Conf.url.host}`; + } else if (instance) { + filter.search = `domain:${instance}`; } return renderStatuses(c, [filter]);