client: remove `publish` function, create statuses through pipeline

This commit is contained in:
Alex Gleason 2023-08-17 20:54:11 -05:00
parent 0158a6979e
commit 719b703e7c
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 2 additions and 15 deletions

View File

@ -38,7 +38,7 @@ function getFilters<K extends number>(filters: Filter<K>[], opts: GetFiltersOpts
Conf.poolRelays,
(event: Event | null) => {
if (event && matchFilters(filters, event)) {
pipeline.handleEvent(event);
pipeline.handleEvent(event).catch(() => {});
results.push({
id: event.id,
kind: event.kind,
@ -72,14 +72,4 @@ function getFilters<K extends number>(filters: Filter<K>[], opts: GetFiltersOpts
});
}
/** Publish an event to the Nostr relay. */
function publish(event: Event, relays = Conf.publishRelays): void {
console.log('Publishing event', event, relays);
try {
getPool().publish(event, relays);
} catch (e) {
console.error(e);
}
}
export { getFilters, publish };
export { getFilters };

View File

@ -1,6 +1,5 @@
import { type AppController } from '@/app.ts';
import { type Filter, findReplyTag, z } from '@/deps.ts';
import { publish } from '@/client.ts';
import * as mixer from '@/mixer.ts';
import * as pipeline from '@/pipeline.ts';
import { getAuthor, getFollows } from '@/queries.ts';
@ -8,7 +7,6 @@ import { jsonMetaContentSchema } from '@/schemas/nostr.ts';
import { signEvent } from '@/sign.ts';
import { toAccount, toStatus } from '@/transformers/nostr-to-mastoapi.ts';
import { buildLinkHeader, eventDateComparator, lookupAccount, nostrNow, paginationSchema, parseBody } from '@/utils.ts';
import pipe from 'https://deno.land/x/ramda@v0.27.2/source/pipe.js';
const createAccountController: AppController = (c) => {
return c.json({ error: 'Please log in with Nostr.' }, 405);

View File

@ -1,5 +1,4 @@
import { type AppController } from '@/app.ts';
import { publish } from '@/client.ts';
import { ISO6391, Kind, z } from '@/deps.ts';
import * as pipeline from '@/pipeline.ts';
import { getAncestors, getDescendants, getEvent } from '@/queries.ts';