From 77c0ac3561ef20b2d01f67499be9cbd846ded965 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Sun, 23 Feb 2025 14:55:19 -0600 Subject: [PATCH] Hotfix for relay publishing --- packages/ditto/storages/DittoAPIStore.ts | 18 ++++++++++-------- packages/ditto/utils/api.ts | 5 +++-- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/packages/ditto/storages/DittoAPIStore.ts b/packages/ditto/storages/DittoAPIStore.ts index 9d8a60ae..9a8fc570 100644 --- a/packages/ditto/storages/DittoAPIStore.ts +++ b/packages/ditto/storages/DittoAPIStore.ts @@ -103,19 +103,21 @@ export class DittoAPIStore implements NRelay { return relay.req(filters, opts); } - async event(event: NostrEvent, opts?: { signal?: AbortSignal }): Promise { + async event(event: NostrEvent, opts?: { publish?: boolean; signal?: AbortSignal }): Promise { const { pool } = this.opts; const { id, kind } = event; await this.handleEvent(event, opts); - (async () => { - try { - await pool.event(purifyEvent(event), opts); - } catch (e) { - logi({ level: 'error', ns: this.ns, source: 'publish', id, kind, error: errorJson(e) }); - } - })(); + if (opts?.publish) { + (async () => { + try { + await pool.event(purifyEvent(event), opts); + } catch (e) { + logi({ level: 'error', ns: this.ns, source: 'publish', id, kind, error: errorJson(e) }); + } + })(); + } } /** Open a firehose to the relay. */ diff --git a/packages/ditto/utils/api.ts b/packages/ditto/utils/api.ts index 58740917..b5d4fc3b 100644 --- a/packages/ditto/utils/api.ts +++ b/packages/ditto/utils/api.ts @@ -33,7 +33,7 @@ async function createEvent