This commit is contained in:
Ren Amamiya
2026-04-01 15:19:05 +07:00
parent b547776263
commit 1b4aa02cc0
4 changed files with 14 additions and 36 deletions

12
Cargo.lock generated
View File

@@ -4444,17 +4444,6 @@ dependencies = [
"tracing",
]
[[package]]
name = "nostr-memory"
version = "0.44.0"
source = "git+https://github.com/rust-nostr/nostr#6503a7a86e904800de54c8592a6811f5f17cd805"
dependencies = [
"btreecap",
"nostr",
"nostr-database",
"tokio",
]
[[package]]
name = "nostr-sdk"
version = "0.44.1"
@@ -6613,7 +6602,6 @@ dependencies = [
"nostr-connect",
"nostr-gossip-memory",
"nostr-lmdb",
"nostr-memory",
"nostr-sdk",
"petname",
"rustls",

View File

@@ -21,7 +21,6 @@ reqwest_client = { git = "https://github.com/zed-industries/zed" }
# Nostr
nostr-lmdb = { 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-blossom = { git = "https://github.com/rust-nostr/nostr" }
nostr-gossip-memory = { git = "https://github.com/rust-nostr/nostr" }

View File

@@ -10,7 +10,6 @@ common = { path = "../common" }
nostr.workspace = true
nostr-sdk.workspace = true
nostr-lmdb.workspace = true
nostr-memory.workspace = true
nostr-gossip-memory.workspace = true
nostr-connect.workspace = true
nostr-blossom.workspace = true

View File

@@ -8,7 +8,6 @@ use gpui::{App, AppContext, Context, Entity, EventEmitter, Global, SharedString,
use nostr_connect::prelude::*;
use nostr_gossip_memory::prelude::*;
use nostr_lmdb::prelude::*;
use nostr_memory::prelude::*;
use nostr_sdk::prelude::*;
mod blossom;
@@ -114,9 +113,17 @@ impl NostrRegistry {
// Construct the nostr npubs entity
let npubs = cx.new(|_| vec![]);
// Construct the nostr client builder
let mut builder = ClientBuilder::default()
// Construct the nostr lmdb instance
let lmdb = cx.foreground_executor().block_on(async move {
NostrLmdb::open(config_dir().join("nostr"))
.await
.expect("Failed to initialize database")
});
// Construct the nostr client
let client = ClientBuilder::default()
.signer(signer.clone())
.database(lmdb)
.gossip(NostrGossipMemory::unbounded())
.gossip_config(
GossipConfig::default()
@@ -125,27 +132,12 @@ impl NostrRegistry {
.sync_initial_timeout(Duration::from_millis(600)),
)
.automatic_authentication(false)
.verify_subscriptions(false)
.verify_subscriptions(true)
.connect_timeout(Duration::from_secs(10))
.sleep_when_idle(SleepWhenIdle::Enabled {
timeout: Duration::from_secs(600),
});
// Add database if not in debug mode
if !cfg!(debug_assertions) {
// Construct the nostr lmdb instance
let lmdb = cx.foreground_executor().block_on(async move {
NostrLmdb::open(config_dir().join("nostr"))
.await
.expect("Failed to initialize database")
});
builder = builder.database(lmdb);
} else {
builder = builder.database(MemoryDatabase::unbounded())
}
// Build the nostr client
let client = builder.build();
})
.build();
// Run at the end of current cycle
cx.defer_in(window, |this, _window, cx| {
@@ -911,7 +903,7 @@ fn default_messaging_relays() -> Vec<RelayUrl> {
vec![
RelayUrl::parse("wss://nos.lol").unwrap(),
RelayUrl::parse("wss://nip17.com").unwrap(),
RelayUrl::parse("wss://relay.0xchat.com").unwrap(),
RelayUrl::parse("wss://auth.nostr1.com").unwrap(),
]
}