From f5f8861bc13098667d32433abba871e72caf8605 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:07:58 +0200 Subject: [PATCH] do a little check on inbox relays to avoid some errors --- nostr_dvm/utils/nostr_utils.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nostr_dvm/utils/nostr_utils.py b/nostr_dvm/utils/nostr_utils.py index 12a24cf..fb9efe9 100644 --- a/nostr_dvm/utils/nostr_utils.py +++ b/nostr_dvm/utils/nostr_utils.py @@ -121,14 +121,11 @@ def get_inbox_relays(event_to_send: Event, client: Client, dvm_config): nip65event = events[0] relays = [] for tag in nip65event.tags(): - if tag.as_vec()[0] == 'r' and len(tag.as_vec()) == 2: + if ((tag.as_vec()[0] == 'r' and len(tag.as_vec()) == 2) + or ((tag.as_vec()[0] == 'r' and len(tag.as_vec()) == 3) and tag.as_vec()[2] == "read")): rtag = tag.as_vec()[1] if rtag.rstrip("/") not in dvm_config.AVOID_PAID_OUTBOX_RELAY_LIST: - relays.append(rtag) - elif tag.as_vec()[0] == 'r' and len(tag.as_vec()) == 3: - if tag.as_vec()[2] == "read": - rtag = tag.as_vec()[1] - if rtag.rstrip("/") not in dvm_config.AVOID_PAID_OUTBOX_RELAY_LIST: + if rtag.startswith("ws") and " " not in rtag: relays.append(rtag) return relays