improve relay auth
Some checks failed
Rust / build (ubuntu-latest, stable) (push) Failing after 1m46s
Rust / build (ubuntu-latest, stable) (pull_request) Failing after 1m28s

This commit is contained in:
2026-02-09 15:11:37 +07:00
parent 6cce0d8bea
commit a9d2a0a24b
6 changed files with 142 additions and 120 deletions

View File

@@ -10,7 +10,7 @@ pub const COOP_PUBKEY: &str = "npub126kl5fruqan90py77gf6pvfvygefl2mu2ukew6xdx5pc
pub const APP_ID: &str = "su.reya.coop";
/// Keyring name
pub const KEYRING: &str = "Coop Secret Storage";
pub const KEYRING: &str = "Coop Safe Storage";
/// Default timeout for subscription
pub const TIMEOUT: u64 = 3;
@@ -37,7 +37,7 @@ pub const USER_GIFTWRAP: &str = "user-gift-wraps";
pub const WOT_RELAYS: [&str; 1] = ["wss://relay.vertexlab.io"];
/// Default search relays
pub const SEARCH_RELAYS: [&str; 2] = ["wss://antiprimal.net", "wss://search.nos.today"];
pub const SEARCH_RELAYS: [&str; 2] = ["wss://antiprimal.net", "wss://relay.noswhere.com"];
/// Default bootstrap relays
pub const BOOTSTRAP_RELAYS: [&str; 4] = [

View File

@@ -164,11 +164,6 @@ impl NostrRegistry {
client.add_relay(url).await?;
}
// Add wot relay to the relay pool
for url in WOT_RELAYS.into_iter() {
client.add_relay(url).await?;
}
// Connect to all added relays
client.connect().await;
@@ -261,14 +256,21 @@ impl NostrRegistry {
.author(public_key)
.limit(1);
client
let relays: Vec<RelayUrl> = client
.database()
.query(filter)
.await
.ok()
.and_then(|events| events.first_owned())
.map(|event| nip17::extract_owned_relay_list(event).collect())
.unwrap_or_default()
.unwrap_or_default();
for relay in relays.iter() {
client.add_relay(relay).await.ok();
client.connect_relay(relay).await.ok();
}
relays
})
}