WIP Render nostr profile and relay status with Ruby
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-10-18 15:01:08 +02:00
parent 5283f6fce7
commit 04a9061663
14 changed files with 168 additions and 126 deletions

View File

@@ -1,10 +1,10 @@
module NostrManager
class DiscoverUserProfile < NostrManagerService
MAX_EVENTS = 3
MAX_EVENTS = 2
def initialize(pubkey:)
def initialize(pubkey:, relays: nil)
@pubkey = pubkey
@relays = Setting.nostr_discovery_relays
@relays = relays.present? ? relays : Setting.nostr_discovery_relays
end
def call
@@ -30,9 +30,7 @@ module NostrManager
end
end
latest_event = profile_events.min_by { |e| e["created_at"] }
puts latest_event.inspect
profile_events.min_by { |e| e["created_at"] }
end
end
end

View File

@@ -1,6 +1,6 @@
module NostrManager
class DiscoverUserRelays < NostrManagerService
MAX_EVENTS = 3
MAX_EVENTS = 2
def initialize(pubkey:)
@pubkey = pubkey
@@ -31,11 +31,7 @@ module NostrManager
end
end
latest_event = nip65_events.min_by { |e| e["created_at"] }
tags = latest_event["tags"]
# puts latest_event.inspect
puts tags.select{ |t| t[0] == "r" }.inspect
nip65_events.min_by { |e| e["created_at"] }
end
end
end