publicTimelineController: support remote timelines

This commit is contained in:
Alex Gleason 2024-03-20 13:23:55 -05:00
parent f2db6c50b8
commit b4c05c4ba3
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
1 changed files with 5 additions and 3 deletions

View File

@ -18,17 +18,19 @@ const homeTimelineController: AppController = async (c) => {
const publicQuerySchema = z.object({ const publicQuerySchema = z.object({
local: booleanParamSchema.catch(false), local: booleanParamSchema.catch(false),
instance: z.string().optional().catch(undefined),
}); });
const publicTimelineController: AppController = (c) => { const publicTimelineController: AppController = (c) => {
const params = paginationSchema.parse(c.req.query()); const params = paginationSchema.parse(c.req.query());
const { local } = publicQuerySchema.parse(c.req.query()); const { local, instance } = publicQuerySchema.parse(c.req.query());
const { host } = Conf.url;
const filter: NostrFilter = { kinds: [1], ...params }; const filter: NostrFilter = { kinds: [1], ...params };
if (local) { if (local) {
filter.search = `domain:${host}`; filter.search = `domain:${Conf.url.host}`;
} else if (instance) {
filter.search = `domain:${instance}`;
} }
return renderStatuses(c, [filter]); return renderStatuses(c, [filter]);