mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-19 19:46:50 +00:00
Tweak NIP-35 follow support to work even if relays missing
This commit is contained in:
parent
5653bb781a
commit
03611e7323
@ -438,15 +438,21 @@ impl Overlord {
|
|||||||
None => return Err(Error::Nip05NotFound),
|
None => return Err(Error::Nip05NotFound),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Save person
|
||||||
|
DbPerson::upsert_valid_nip05(
|
||||||
|
(*pubkey).into(),
|
||||||
|
dns_id.clone(),
|
||||||
|
Unixtime::now().unwrap().0 as u64,
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
info!("Followed {}", &dns_id);
|
||||||
|
|
||||||
let relays = match nip05.relays.get(pubkey) {
|
let relays = match nip05.relays.get(pubkey) {
|
||||||
Some(relays) => relays,
|
Some(relays) => relays,
|
||||||
None => return Err(Error::Nip35NotFound),
|
None => return Err(Error::Nip35NotFound),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Save person
|
|
||||||
DbPerson::upsert_valid_nip05((*pubkey).into(), dns_id, Unixtime::now().unwrap().0 as u64)
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
for relay in relays.iter() {
|
for relay in relays.iter() {
|
||||||
// Save relay
|
// Save relay
|
||||||
let db_relay = DbRelay::new(relay.to_string())?;
|
let db_relay = DbRelay::new(relay.to_string())?;
|
||||||
@ -460,7 +466,7 @@ impl Overlord {
|
|||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
|
|
||||||
info!("Followed {}@{} at {} relays", user, domain, relays.len());
|
info!("Setup {} relays for {}", relays.len(), &dns_id);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user