Compare commits

..

No commits in common. "main" and "v0.0.1" have entirely different histories.
main ... v0.0.1

2 changed files with 4 additions and 16 deletions

View file

@ -77,10 +77,6 @@ class NostrClientConnection:
resp = event.serialize_response(nostr_filter.subscription_id)
await self._send_msg(resp)
return True
else:
logger.info(
f"[NOSTRRELAY CLIENT] ❌ Filter didn't match for event {event.id}"
)
return False
def _is_direct_message_for_other(self, event: NostrEvent) -> bool:
@ -102,10 +98,6 @@ class NostrClientConnection:
async def _broadcast_event(self, e: NostrEvent):
if self.broadcast_event:
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:
if len(data) < 2:
@ -121,8 +113,6 @@ class NostrClientConnection:
}
event = NostrEvent(**event_dict)
# Set the size field from the size_bytes property
event.size = event.size_bytes
await self._handle_event(event)
return []
if message_type == NostrEventType.REQ:
@ -130,8 +120,6 @@ class NostrClientConnection:
return []
subscription_id = data[1]
# Handle multiple filters in REQ message
# First remove existing filters for this subscription_id
self._remove_filter(subscription_id)
responses = []
for filter_data in data[2:]:
response = await self._handle_request(
@ -305,7 +293,8 @@ class NostrClientConnection:
return [["NOTICE", f"This is a paid relay: '{self.relay_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
return [
[
@ -336,8 +325,8 @@ class NostrClientConnection:
def _can_add_filter(self) -> bool:
return (
self.config.max_client_filters == 0
or len(self.filters) < self.config.max_client_filters
self.config.max_client_filters != 0
and len(self.filters) >= self.config.max_client_filters
)
def _auth_challenge_expired(self):

View file

@ -23,7 +23,6 @@ class NostrEvent(BaseModel):
tags: list[list[str]] = Field(default=[], no_database=True)
content: str = ""
sig: str
size: int = 0
def nostr_dict(self) -> dict:
_nostr_dict = dict(self)