chore: update deps
This commit is contained in:
Generated
+466
-634
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ publish = false
|
|||||||
atomic-destructor = "0.2"
|
atomic-destructor = "0.2"
|
||||||
event-listener = "5"
|
event-listener = "5"
|
||||||
nostr.workspace = true
|
nostr.workspace = true
|
||||||
opaquerr = "0.1"
|
opaquerr = { version = "0.1", features = ["alloc"] }
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
smol.workspace = true
|
smol.workspace = true
|
||||||
|
|||||||
+19
-6
@@ -365,7 +365,8 @@ impl ChatRegistry {
|
|||||||
.query(filter)
|
.query(filter)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.first_owned()
|
.into_iter()
|
||||||
|
.next()
|
||||||
.is_some();
|
.is_some();
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
@@ -397,7 +398,8 @@ impl ChatRegistry {
|
|||||||
.database()
|
.database()
|
||||||
.query(filter)
|
.query(filter)
|
||||||
.await?
|
.await?
|
||||||
.first_owned()
|
.into_iter()
|
||||||
|
.next()
|
||||||
.ok_or(anyhow::anyhow!("No inbox relays found"))?;
|
.ok_or(anyhow::anyhow!("No inbox relays found"))?;
|
||||||
|
|
||||||
let relays: Vec<RelayUrl> = nip17::extract_relay_list(&event).collect();
|
let relays: Vec<RelayUrl> = nip17::extract_relay_list(&event).collect();
|
||||||
@@ -656,15 +658,26 @@ impl ChatRegistry {
|
|||||||
|
|
||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
let public_key = signer.get_public_key_async().await?;
|
let public_key = signer.get_public_key_async().await?;
|
||||||
let contacts = client
|
|
||||||
|
// Query the latest contact list (previously `NostrDatabaseExt::contacts_public_keys`)
|
||||||
|
let filter = Filter::new()
|
||||||
|
.author(public_key)
|
||||||
|
.kind(Kind::ContactList)
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
let contacts: HashSet<PublicKey> = client
|
||||||
.database()
|
.database()
|
||||||
.contacts_public_keys(public_key)
|
.query(filter)
|
||||||
.await
|
.await
|
||||||
|
.unwrap_or_default()
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.map(|event| event.tags.public_keys().collect())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
|
|
||||||
let filter = Filter::new()
|
let filter = Filter::new()
|
||||||
.kind(Kind::ApplicationSpecificData)
|
.kind(Kind::ApplicationSpecificData)
|
||||||
.custom_tag(SingleLetterTag::lowercase(Alphabet::K), "14");
|
.custom_tag(SingleLetterTag::LOWERCASE_K, "14");
|
||||||
|
|
||||||
let events = client.database().query(filter).await?;
|
let events = client.database().query(filter).await?;
|
||||||
let mut grouped: HashMap<u64, Vec<UnsignedEvent>> = HashMap::new();
|
let mut grouped: HashMap<u64, Vec<UnsignedEvent>> = HashMap::new();
|
||||||
@@ -827,7 +840,7 @@ async fn set_rumor(client: &Client, id: EventId, rumor: &UnsignedEvent) -> Resul
|
|||||||
async fn get_rumor(client: &Client, gift_wrap: EventId) -> Result<UnsignedEvent, Error> {
|
async fn get_rumor(client: &Client, gift_wrap: EventId) -> Result<UnsignedEvent, Error> {
|
||||||
let filter = Filter::new().identifier(gift_wrap).limit(1);
|
let filter = Filter::new().identifier(gift_wrap).limit(1);
|
||||||
|
|
||||||
if let Some(event) = client.database().query(filter).await?.first_owned() {
|
if let Some(event) = client.database().query(filter).await?.into_iter().next() {
|
||||||
UnsignedEvent::from_json(event.content).map_err(|e| anyhow!(e))
|
UnsignedEvent::from_json(event.content).map_err(|e| anyhow!(e))
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!("Event is not cached yet."))
|
Err(anyhow!("Event is not cached yet."))
|
||||||
|
|||||||
@@ -403,7 +403,7 @@ impl Room {
|
|||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
let filter = Filter::new()
|
let filter = Filter::new()
|
||||||
.kind(Kind::ApplicationSpecificData)
|
.kind(Kind::ApplicationSpecificData)
|
||||||
.custom_tag(SingleLetterTag::lowercase(Alphabet::R), room_id);
|
.custom_tag(SingleLetterTag::LOWERCASE_R, room_id);
|
||||||
|
|
||||||
let messages = client
|
let messages = client
|
||||||
.database()
|
.database()
|
||||||
@@ -461,13 +461,10 @@ impl Room {
|
|||||||
// Add all receiver tags (no intermediate allocation)
|
// Add all receiver tags (no intermediate allocation)
|
||||||
for public_key in self.members.iter().filter(|pk| *pk != &sender) {
|
for public_key in self.members.iter().filter(|pk| *pk != &sender) {
|
||||||
let member = persons.read(cx).get(public_key, cx);
|
let member = persons.read(cx).get(public_key, cx);
|
||||||
tags.push(
|
tags.push(Tag::from(Nip01Tag::PublicKey {
|
||||||
Nip01Tag::PublicKey {
|
public_key: member.public_key(),
|
||||||
public_key: member.public_key(),
|
relay_hint: member.messaging_relay_hint(),
|
||||||
relay_hint: member.messaging_relay_hint(),
|
}));
|
||||||
}
|
|
||||||
.to_tag(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a direct message rumor event
|
// Construct a direct message rumor event
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ use std::path::PathBuf;
|
|||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use instant::Duration;
|
|
||||||
|
|
||||||
use anyhow::{Context as AnyhowContext, Error, anyhow};
|
use anyhow::{Context as AnyhowContext, Error, anyhow};
|
||||||
use gpui::{
|
use gpui::{
|
||||||
App, AppContext, Context, Entity, EventEmitter, Global, IntoElement, ParentElement,
|
App, AppContext, Context, Entity, EventEmitter, Global, IntoElement, ParentElement,
|
||||||
SharedString, Styled, Subscription, Task, Window, div, relative,
|
SharedString, Styled, Subscription, Task, Window, div, relative,
|
||||||
};
|
};
|
||||||
|
use instant::Duration;
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use person::PersonRegistry;
|
use person::PersonRegistry;
|
||||||
use settings::AppSettings;
|
use settings::AppSettings;
|
||||||
@@ -414,7 +414,7 @@ impl DeviceRegistry {
|
|||||||
.pubkey(app_pubkey)
|
.pubkey(app_pubkey)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
match client.database().query(filter).await?.first_owned() {
|
match client.database().query(filter).await?.into_iter().next() {
|
||||||
// Found an approval event
|
// Found an approval event
|
||||||
Some(event) => Ok(Some(event)),
|
Some(event) => Ok(Some(event)),
|
||||||
// No approval event found, construct a request event
|
// No approval event found, construct a request event
|
||||||
|
|||||||
@@ -84,8 +84,20 @@ impl Screening {
|
|||||||
|
|
||||||
let task: Task<Result<bool, Error>> = cx.background_spawn(async move {
|
let task: Task<Result<bool, Error>> = cx.background_spawn(async move {
|
||||||
// Check if user is in contact list
|
// Check if user is in contact list
|
||||||
let contacts = client.database().contacts_public_keys(current_user).await;
|
let filter = Filter::new()
|
||||||
let followed = contacts.unwrap_or_default().contains(&public_key);
|
.author(current_user)
|
||||||
|
.kind(Kind::ContactList)
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
let followed = client
|
||||||
|
.database()
|
||||||
|
.query(filter)
|
||||||
|
.await
|
||||||
|
.unwrap_or_default()
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.map(|event| event.tags.public_keys().any(|k| k == public_key))
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
Ok(followed)
|
Ok(followed)
|
||||||
});
|
});
|
||||||
@@ -228,11 +240,10 @@ impl Screening {
|
|||||||
let public_key = self.public_key;
|
let public_key = self.public_key;
|
||||||
|
|
||||||
let task: Task<Result<(), Error>> = cx.background_spawn(async move {
|
let task: Task<Result<(), Error>> = cx.background_spawn(async move {
|
||||||
let tag = Nip56Tag::PublicKey {
|
let tag = Tag::from(Nip56Tag::PublicKey {
|
||||||
public_key,
|
public_key,
|
||||||
report: Report::Impersonation,
|
report: Report::Impersonation,
|
||||||
}
|
});
|
||||||
.to_tag();
|
|
||||||
|
|
||||||
let event = EventBuilder::new(Kind::Reporting, "")
|
let event = EventBuilder::new(Kind::Reporting, "")
|
||||||
.tag(tag)
|
.tag(tag)
|
||||||
|
|||||||
@@ -88,7 +88,20 @@ impl ContactListPanel {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let task: Task<Result<HashSet<PublicKey>, Error>> = cx.background_spawn(async move {
|
let task: Task<Result<HashSet<PublicKey>, Error>> = cx.background_spawn(async move {
|
||||||
let contact_list = client.database().contacts_public_keys(public_key).await?;
|
let filter = Filter::new()
|
||||||
|
.author(public_key)
|
||||||
|
.kind(Kind::ContactList)
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
let contact_list: HashSet<PublicKey> = client
|
||||||
|
.database()
|
||||||
|
.query(filter)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.map(|event| event.tags.public_keys().collect())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
Ok(contact_list)
|
Ok(contact_list)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ impl MessagingRelayPanel {
|
|||||||
.author(public_key)
|
.author(public_key)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
if let Some(event) = client.database().query(filter).await?.first_owned() {
|
if let Some(event) = client.database().query(filter).await?.into_iter().next() {
|
||||||
Ok(nip17::extract_relay_list(&event).collect())
|
Ok(nip17::extract_relay_list(&event).collect())
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!("Not found."))
|
Err(anyhow!("Not found."))
|
||||||
@@ -177,7 +177,7 @@ impl MessagingRelayPanel {
|
|||||||
let tags: Vec<Tag> = self
|
let tags: Vec<Tag> = self
|
||||||
.relays
|
.relays
|
||||||
.iter()
|
.iter()
|
||||||
.map(|relay| Nip17Tag::Relay(relay.to_owned()).to_tag())
|
.map(|relay| Tag::from(Nip17Tag::Relay(relay.to_owned())))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Set updating state
|
// Set updating state
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ impl RelayListPanel {
|
|||||||
.author(public_key)
|
.author(public_key)
|
||||||
.limit(1);
|
.limit(1);
|
||||||
|
|
||||||
if let Some(event) = client.database().query(filter).await?.first_owned() {
|
if let Some(event) = client.database().query(filter).await?.into_iter().next() {
|
||||||
Ok(nip65::extract_relay_list(&event).collect())
|
Ok(nip65::extract_relay_list(&event).collect())
|
||||||
} else {
|
} else {
|
||||||
Err(anyhow!("Not found."))
|
Err(anyhow!("Not found."))
|
||||||
|
|||||||
@@ -158,7 +158,20 @@ impl Sidebar {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let task: Task<Result<HashSet<PublicKey>, Error>> = cx.background_spawn(async move {
|
let task: Task<Result<HashSet<PublicKey>, Error>> = cx.background_spawn(async move {
|
||||||
let contacts = client.database().contacts_public_keys(public_key).await?;
|
let filter = Filter::new()
|
||||||
|
.author(public_key)
|
||||||
|
.kind(Kind::ContactList)
|
||||||
|
.limit(1);
|
||||||
|
|
||||||
|
let contacts: HashSet<PublicKey> = client
|
||||||
|
.database()
|
||||||
|
.query(filter)
|
||||||
|
.await?
|
||||||
|
.into_iter()
|
||||||
|
.next()
|
||||||
|
.map(|event| event.tags.public_keys().collect())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
Ok(contacts)
|
Ok(contacts)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user