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