use gossip memory instead of sqlite
This commit is contained in:
112
Cargo.lock
generated
112
Cargo.lock
generated
@@ -1949,7 +1949,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2013,18 +2013,6 @@ dependencies = [
|
|||||||
"zune-inflate",
|
"zune-inflate",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fallible-iterator"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fallible-streaming-iterator"
|
|
||||||
version = "0.1.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fastrand"
|
name = "fastrand"
|
||||||
version = "1.9.0"
|
version = "1.9.0"
|
||||||
@@ -3778,17 +3766,6 @@ dependencies = [
|
|||||||
"redox_syscall 0.7.3",
|
"redox_syscall 0.7.3",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libsqlite3-sys"
|
|
||||||
version = "0.36.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "95b4103cffefa72eb8428cb6b47d6627161e51c2739fc5e3b734584157bc642a"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linebender_resource_handle"
|
name = "linebender_resource_handle"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
@@ -4274,7 +4251,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr"
|
name = "nostr"
|
||||||
version = "0.44.1"
|
version = "0.44.1"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aes",
|
"aes",
|
||||||
"base64",
|
"base64",
|
||||||
@@ -4298,7 +4275,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-blossom"
|
name = "nostr-blossom"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"nostr",
|
"nostr",
|
||||||
@@ -4309,7 +4286,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-connect"
|
name = "nostr-connect"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -4322,7 +4299,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-database"
|
name = "nostr-database"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"btreecap",
|
"btreecap",
|
||||||
"flatbuffers",
|
"flatbuffers",
|
||||||
@@ -4332,27 +4309,27 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-gossip"
|
name = "nostr-gossip"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"nostr",
|
"nostr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-gossip-sqlite"
|
name = "nostr-gossip-memory"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-utility",
|
"indexmap",
|
||||||
|
"lru",
|
||||||
"nostr",
|
"nostr",
|
||||||
"nostr-gossip",
|
"nostr-gossip",
|
||||||
"rusqlite",
|
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-lmdb"
|
name = "nostr-lmdb"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"flume 0.12.0",
|
"flume 0.12.0",
|
||||||
@@ -4366,7 +4343,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-memory"
|
name = "nostr-memory"
|
||||||
version = "0.44.0"
|
version = "0.44.0"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"btreecap",
|
"btreecap",
|
||||||
"nostr",
|
"nostr",
|
||||||
@@ -4377,7 +4354,7 @@ dependencies = [
|
|||||||
[[package]]
|
[[package]]
|
||||||
name = "nostr-sdk"
|
name = "nostr-sdk"
|
||||||
version = "0.44.1"
|
version = "0.44.1"
|
||||||
source = "git+https://github.com/rust-nostr/nostr#493b230aa7308fba416989ae63625da4132cf496"
|
source = "git+https://github.com/rust-nostr/nostr#fb0ee1d9366b05c553a0af48d813a38a7df3eb53"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-utility",
|
"async-utility",
|
||||||
"async-wsocket",
|
"async-wsocket",
|
||||||
@@ -4409,7 +4386,7 @@ version = "0.50.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5271,7 +5248,7 @@ dependencies = [
|
|||||||
"once_cell",
|
"once_cell",
|
||||||
"socket2",
|
"socket2",
|
||||||
"tracing",
|
"tracing",
|
||||||
"windows-sys 0.60.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -5696,30 +5673,6 @@ version = "0.20.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
|
checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rsqlite-vfs"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a8a1f2315036ef6b1fbacd1972e8ee7688030b0a2121edfc2a6550febd41574d"
|
|
||||||
dependencies = [
|
|
||||||
"hashbrown 0.16.1",
|
|
||||||
"thiserror 2.0.18",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rusqlite"
|
|
||||||
version = "0.38.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f1c93dd1c9683b438c392c492109cb702b8090b2bfc8fed6f6e4eb4523f17af3"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 2.11.0",
|
|
||||||
"fallible-iterator",
|
|
||||||
"fallible-streaming-iterator",
|
|
||||||
"libsqlite3-sys",
|
|
||||||
"smallvec",
|
|
||||||
"sqlite-wasm-rs",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rust-embed"
|
name = "rust-embed"
|
||||||
version = "8.11.0"
|
version = "8.11.0"
|
||||||
@@ -5815,7 +5768,7 @@ dependencies = [
|
|||||||
"errno",
|
"errno",
|
||||||
"libc",
|
"libc",
|
||||||
"linux-raw-sys 0.12.1",
|
"linux-raw-sys 0.12.1",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -6458,18 +6411,6 @@ dependencies = [
|
|||||||
"bitflags 2.11.0",
|
"bitflags 2.11.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sqlite-wasm-rs"
|
|
||||||
version = "0.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2f4206ed3a67690b9c29b77d728f6acc3ce78f16bf846d83c94f76400320181b"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"js-sys",
|
|
||||||
"rsqlite-vfs",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "stable_deref_trait"
|
name = "stable_deref_trait"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@@ -6524,7 +6465,7 @@ dependencies = [
|
|||||||
"nostr",
|
"nostr",
|
||||||
"nostr-blossom",
|
"nostr-blossom",
|
||||||
"nostr-connect",
|
"nostr-connect",
|
||||||
"nostr-gossip-sqlite",
|
"nostr-gossip-memory",
|
||||||
"nostr-lmdb",
|
"nostr-lmdb",
|
||||||
"nostr-memory",
|
"nostr-memory",
|
||||||
"nostr-sdk",
|
"nostr-sdk",
|
||||||
@@ -6826,7 +6767,7 @@ dependencies = [
|
|||||||
"getrandom 0.4.2",
|
"getrandom 0.4.2",
|
||||||
"once_cell",
|
"once_cell",
|
||||||
"rustix 1.1.4",
|
"rustix 1.1.4",
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.59.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -7662,12 +7603,6 @@ dependencies = [
|
|||||||
"sval_serde",
|
"sval_serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "vcpkg"
|
|
||||||
version = "0.2.15"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.9.5"
|
version = "0.9.5"
|
||||||
@@ -8231,7 +8166,7 @@ version = "0.1.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows-sys 0.61.2",
|
"windows-sys 0.48.0",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -8554,15 +8489,6 @@ dependencies = [
|
|||||||
"windows-targets 0.52.6",
|
"windows-targets 0.52.6",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "windows-sys"
|
|
||||||
version = "0.60.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"
|
|
||||||
dependencies = [
|
|
||||||
"windows-targets 0.53.5",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-sys"
|
name = "windows-sys"
|
||||||
version = "0.61.2"
|
version = "0.61.2"
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
|
|||||||
nostr-memory = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-memory = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr-blossom = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-blossom = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr-gossip-sqlite = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr-sdk = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-sdk = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip96", "nip59", "nip49", "nip44" ] }
|
nostr = { git = "https://github.com/rust-nostr/nostr", features = [ "nip96", "nip59", "nip49", "nip44" ] }
|
||||||
|
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use state::{NostrRegistry, TIMEOUT};
|
|||||||
|
|
||||||
use crate::NewMessage;
|
use crate::NewMessage;
|
||||||
|
|
||||||
|
const NO_RELAY: &str = "User hasn't set up any messaging relays yet.";
|
||||||
const NO_DEKEY: &str = "User hasn't set up a decoupled encryption key yet.";
|
const NO_DEKEY: &str = "User hasn't set up a decoupled encryption key yet.";
|
||||||
const USER_NO_DEKEY: &str = "You haven't set up a decoupled encryption key or it's not available.";
|
const USER_NO_DEKEY: &str = "You haven't set up a decoupled encryption key or it's not available.";
|
||||||
|
|
||||||
@@ -354,17 +355,7 @@ impl Room {
|
|||||||
pub fn connect(&self, cx: &App) -> Task<Result<(), Error>> {
|
pub fn connect(&self, cx: &App) -> Task<Result<(), Error>> {
|
||||||
let nostr = NostrRegistry::global(cx);
|
let nostr = NostrRegistry::global(cx);
|
||||||
let client = nostr.read(cx).client();
|
let client = nostr.read(cx).client();
|
||||||
|
let members = self.members();
|
||||||
let signer = nostr.read(cx).signer();
|
|
||||||
let sender = signer.public_key();
|
|
||||||
|
|
||||||
// Get all members, excluding the sender
|
|
||||||
let members: Vec<PublicKey> = self
|
|
||||||
.members
|
|
||||||
.iter()
|
|
||||||
.filter(|public_key| Some(**public_key) != sender)
|
|
||||||
.copied()
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
let opts = SubscribeAutoCloseOptions::default()
|
let opts = SubscribeAutoCloseOptions::default()
|
||||||
@@ -510,9 +501,16 @@ impl Room {
|
|||||||
|
|
||||||
// Process each member
|
// Process each member
|
||||||
for member in members {
|
for member in members {
|
||||||
|
let relays = member.messaging_relays();
|
||||||
let announcement = member.announcement();
|
let announcement = member.announcement();
|
||||||
let public_key = member.public_key();
|
let public_key = member.public_key();
|
||||||
|
|
||||||
|
// Skip members with no relays
|
||||||
|
if relays.is_empty() {
|
||||||
|
reports.push(SendReport::new(public_key).error(NO_RELAY));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Handle encryption signer requirements
|
// Handle encryption signer requirements
|
||||||
if signer_kind.encryption() {
|
if signer_kind.encryption() {
|
||||||
if announcement.is_none() {
|
if announcement.is_none() {
|
||||||
@@ -548,7 +546,8 @@ impl Room {
|
|||||||
SignerKind::User => (member.public_key(), user_signer.clone()),
|
SignerKind::User => (member.public_key(), user_signer.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
match send_gift_wrap(&client, &signer, &receiver, &rumor, public_key).await {
|
match send_gift_wrap(&client, &signer, relays, &receiver, &rumor, public_key).await
|
||||||
|
{
|
||||||
Ok((report, _)) => {
|
Ok((report, _)) => {
|
||||||
reports.push(report);
|
reports.push(report);
|
||||||
sents += 1;
|
sents += 1;
|
||||||
@@ -562,9 +561,11 @@ impl Room {
|
|||||||
// Send backup to current user if needed
|
// Send backup to current user if needed
|
||||||
if backup && sents >= 1 {
|
if backup && sents >= 1 {
|
||||||
let public_key = sender.public_key();
|
let public_key = sender.public_key();
|
||||||
|
let relays = sender.messaging_relays();
|
||||||
let signer = encryption_signer.as_ref().unwrap_or(&user_signer);
|
let signer = encryption_signer.as_ref().unwrap_or(&user_signer);
|
||||||
|
|
||||||
match send_gift_wrap(&client, signer, &public_key, &rumor, public_key).await {
|
match send_gift_wrap(&client, signer, relays, &public_key, &rumor, public_key).await
|
||||||
|
{
|
||||||
Ok((report, _)) => reports.push(report),
|
Ok((report, _)) => reports.push(report),
|
||||||
Err(report) => reports.push(report),
|
Err(report) => reports.push(report),
|
||||||
}
|
}
|
||||||
@@ -579,6 +580,7 @@ impl Room {
|
|||||||
async fn send_gift_wrap<T>(
|
async fn send_gift_wrap<T>(
|
||||||
client: &Client,
|
client: &Client,
|
||||||
signer: &T,
|
signer: &T,
|
||||||
|
to: &[RelayUrl],
|
||||||
receiver: &PublicKey,
|
receiver: &PublicKey,
|
||||||
rumor: &UnsignedEvent,
|
rumor: &UnsignedEvent,
|
||||||
public_key: PublicKey,
|
public_key: PublicKey,
|
||||||
@@ -588,9 +590,15 @@ where
|
|||||||
{
|
{
|
||||||
match EventBuilder::gift_wrap(signer, receiver, rumor.clone(), []).await {
|
match EventBuilder::gift_wrap(signer, receiver, rumor.clone(), []).await {
|
||||||
Ok(event) => {
|
Ok(event) => {
|
||||||
|
// Connect to each relay before sending
|
||||||
|
for url in to.iter() {
|
||||||
|
client.add_relay(url).and_connect().await.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the event to each relay
|
||||||
match client
|
match client
|
||||||
.send_event(&event)
|
.send_event(&event)
|
||||||
.to_nip17()
|
.to(to)
|
||||||
.ack_policy(AckPolicy::none())
|
.ack_policy(AckPolicy::none())
|
||||||
.await
|
.await
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -465,14 +465,6 @@ impl ChatPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if a message is pending
|
|
||||||
fn sent_pending(&self, id: &EventId, cx: &App) -> bool {
|
|
||||||
self.reports_by_id
|
|
||||||
.read(cx)
|
|
||||||
.get(id)
|
|
||||||
.is_some_and(|reports| reports.iter().all(|r| r.pending()))
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Check if a message has any reports
|
/// Check if a message has any reports
|
||||||
fn has_reports(&self, id: &EventId, cx: &App) -> bool {
|
fn has_reports(&self, id: &EventId, cx: &App) -> bool {
|
||||||
self.reports_by_id.read(cx).get(id).is_some()
|
self.reports_by_id.read(cx).get(id).is_some()
|
||||||
@@ -802,8 +794,6 @@ impl ChatPanel {
|
|||||||
|
|
||||||
let replies = message.replies_to.as_slice();
|
let replies = message.replies_to.as_slice();
|
||||||
let has_replies = !replies.is_empty();
|
let has_replies = !replies.is_empty();
|
||||||
|
|
||||||
let sent_pending = self.sent_pending(&id, cx);
|
|
||||||
let has_reports = self.has_reports(&id, cx);
|
let has_reports = self.has_reports(&id, cx);
|
||||||
|
|
||||||
// Hide avatar setting
|
// Hide avatar setting
|
||||||
@@ -851,9 +841,6 @@ impl ChatPanel {
|
|||||||
.child(author.name()),
|
.child(author.name()),
|
||||||
)
|
)
|
||||||
.child(message.created_at.to_human_time())
|
.child(message.created_at.to_human_time())
|
||||||
.when(sent_pending, |this| {
|
|
||||||
this.child(SharedString::from("• Sending..."))
|
|
||||||
})
|
|
||||||
.when(has_reports, |this| {
|
.when(has_reports, |this| {
|
||||||
this.child(deferred(self.render_sent_reports(&id, cx)))
|
this.child(deferred(self.render_sent_reports(&id, cx)))
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ nostr.workspace = true
|
|||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
nostr-lmdb.workspace = true
|
nostr-lmdb.workspace = true
|
||||||
nostr-memory.workspace = true
|
nostr-memory.workspace = true
|
||||||
nostr-gossip-sqlite.workspace = true
|
nostr-gossip-memory.workspace = true
|
||||||
nostr-connect.workspace = true
|
nostr-connect.workspace = true
|
||||||
nostr-blossom.workspace = true
|
nostr-blossom.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use anyhow::{Context as AnyhowContext, Error, anyhow};
|
|||||||
use common::config_dir;
|
use common::config_dir;
|
||||||
use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, SharedString, Task, Window};
|
use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, SharedString, Task, Window};
|
||||||
use nostr_connect::prelude::*;
|
use nostr_connect::prelude::*;
|
||||||
use nostr_gossip_sqlite::prelude::*;
|
use nostr_gossip_memory::prelude::*;
|
||||||
use nostr_lmdb::prelude::*;
|
use nostr_lmdb::prelude::*;
|
||||||
use nostr_memory::prelude::*;
|
use nostr_memory::prelude::*;
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
@@ -114,17 +114,16 @@ impl NostrRegistry {
|
|||||||
// Construct the nostr npubs entity
|
// Construct the nostr npubs entity
|
||||||
let npubs = cx.new(|_| vec![]);
|
let npubs = cx.new(|_| vec![]);
|
||||||
|
|
||||||
// Construct the nostr gossip instance
|
|
||||||
let gossip = cx.foreground_executor().block_on(async move {
|
|
||||||
NostrGossipSqlite::open(config_dir().join("gossip"))
|
|
||||||
.await
|
|
||||||
.expect("Failed to initialize gossip instance")
|
|
||||||
});
|
|
||||||
|
|
||||||
// Construct the nostr client builder
|
// Construct the nostr client builder
|
||||||
let mut builder = ClientBuilder::default()
|
let mut builder = ClientBuilder::default()
|
||||||
.signer(signer.clone())
|
.signer(signer.clone())
|
||||||
.gossip(gossip)
|
.gossip(NostrGossipMemory::unbounded())
|
||||||
|
.gossip_config(
|
||||||
|
GossipConfig::default()
|
||||||
|
.no_background_refresh()
|
||||||
|
.sync_idle_timeout(Duration::from_secs(TIMEOUT))
|
||||||
|
.sync_initial_timeout(Duration::from_millis(600)),
|
||||||
|
)
|
||||||
.automatic_authentication(false)
|
.automatic_authentication(false)
|
||||||
.verify_subscriptions(false)
|
.verify_subscriptions(false)
|
||||||
.connect_timeout(Duration::from_secs(10))
|
.connect_timeout(Duration::from_secs(10))
|
||||||
@@ -198,7 +197,10 @@ impl NostrRegistry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Connect to all added relays
|
// Connect to all added relays
|
||||||
client.connect().await;
|
client
|
||||||
|
.connect()
|
||||||
|
.and_wait(Duration::from_secs(TIMEOUT))
|
||||||
|
.await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user