Hotfix for relay publishing

This commit is contained in:
Alex Gleason 2025-02-23 14:55:19 -06:00
parent e88a7d01d4
commit 77c0ac3561
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 13 additions and 10 deletions

View file

@ -103,12 +103,13 @@ 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);
if (opts?.publish) {
(async () => {
try {
await pool.event(purifyEvent(event), opts);
@ -117,6 +118,7 @@ export class DittoAPIStore implements NRelay {
}
})();
}
}
/** Open a firehose to the relay. */
private async listen(): Promise<void> {

View file

@ -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;
}