Removed DittoFilter usages I missed earlier

This commit is contained in:
Alex Gleason 2024-03-20 12:01:38 -05:00
parent dcd0728b19
commit b2bc46ac57
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,6 @@
import { NostrFilter } from '@soapbox/nspec';
import { AppController } from '@/app.ts';
import { nip19, type NostrEvent, z } from '@/deps.ts';
import { type NostrFilter } from '@/interfaces/DittoFilter.ts';
import { booleanParamSchema } from '@/schema.ts';
import { nostrIdSchema } from '@/schemas/nostr.ts';
import { searchStore } from '@/storages.ts';

View File

@ -1,6 +1,7 @@
import { NostrFilter } from '@soapbox/nspec';
import { type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { Debug, z } from '@/deps.ts';
import { NostrFilter } from '@/interfaces/DittoFilter.ts';
import { getAuthor, getFeedPubkeys } from '@/queries.ts';
import { Sub } from '@/subs.ts';
import { bech32ToPubkey } from '@/utils.ts';
@ -83,16 +84,18 @@ async function topicToFilter(
query: Record<string, string>,
pubkey: string | undefined,
): Promise<NostrFilter | undefined> {
const { host } = Conf.url;
switch (topic) {
case 'public':
return { kinds: [1] };
case 'public:local':
return { kinds: [1], local: true };
return { kinds: [1], search: `domain:${host}` };
case 'hashtag':
if (query.tag) return { kinds: [1], '#t': [query.tag] };
break;
case 'hashtag:local':
if (query.tag) return { kinds: [1], '#t': [query.tag], local: true };
if (query.tag) return { kinds: [1], '#t': [query.tag], search: `domain:${host}` };
break;
case 'user':
// HACK: this puts the user's entire contacts list into RAM,

View File

@ -1,6 +1,7 @@
import { NostrFilter } from '@soapbox/nspec';
import { type AppContext, type AppController } from '@/app.ts';
import { Conf } from '@/config.ts';
import { z } from '@/deps.ts';
import { type NostrFilter } from '@/interfaces/DittoFilter.ts';
import { getFeedPubkeys } from '@/queries.ts';
import { booleanParamSchema } from '@/schema.ts';
import { eventsDB } from '@/storages.ts';
@ -22,7 +23,15 @@ const publicQuerySchema = z.object({
const publicTimelineController: AppController = (c) => {
const params = paginationSchema.parse(c.req.query());
const { local } = publicQuerySchema.parse(c.req.query());
return renderStatuses(c, [{ kinds: [1], local, ...params }]);
const { host } = Conf.url;
const filter: NostrFilter = { kinds: [1], ...params };
if (local) {
filter.search = `domain:${host}`;
}
return renderStatuses(c, [filter]);
};
const hashtagTimelineController: AppController = (c) => {