mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
Hotfix for relay publishing
This commit is contained in:
parent
e88a7d01d4
commit
77c0ac3561
2 changed files with 13 additions and 10 deletions
|
|
@ -103,19 +103,21 @@ export class DittoAPIStore implements NRelay {
|
|||
return relay.req(filters, opts);
|
||||
}
|
||||
|
||||
async event(event: NostrEvent, opts?: { signal?: AbortSignal }): Promise<void> {
|
||||
async event(event: NostrEvent, opts?: { publish?: boolean; signal?: AbortSignal }): Promise<void> {
|
||||
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. */
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ async function createEvent<E extends (DittoEnv & { Variables: { user?: User } })
|
|||
...t,
|
||||
});
|
||||
|
||||
await relay.event(event, { signal });
|
||||
await relay.event(event, { signal, publish: true });
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
@ -89,7 +89,8 @@ async function createAdminEvent(t: EventStub, c: AppContext): Promise<NostrEvent
|
|||
...t,
|
||||
});
|
||||
|
||||
await relay.event(event, { signal });
|
||||
// @ts-ignore `publish` is important for `DittoAPIStore`.
|
||||
await relay.event(event, { signal, publish: true });
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue