mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-08 16:28:49 +00:00
automatically run received events through the filters they should pass (double-check the work made by the relay).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nostr-tools",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.1",
|
||||
"description": "Tools for making a Nostr client.",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
||||
11
relay.js
11
relay.js
@@ -1,6 +1,7 @@
|
||||
import 'websocket-polyfill'
|
||||
|
||||
import {verifySignature} from './event'
|
||||
import {matchFilters} from './filter'
|
||||
|
||||
export function normalizeRelayURL(url) {
|
||||
let [host, ...qs] = url.split('?')
|
||||
@@ -88,10 +89,12 @@ export function relayConnect(url, onNotice) {
|
||||
let channel = data[1]
|
||||
let event = data[2]
|
||||
|
||||
if (await verifySignature(event)) {
|
||||
if (channels[channel]) {
|
||||
channels[channel](event)
|
||||
}
|
||||
if (
|
||||
(await verifySignature(event)) &&
|
||||
channels[channel] &&
|
||||
matchFilters(openSubs[channel], event)
|
||||
) {
|
||||
channels[channel](event)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user