Compare commits
No commits in common. "v0.0.2" and "v0.0.1" have entirely different histories.
1 changed files with 4 additions and 13 deletions
|
|
@ -77,10 +77,6 @@ class NostrClientConnection:
|
||||||
resp = event.serialize_response(nostr_filter.subscription_id)
|
resp = event.serialize_response(nostr_filter.subscription_id)
|
||||||
await self._send_msg(resp)
|
await self._send_msg(resp)
|
||||||
return True
|
return True
|
||||||
else:
|
|
||||||
logger.info(
|
|
||||||
f"[NOSTRRELAY CLIENT] ❌ Filter didn't match for event {event.id}"
|
|
||||||
)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def _is_direct_message_for_other(self, event: NostrEvent) -> bool:
|
def _is_direct_message_for_other(self, event: NostrEvent) -> bool:
|
||||||
|
|
@ -102,10 +98,6 @@ class NostrClientConnection:
|
||||||
async def _broadcast_event(self, e: NostrEvent):
|
async def _broadcast_event(self, e: NostrEvent):
|
||||||
if self.broadcast_event:
|
if self.broadcast_event:
|
||||||
await self.broadcast_event(self, e)
|
await self.broadcast_event(self, e)
|
||||||
else:
|
|
||||||
logger.warning(
|
|
||||||
f"[NOSTRRELAY CLIENT] ❌ No broadcast_event callback available for event {e.id}"
|
|
||||||
)
|
|
||||||
|
|
||||||
async def _handle_message(self, data: list) -> list:
|
async def _handle_message(self, data: list) -> list:
|
||||||
if len(data) < 2:
|
if len(data) < 2:
|
||||||
|
|
@ -128,8 +120,6 @@ class NostrClientConnection:
|
||||||
return []
|
return []
|
||||||
subscription_id = data[1]
|
subscription_id = data[1]
|
||||||
# Handle multiple filters in REQ message
|
# Handle multiple filters in REQ message
|
||||||
# First remove existing filters for this subscription_id
|
|
||||||
self._remove_filter(subscription_id)
|
|
||||||
responses = []
|
responses = []
|
||||||
for filter_data in data[2:]:
|
for filter_data in data[2:]:
|
||||||
response = await self._handle_request(
|
response = await self._handle_request(
|
||||||
|
|
@ -303,7 +293,8 @@ class NostrClientConnection:
|
||||||
return [["NOTICE", f"This is a paid relay: '{self.relay_id}'"]]
|
return [["NOTICE", f"This is a paid relay: '{self.relay_id}'"]]
|
||||||
|
|
||||||
nostr_filter.subscription_id = subscription_id
|
nostr_filter.subscription_id = subscription_id
|
||||||
if not self._can_add_filter():
|
self._remove_filter(subscription_id)
|
||||||
|
if self._can_add_filter():
|
||||||
max_filters = self.config.max_client_filters
|
max_filters = self.config.max_client_filters
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
|
|
@ -334,8 +325,8 @@ class NostrClientConnection:
|
||||||
|
|
||||||
def _can_add_filter(self) -> bool:
|
def _can_add_filter(self) -> bool:
|
||||||
return (
|
return (
|
||||||
self.config.max_client_filters == 0
|
self.config.max_client_filters != 0
|
||||||
or len(self.filters) < self.config.max_client_filters
|
and len(self.filters) >= self.config.max_client_filters
|
||||||
)
|
)
|
||||||
|
|
||||||
def _auth_challenge_expired(self):
|
def _auth_challenge_expired(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue