Recommended relay view

Changelog-Changed: Show recommended relays in config. Currently just a fixed set.
This commit is contained in:
William Casarin
2022-12-29 16:08:00 -08:00
parent 3824e95f29
commit 14a3a352d6
7 changed files with 101 additions and 46 deletions

View File

@@ -623,26 +623,3 @@ func load_our_relays(contacts: Contacts, our_pubkey: String, pool: RelayPool, m_
}
func remove_bootstrap_nodes(_ damus_state: DamusState) {
guard let contacts = damus_state.contacts.event else {
return
}
guard let relays = decode_json_relays(contacts.content) else {
return
}
let descriptors = relays.reduce(into: []) { arr, kv in
guard let url = URL(string: kv.key) else {
return
}
arr.append(RelayDescriptor(url: url, info: kv.value))
}
for relay in BOOTSTRAP_RELAYS {
if !(descriptors.contains { ($0 as! RelayDescriptor).url.absoluteString == relay }) {
damus_state.pool.remove_relay(relay)
}
}
}