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,12 +103,13 @@ export class DittoAPIStore implements NRelay {
|
||||||
return relay.req(filters, opts);
|
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 { pool } = this.opts;
|
||||||
const { id, kind } = event;
|
const { id, kind } = event;
|
||||||
|
|
||||||
await this.handleEvent(event, opts);
|
await this.handleEvent(event, opts);
|
||||||
|
|
||||||
|
if (opts?.publish) {
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
await pool.event(purifyEvent(event), opts);
|
await pool.event(purifyEvent(event), opts);
|
||||||
|
|
@ -117,6 +118,7 @@ export class DittoAPIStore implements NRelay {
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Open a firehose to the relay. */
|
/** Open a firehose to the relay. */
|
||||||
private async listen(): Promise<void> {
|
private async listen(): Promise<void> {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ async function createEvent<E extends (DittoEnv & { Variables: { user?: User } })
|
||||||
...t,
|
...t,
|
||||||
});
|
});
|
||||||
|
|
||||||
await relay.event(event, { signal });
|
await relay.event(event, { signal, publish: true });
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,7 +89,8 @@ async function createAdminEvent(t: EventStub, c: AppContext): Promise<NostrEvent
|
||||||
...t,
|
...t,
|
||||||
});
|
});
|
||||||
|
|
||||||
await relay.event(event, { signal });
|
// @ts-ignore `publish` is important for `DittoAPIStore`.
|
||||||
|
await relay.event(event, { signal, publish: true });
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue