feat: pow by default

This commit is contained in:
2024-09-23 17:18:41 +07:00
parent 9152c3e122
commit 3d5085785b
3 changed files with 12 additions and 20 deletions

View File

@@ -24,9 +24,13 @@ pub struct Profile {
#[specta::specta]
pub async fn get_profile(id: Option<String>, state: State<'_, Nostr>) -> Result<String, String> {
let client = &state.client;
let public_key: PublicKey = match id {
Some(user_id) => PublicKey::parse(&user_id).map_err(|e| e.to_string())?,
None => client.signer().await.unwrap().public_key().await.unwrap(),
None => {
let signer = client.signer().await.map_err(|e| e.to_string())?;
signer.public_key().await.map_err(|e| e.to_string())?
}
};
let filter = Filter::new()
@@ -35,10 +39,7 @@ pub async fn get_profile(id: Option<String>, state: State<'_, Nostr>) -> Result<
.limit(1);
match client
.get_events_of(
vec![filter],
EventSource::both(Some(Duration::from_secs(3))),
)
.get_events_of(vec![filter], EventSource::Database)
.await
{
Ok(events) => {