From 719b703e7cb42092e56da8199b59301e42e8d8ba Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Thu, 17 Aug 2023 20:54:11 -0500 Subject: [PATCH] client: remove `publish` function, create statuses through pipeline --- src/client.ts | 14 ++------------ src/controllers/api/accounts.ts | 2 -- src/controllers/api/statuses.ts | 1 - 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/client.ts b/src/client.ts index a99ce8e..e336116 100644 --- a/src/client.ts +++ b/src/client.ts @@ -38,7 +38,7 @@ function getFilters(filters: Filter[], 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(filters: Filter[], 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 }; diff --git a/src/controllers/api/accounts.ts b/src/controllers/api/accounts.ts index 96b3ac2..da464ef 100644 --- a/src/controllers/api/accounts.ts +++ b/src/controllers/api/accounts.ts @@ -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); diff --git a/src/controllers/api/statuses.ts b/src/controllers/api/statuses.ts index 2a78f22..aae7f6c 100644 --- a/src/controllers/api/statuses.ts +++ b/src/controllers/api/statuses.ts @@ -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';