mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29: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,8 +143,14 @@ function connectStream(socket: WebSocket, ip: string | undefined, opts: ConnectS
|
||||||
controllers.set(subId, controller);
|
controllers.set(subId, controller);
|
||||||
|
|
||||||
try {
|
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 })) {
|
||||||
send([verb, subId, ...rest] as NostrRelayMsg);
|
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) {
|
} catch (e) {
|
||||||
if (e instanceof RelayError) {
|
if (e instanceof RelayError) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue