feat: check account for REQ
This commit is contained in:
parent
dc50d3493d
commit
ccf620d476
1 changed files with 16 additions and 0 deletions
|
|
@ -8,8 +8,10 @@ from loguru import logger
|
||||||
from lnbits.helpers import urlsafe_short_hash
|
from lnbits.helpers import urlsafe_short_hash
|
||||||
|
|
||||||
from ..crud import (
|
from ..crud import (
|
||||||
|
NostrAccount,
|
||||||
create_event,
|
create_event,
|
||||||
delete_events,
|
delete_events,
|
||||||
|
get_account,
|
||||||
get_event,
|
get_event,
|
||||||
get_events,
|
get_events,
|
||||||
mark_events_deleted,
|
mark_events_deleted,
|
||||||
|
|
@ -189,6 +191,20 @@ class NostrClientConnection:
|
||||||
if self.config.require_auth_filter:
|
if self.config.require_auth_filter:
|
||||||
if not self.auth_pubkey:
|
if not self.auth_pubkey:
|
||||||
return [["AUTH", self._current_auth_challenge()]]
|
return [["AUTH", self._current_auth_challenge()]]
|
||||||
|
account = await get_account(self.relay_id, self.auth_pubkey)
|
||||||
|
if not account:
|
||||||
|
account = NostrAccount.null_account()
|
||||||
|
|
||||||
|
if account.blocked:
|
||||||
|
return [
|
||||||
|
[
|
||||||
|
"NOTICE",
|
||||||
|
f"Public key '{self.auth_pubkey}' is not allowed in relay '{self.relay_id}'!",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
||||||
|
if not account.can_join and not self.config.is_free_to_join:
|
||||||
|
return [["NOTICE", f"This is a paid relay: '{self.relay_id}'"]]
|
||||||
|
|
||||||
filter.subscription_id = subscription_id
|
filter.subscription_id = subscription_id
|
||||||
self._remove_filter(subscription_id)
|
self._remove_filter(subscription_id)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue