.
This commit is contained in:
726
Cargo.lock
generated
726
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
10
Cargo.toml
10
Cargo.toml
@@ -19,8 +19,8 @@ gpui_tokio = { git = "https://github.com/zed-industries/zed" }
|
|||||||
reqwest_client = { git = "https://github.com/zed-industries/zed" }
|
reqwest_client = { git = "https://github.com/zed-industries/zed" }
|
||||||
|
|
||||||
# Nostr
|
# Nostr
|
||||||
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr", }
|
nostr-lmdb = { git = "https://github.com/rust-nostr/nostr" }
|
||||||
nostr-connect = { git = "https://github.com/rust-nostr/nostr" }
|
nostr-memory = { 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-memory = { 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" }
|
||||||
@@ -43,6 +43,12 @@ smol = "2"
|
|||||||
tracing = "0.1.40"
|
tracing = "0.1.40"
|
||||||
webbrowser = "1.0.4"
|
webbrowser = "1.0.4"
|
||||||
tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] }
|
tracing-subscriber = { version = "0.3.18", features = ["fmt", "env-filter"] }
|
||||||
|
# Use errno stub for WASM
|
||||||
|
errno = { version = "0.3.14", default-features = false }
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
# Use stacker's psm version which may have better WASM support
|
||||||
|
psm = { git = "https://github.com/rust-lang/stacker", branch = "master" }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
strip = true
|
strip = true
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ publish.workspace = true
|
|||||||
common = { path = "../common" }
|
common = { path = "../common" }
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
gpui_tokio.workspace = true
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
serde = { workspace = true, features = ["derive"] }
|
serde = { workspace = true, features = ["derive"] }
|
||||||
@@ -19,3 +17,7 @@ serde_json.workspace = true
|
|||||||
semver = "1.0.27"
|
semver = "1.0.27"
|
||||||
tempfile = "3.23.0"
|
tempfile = "3.23.0"
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
gpui_tokio.workspace = true
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
#![cfg(not(target_arch = "wasm32"))]
|
||||||
|
|
||||||
use std::ffi::OsString;
|
use std::ffi::OsString;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ nostr-sdk.workspace = true
|
|||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
@@ -25,3 +24,6 @@ serde.workspace = true
|
|||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
fuzzy-matcher = "0.3.7"
|
fuzzy-matcher = "0.3.7"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ use std::cmp::Reverse;
|
|||||||
use std::collections::{BTreeSet, HashMap, HashSet};
|
use std::collections::{BTreeSet, HashMap, HashSet};
|
||||||
use std::hash::{DefaultHasher, Hash, Hasher};
|
use std::hash::{DefaultHasher, Hash, Hasher};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
use std::sync::RwLock;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
@@ -15,6 +17,7 @@ use gpui::{
|
|||||||
};
|
};
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use smallvec::{SmallVec, smallvec};
|
use smallvec::{SmallVec, smallvec};
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use smol::lock::RwLock;
|
use smol::lock::RwLock;
|
||||||
use state::{DEVICE_GIFTWRAP, NostrRegistry, USER_GIFTWRAP};
|
use state::{DEVICE_GIFTWRAP, NostrRegistry, USER_GIFTWRAP};
|
||||||
|
|
||||||
@@ -318,9 +321,8 @@ impl ChatRegistry {
|
|||||||
let status = self.tracking.clone();
|
let status = self.tracking.clone();
|
||||||
let tx = self.signal_tx.clone();
|
let tx = self.signal_tx.clone();
|
||||||
|
|
||||||
self.tasks.push(cx.background_spawn(async move {
|
self.tasks.push(cx.spawn(async move |_, cx| {
|
||||||
let loop_duration = Duration::from_secs(15);
|
let loop_duration = Duration::from_secs(15);
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
if status.load(Ordering::Acquire) {
|
if status.load(Ordering::Acquire) {
|
||||||
_ = status.compare_exchange(true, false, Ordering::Release, Ordering::Relaxed);
|
_ = status.compare_exchange(true, false, Ordering::Release, Ordering::Relaxed);
|
||||||
@@ -328,7 +330,7 @@ impl ChatRegistry {
|
|||||||
} else {
|
} else {
|
||||||
_ = tx.send_async(Signal::Eose).await;
|
_ = tx.send_async(Signal::Eose).await;
|
||||||
}
|
}
|
||||||
smol::Timer::after(loop_duration).await;
|
cx.background_executor().timer(loop_duration).await;
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,13 +14,10 @@ chat = { path = "../chat" }
|
|||||||
settings = { path = "../settings" }
|
settings = { path = "../settings" }
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
gpui_tokio.workspace = true
|
|
||||||
|
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
@@ -30,3 +27,7 @@ once_cell = "1.19.0"
|
|||||||
regex = "1"
|
regex = "1"
|
||||||
linkify = "0.10.0"
|
linkify = "0.10.0"
|
||||||
pulldown-cmark = "0.13.1"
|
pulldown-cmark = "0.13.1"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
gpui_tokio.workspace = true
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
use std::collections::{BTreeMap, BTreeSet, HashSet};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
use std::sync::RwLock;
|
||||||
|
|
||||||
pub use actions::*;
|
pub use actions::*;
|
||||||
use anyhow::{Context as AnyhowContext, Error};
|
use anyhow::{Context as AnyhowContext, Error};
|
||||||
@@ -18,6 +20,7 @@ use nostr_sdk::prelude::*;
|
|||||||
use person::{Person, PersonRegistry};
|
use person::{Person, PersonRegistry};
|
||||||
use settings::{AppSettings, SignerKind};
|
use settings::{AppSettings, SignerKind};
|
||||||
use smallvec::{SmallVec, smallvec};
|
use smallvec::{SmallVec, smallvec};
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use smol::lock::RwLock;
|
use smol::lock::RwLock;
|
||||||
use state::{NostrRegistry, upload};
|
use state::{NostrRegistry, upload};
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ anyhow.workspace = true
|
|||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
chrono.workspace = true
|
chrono.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
|
|
||||||
|
|||||||
@@ -14,12 +14,13 @@ settings = { path = "../settings" }
|
|||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
|||||||
@@ -265,12 +265,13 @@ impl DeviceRegistry {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
let announcement_existed = self.announcement_existed.clone();
|
let announcement_existed = self.announcement_existed.clone();
|
||||||
|
let executor = cx.background_executor().clone();
|
||||||
|
|
||||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||||
if !cx
|
if !cx
|
||||||
.background_spawn(async move {
|
.background_spawn(async move {
|
||||||
// Wait for 5 seconds
|
// Wait for 5 seconds
|
||||||
smol::Timer::after(Duration::from_secs(5)).await;
|
executor.timer(Duration::from_secs(5)).await;
|
||||||
|
|
||||||
// Then check if the msg relays have been found
|
// Then check if the msg relays have been found
|
||||||
if !announcement_existed.load(Ordering::Acquire) {
|
if !announcement_existed.load(Ordering::Acquire) {
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ gpui.workspace = true
|
|||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
urlencoding = "2.1.3"
|
urlencoding = "2.1.3"
|
||||||
|
|||||||
@@ -16,6 +16,5 @@ nostr-sdk.workspace = true
|
|||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ common = { path = "../common" }
|
|||||||
|
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
@@ -18,3 +17,6 @@ serde.workspace = true
|
|||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
paste = "1.0.15"
|
paste = "1.0.15"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
|||||||
@@ -229,13 +229,14 @@ impl AppSettings {
|
|||||||
/// Load settings
|
/// Load settings
|
||||||
fn load(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
fn load(&mut self, window: &mut Window, cx: &mut Context<Self>) {
|
||||||
let task: Task<Result<Settings, Error>> = cx.background_spawn(async move {
|
let task: Task<Result<Settings, Error>> = cx.background_spawn(async move {
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
{
|
||||||
let path = config_dir().join(".settings");
|
let path = config_dir().join(".settings");
|
||||||
|
|
||||||
if let Ok(content) = smol::fs::read_to_string(&path).await {
|
if let Ok(content) = smol::fs::read_to_string(&path).await {
|
||||||
Ok(serde_json::from_str(&content)?)
|
return Ok(serde_json::from_str(&content)?);
|
||||||
} else {
|
|
||||||
Err(anyhow!("Not found"))
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Err(anyhow!("Not found"))
|
||||||
});
|
});
|
||||||
|
|
||||||
cx.spawn_in(window, async move |this, cx| {
|
cx.spawn_in(window, async move |this, cx| {
|
||||||
@@ -254,11 +255,10 @@ impl AppSettings {
|
|||||||
/// Save settings
|
/// Save settings
|
||||||
pub fn save(&mut self, cx: &mut Context<Self>) {
|
pub fn save(&mut self, cx: &mut Context<Self>) {
|
||||||
let settings = self.inner.read(cx);
|
let settings = self.inner.read(cx);
|
||||||
|
|
||||||
if let Ok(content) = serde_json::to_string(&settings) {
|
if let Ok(content) = serde_json::to_string(&settings) {
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
cx.background_spawn(async move {
|
cx.background_spawn(async move {
|
||||||
let path = config_dir().join(".settings");
|
let path = config_dir().join(".settings");
|
||||||
// Write settings to file
|
|
||||||
smol::fs::write(&path, content).await.ok();
|
smol::fs::write(&path, content).await.ok();
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|||||||
@@ -9,22 +9,27 @@ common = { path = "../common" }
|
|||||||
|
|
||||||
nostr.workspace = true
|
nostr.workspace = true
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
nostr-lmdb.workspace = true
|
|
||||||
nostr-gossip-memory.workspace = true
|
nostr-gossip-memory.workspace = true
|
||||||
nostr-connect.workspace = true
|
|
||||||
nostr-blossom.workspace = true
|
nostr-blossom.workspace = true
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
gpui_tokio.workspace = true
|
|
||||||
smol.workspace = true
|
|
||||||
flume.workspace = true
|
flume.workspace = true
|
||||||
|
futures.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
webbrowser.workspace = true
|
webbrowser.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
|
||||||
rustls = "0.23"
|
|
||||||
petname = "2.0.2"
|
petname = "2.0.2"
|
||||||
whoami = "1.6.1"
|
whoami = "1.6.1"
|
||||||
mime_guess = "2.0.4"
|
mime_guess = "2.0.4"
|
||||||
|
|
||||||
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
|
nostr-memory.workspace = true
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
nostr-lmdb.workspace = true
|
||||||
|
smol.workspace = true
|
||||||
|
gpui_tokio.workspace = true
|
||||||
|
rustls = "0.23"
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use anyhow::{anyhow, Error};
|
use anyhow::{Error, anyhow};
|
||||||
use gpui::AsyncApp;
|
use gpui::AsyncApp;
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use gpui_tokio::Tokio;
|
use gpui_tokio::Tokio;
|
||||||
use mime_guess::from_path;
|
use mime_guess::from_path;
|
||||||
use nostr_blossom::prelude::*;
|
use nostr_blossom::prelude::*;
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
|
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
pub async fn upload(server: Url, path: PathBuf, cx: &AsyncApp) -> Result<Url, Error> {
|
pub async fn upload(server: Url, path: PathBuf, cx: &AsyncApp) -> Result<Url, Error> {
|
||||||
let content_type = from_path(&path).first_or_octet_stream().to_string();
|
let content_type = from_path(&path).first_or_octet_stream().to_string();
|
||||||
let data = smol::fs::read(path).await?;
|
let data = smol::fs::read(path).await?;
|
||||||
@@ -25,3 +27,8 @@ pub async fn upload(server: Url, path: PathBuf, cx: &AsyncApp) -> Result<Url, Er
|
|||||||
.await
|
.await
|
||||||
.map_err(|e| anyhow!("Upload error: {e}"))?
|
.map_err(|e| anyhow!("Upload error: {e}"))?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
pub async fn upload(_server: Url, _path: PathBuf, _cx: &AsyncApp) -> Result<Url, Error> {
|
||||||
|
Err(anyhow!("File upload not supported on web"))
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ use std::time::Duration;
|
|||||||
use anyhow::{Error, anyhow};
|
use anyhow::{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_gossip_memory::prelude::*;
|
use nostr_gossip_memory::prelude::*;
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
use nostr_lmdb::prelude::*;
|
use nostr_lmdb::prelude::*;
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
use nostr_memory::prelude::*;
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
|
|
||||||
mod blossom;
|
mod blossom;
|
||||||
@@ -23,11 +25,13 @@ pub fn init(window: &mut Window, cx: &mut App) {
|
|||||||
// rustls uses the `aws_lc_rs` provider by default
|
// rustls uses the `aws_lc_rs` provider by default
|
||||||
// This only errors if the default provider has already
|
// This only errors if the default provider has already
|
||||||
// been installed. We can ignore this `Result`.
|
// been installed. We can ignore this `Result`.
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
rustls::crypto::aws_lc_rs::default_provider()
|
rustls::crypto::aws_lc_rs::default_provider()
|
||||||
.install_default()
|
.install_default()
|
||||||
.ok();
|
.ok();
|
||||||
|
|
||||||
// Initialize the tokio runtime
|
// Initialize the tokio runtime
|
||||||
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
gpui_tokio::init(cx);
|
gpui_tokio::init(cx);
|
||||||
|
|
||||||
NostrRegistry::set_global(cx.new(|cx| NostrRegistry::new(window, cx)), cx);
|
NostrRegistry::set_global(cx.new(|cx| NostrRegistry::new(window, cx)), cx);
|
||||||
@@ -88,15 +92,19 @@ impl NostrRegistry {
|
|||||||
let signer = cx.new(|_| None);
|
let signer = cx.new(|_| None);
|
||||||
|
|
||||||
// Construct the nostr lmdb instance
|
// Construct the nostr lmdb instance
|
||||||
let lmdb = cx.foreground_executor().block_on(async move {
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
let database = cx.foreground_executor().block_on(async move {
|
||||||
NostrLmdb::open(config_dir().join("nostr"))
|
NostrLmdb::open(config_dir().join("nostr"))
|
||||||
.await
|
.await
|
||||||
.expect("Failed to initialize database")
|
.expect("Failed to initialize database")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
|
let database = MemoryDatabase::unbounded();
|
||||||
|
|
||||||
// Construct the nostr client
|
// Construct the nostr client
|
||||||
let client = ClientBuilder::default()
|
let client = ClientBuilder::default()
|
||||||
.database(lmdb)
|
.database(database)
|
||||||
.gossip(NostrGossipMemory::unbounded())
|
.gossip(NostrGossipMemory::unbounded())
|
||||||
.gossip_config(GossipConfig::default().no_background_refresh())
|
.gossip_config(GossipConfig::default().no_background_refresh())
|
||||||
.connect_timeout(Duration::from_secs(10))
|
.connect_timeout(Duration::from_secs(10))
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use anyhow::Error;
|
use anyhow::Error;
|
||||||
|
use futures::io::AsyncReadExt;
|
||||||
use gpui::http_client::{AsyncBody, HttpClient};
|
use gpui::http_client::{AsyncBody, HttpClient};
|
||||||
use nostr_sdk::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use smol::io::AsyncReadExt;
|
|
||||||
|
|
||||||
#[allow(async_fn_in_trait)]
|
#[allow(async_fn_in_trait)]
|
||||||
pub trait NostrAddress {
|
pub trait NostrAddress {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ common = { path = "../common" }
|
|||||||
theme = { path = "../theme" }
|
theme = { path = "../theme" }
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
@@ -25,3 +24,6 @@ lsp-types = "0.97.0"
|
|||||||
ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] }
|
ropey = { version = "=2.0.0-beta.1", features = ["metric_lines_lf", "metric_utf16"] }
|
||||||
sum_tree = { git = "https://github.com/zed-industries/zed" }
|
sum_tree = { git = "https://github.com/zed-industries/zed" }
|
||||||
tree-sitter = "0.26"
|
tree-sitter = "0.26"
|
||||||
|
|
||||||
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
|
smol.workspace = true
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ use super::folding::FoldRange;
|
|||||||
use super::text_wrapper::{LineItem, WrapDisplayPoint};
|
use super::text_wrapper::{LineItem, WrapDisplayPoint};
|
||||||
use super::wrap_map::WrapMap;
|
use super::wrap_map::WrapMap;
|
||||||
use super::{BufferPoint, DisplayPoint};
|
use super::{BufferPoint, DisplayPoint};
|
||||||
|
use crate::input::Point as TreeSitterPoint;
|
||||||
use crate::input::display_map::WrapPoint;
|
use crate::input::display_map::WrapPoint;
|
||||||
use crate::input::rope_ext::RopeExt as _;
|
use crate::input::rope_ext::RopeExt as _;
|
||||||
use crate::input::Point as TreeSitterPoint;
|
|
||||||
|
|
||||||
/// DisplayMap is the main interface for Editor/Input coordinate mapping.
|
/// DisplayMap is the main interface for Editor/Input coordinate mapping.
|
||||||
///
|
///
|
||||||
@@ -269,10 +269,7 @@ impl DisplayMap {
|
|||||||
|
|
||||||
/// Convert wrap display point to TreeSitterPoint (buffer line/col).
|
/// Convert wrap display point to TreeSitterPoint (buffer line/col).
|
||||||
#[inline]
|
#[inline]
|
||||||
pub(crate) fn wrap_display_point_to_point(
|
pub(crate) fn wrap_display_point_to_point(&self, point: WrapDisplayPoint) -> TreeSitterPoint {
|
||||||
&self,
|
|
||||||
point: WrapDisplayPoint,
|
|
||||||
) -> TreeSitterPoint {
|
|
||||||
self.wrap_map.wrapper().display_point_to_point(point)
|
self.wrap_map.wrapper().display_point_to_point(point)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ use gpui::{
|
|||||||
SharedString, StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task,
|
SharedString, StatefulInteractiveElement, StyleRefinement, Styled, Subscription, Task,
|
||||||
UniformListScrollHandle, Window, div, px, size, uniform_list,
|
UniformListScrollHandle, Window, div, px, size, uniform_list,
|
||||||
};
|
};
|
||||||
use smol::Timer;
|
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
|
|
||||||
use crate::actions::{Cancel, Confirm, SelectDown, SelectUp};
|
use crate::actions::{Cancel, Confirm, SelectDown, SelectUp};
|
||||||
@@ -265,6 +264,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.set_searching(true, window, cx);
|
self.set_searching(true, window, cx);
|
||||||
|
|
||||||
let search = self.delegate.perform_search(&text, window, cx);
|
let search = self.delegate.perform_search(&text, window, cx);
|
||||||
|
|
||||||
if self.rows_cache.len() > 0 {
|
if self.rows_cache.len() > 0 {
|
||||||
@@ -273,6 +273,7 @@ where
|
|||||||
self._set_selected_index(None, window, cx);
|
self._set_selected_index(None, window, cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let executor = cx.background_executor().clone();
|
||||||
self._search_task = cx.spawn_in(window, async move |this, window| {
|
self._search_task = cx.spawn_in(window, async move |this, window| {
|
||||||
search.await;
|
search.await;
|
||||||
|
|
||||||
@@ -282,7 +283,8 @@ where
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Always wait 100ms to avoid flicker
|
// Always wait 100ms to avoid flicker
|
||||||
Timer::after(Duration::from_millis(100)).await;
|
executor.timer(Duration::from_millis(100)).await;
|
||||||
|
|
||||||
_ = this.update_in(window, |this, window, cx| {
|
_ = this.update_in(window, |this, window, cx| {
|
||||||
this.set_searching(false, window, cx);
|
this.set_searching(false, window, cx);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ person = { path = "../person" }
|
|||||||
relay_auth = { path = "../relay_auth" }
|
relay_auth = { path = "../relay_auth" }
|
||||||
|
|
||||||
gpui.workspace = true
|
gpui.workspace = true
|
||||||
nostr-connect.workspace = true
|
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
@@ -26,7 +25,6 @@ serde_json.workspace = true
|
|||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
smallvec.workspace = true
|
smallvec.workspace = true
|
||||||
smol.workspace = true
|
|
||||||
futures.workspace = true
|
futures.workspace = true
|
||||||
oneshot.workspace = true
|
oneshot.workspace = true
|
||||||
webbrowser.workspace = true
|
webbrowser.workspace = true
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use gpui::{
|
|||||||
AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
|
AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
|
||||||
Subscription, Task, Window, div,
|
Subscription, Task, Window, div,
|
||||||
};
|
};
|
||||||
use nostr_connect::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use state::NostrRegistry;
|
use state::NostrRegistry;
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
use ui::button::{Button, ButtonVariants};
|
use ui::button::{Button, ButtonVariants};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ use gpui::{
|
|||||||
AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
|
AppContext, Context, Entity, IntoElement, ParentElement, Render, SharedString, Styled,
|
||||||
Subscription, Task, Window, div,
|
Subscription, Task, Window, div,
|
||||||
};
|
};
|
||||||
use nostr_connect::prelude::*;
|
use nostr_sdk::prelude::*;
|
||||||
use theme::ActiveTheme;
|
use theme::ActiveTheme;
|
||||||
use ui::button::{Button, ButtonVariants};
|
use ui::button::{Button, ButtonVariants};
|
||||||
use ui::input::{Input, InputEvent, InputState};
|
use ui::input::{Input, InputEvent, InputState};
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ gpui_macos.workspace = true
|
|||||||
gpui_tokio.workspace = true
|
gpui_tokio.workspace = true
|
||||||
reqwest_client.workspace = true
|
reqwest_client.workspace = true
|
||||||
|
|
||||||
nostr-connect.workspace = true
|
|
||||||
nostr-sdk.workspace = true
|
nostr-sdk.workspace = true
|
||||||
|
|
||||||
anyhow.workspace = true
|
anyhow.workspace = true
|
||||||
|
|||||||
@@ -66,9 +66,6 @@ fn main() {
|
|||||||
cx.activate(true);
|
cx.activate(true);
|
||||||
|
|
||||||
cx.new(|cx| {
|
cx.new(|cx| {
|
||||||
// Initialize the tokio runtime
|
|
||||||
gpui_tokio::init(cx);
|
|
||||||
|
|
||||||
// Initialize components
|
// Initialize components
|
||||||
ui::init(cx);
|
ui::init(cx);
|
||||||
|
|
||||||
|
|||||||
@@ -10,5 +10,6 @@ targets = [
|
|||||||
"aarch64-pc-windows-msvc",
|
"aarch64-pc-windows-msvc",
|
||||||
"aarch64-apple-ios",
|
"aarch64-apple-ios",
|
||||||
"aarch64-linux-android",
|
"aarch64-linux-android",
|
||||||
"wasm32-unknown-unknown"
|
"wasm32-unknown-unknown",
|
||||||
|
"wasm32-wasip2"
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user