publicTimelineController: support remote timelines
This commit is contained in:
parent
f2db6c50b8
commit
b4c05c4ba3
|
@ -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]);
|
||||||
|
|
Loading…
Reference in New Issue