mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 03:19:46 +00:00
Purify event before sending it out to relay
This commit is contained in:
parent
e5e0ddd7aa
commit
9c3307f923
1 changed files with 8 additions and 2 deletions
|
|
@ -143,9 +143,15 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
|||
controllers.set(subId, controller);
|
||||
|
||||
try {
|
||||
for await (const [verb, , ...rest] of relay.req(filters, { limit: 100, timeout: conf.db.timeouts.relay })) {
|
||||
for await (const msg of relay.req(filters, { limit: 100, timeout: conf.db.timeouts.relay })) {
|
||||
if (msg[0] === 'EVENT') {
|
||||
const [, , event] = msg;
|
||||
send(['EVENT', subId, purifyEvent(event)]);
|
||||
} else {
|
||||
const [verb, , ...rest] = msg;
|
||||
send([verb, subId, ...rest] as NostrRelayMsg);
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (e instanceof RelayError) {
|
||||
send(['CLOSED', subId, e.message]);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue