chore: update nostr-sdk

This commit is contained in:
2025-02-04 07:28:54 +07:00
parent a3389ec893
commit 3647b62308
3 changed files with 45 additions and 44 deletions

64
Cargo.lock generated
View File

@@ -748,9 +748,9 @@ checksum = "8f1fe948ff07f4bd06c30984e69f5b4899c516a3ef74f34df92a2df2ab535495"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" checksum = "f61dac84819c6588b558454b194026eb1f09c293b9036ae9b159e74e73ab6cf9"
[[package]] [[package]]
name = "calloop" name = "calloop"
@@ -928,9 +928,9 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.5.27" version = "4.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "769b0145982b4b48713e01ec42d61614425f27b7058bda7180a3a41f30104796" checksum = "3e77c3243bd94243c03672cb5154667347c457ca271254724f9f393aee1c05ff"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
@@ -950,9 +950,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.5.24" version = "4.5.28"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54b755194d6389280185988721fffba69495eed5ee9feeee9a599b53db80318c" checksum = "bf4ced95c6f4a675af3da73304b9ac4ed991640c36374e4b46795c49e17cf1ed"
dependencies = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
@@ -1039,7 +1039,7 @@ dependencies = [
[[package]] [[package]]
name = "collections" name = "collections"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"indexmap", "indexmap",
"rustc-hash 2.1.0", "rustc-hash 2.1.0",
@@ -1331,9 +1331,9 @@ checksum = "5c297a1c74b71ae29df00c3e22dd9534821d60eb9af5a0192823fa2acea70c2a"
[[package]] [[package]]
name = "derive_more" name = "derive_more"
version = "0.99.18" version = "0.99.19"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" checksum = "3da29a38df43d6f156149c9b43ded5e018ddff2a855cf2cfd62e8cd7d079c69f"
dependencies = [ dependencies = [
"convert_case", "convert_case",
"proc-macro2", "proc-macro2",
@@ -1345,7 +1345,7 @@ dependencies = [
[[package]] [[package]]
name = "derive_refineable" name = "derive_refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2058,7 +2058,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui" name = "gpui"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"as-raw-xcb-connection", "as-raw-xcb-connection",
@@ -2145,7 +2145,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_macros" name = "gpui_macros"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2155,7 +2155,7 @@ dependencies = [
[[package]] [[package]]
name = "gpui_tokio" name = "gpui_tokio"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"gpui", "gpui",
"tokio", "tokio",
@@ -2360,7 +2360,7 @@ dependencies = [
[[package]] [[package]]
name = "http_client" name = "http_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -3011,7 +3011,7 @@ dependencies = [
[[package]] [[package]]
name = "media" name = "media"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bindgen", "bindgen",
@@ -3190,7 +3190,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
[[package]] [[package]]
name = "nostr" name = "nostr"
version = "0.39.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a" source = "git+https://github.com/rust-nostr/nostr#dda112c89422cda6740fdae404e09a227a0f79ce"
dependencies = [ dependencies = [
"aes", "aes",
"base64", "base64",
@@ -3218,7 +3218,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-database" name = "nostr-database"
version = "0.39.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a" source = "git+https://github.com/rust-nostr/nostr#dda112c89422cda6740fdae404e09a227a0f79ce"
dependencies = [ dependencies = [
"flatbuffers", "flatbuffers",
"nostr", "nostr",
@@ -3228,7 +3228,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-lmdb" name = "nostr-lmdb"
version = "0.39.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a" source = "git+https://github.com/rust-nostr/nostr#dda112c89422cda6740fdae404e09a227a0f79ce"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"heed", "heed",
@@ -3239,7 +3239,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-relay-pool" name = "nostr-relay-pool"
version = "0.39.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a" source = "git+https://github.com/rust-nostr/nostr#dda112c89422cda6740fdae404e09a227a0f79ce"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"async-wsocket", "async-wsocket",
@@ -3255,7 +3255,7 @@ dependencies = [
[[package]] [[package]]
name = "nostr-sdk" name = "nostr-sdk"
version = "0.39.0" version = "0.39.0"
source = "git+https://github.com/rust-nostr/nostr#7366f8b44c5fee7e4281caafe9f95e1e399c6c7a" source = "git+https://github.com/rust-nostr/nostr#dda112c89422cda6740fdae404e09a227a0f79ce"
dependencies = [ dependencies = [
"async-utility", "async-utility",
"nostr", "nostr",
@@ -3839,18 +3839,18 @@ checksum = "5be167a7af36ee22fe3115051bc51f6e6c7054c9348e28deb4f49bd6f705a315"
[[package]] [[package]]
name = "pin-project" name = "pin-project"
version = "1.1.8" version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e2ec53ad785f4d35dac0adea7f7dc6f1bb277ad84a680c7afefeae05d1f5916" checksum = "dfe2e71e1471fe07709406bf725f710b02927c9c54b2b5b2ec0e8087d97c327d"
dependencies = [ dependencies = [
"pin-project-internal", "pin-project-internal",
] ]
[[package]] [[package]]
name = "pin-project-internal" name = "pin-project-internal"
version = "1.1.8" version = "1.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d56a66c0c55993aa927429d0f8a0abfd74f084e4d9c192cffed01e418d83eefb" checksum = "f6e859e6e5bd50440ab63c47e3ebabc90f26251f7c73c3d3e837b74a1cc3fa67"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -4263,7 +4263,7 @@ dependencies = [
[[package]] [[package]]
name = "refineable" name = "refineable"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"derive_refineable", "derive_refineable",
] ]
@@ -4392,7 +4392,7 @@ dependencies = [
[[package]] [[package]]
name = "reqwest_client" name = "reqwest_client"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@@ -4742,7 +4742,7 @@ checksum = "c2fdfc24bc566f839a2da4c4295b82db7d25a24253867d5c64355abb5799bdbe"
[[package]] [[package]]
name = "semantic_version" name = "semantic_version"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"serde", "serde",
@@ -5067,7 +5067,7 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"
[[package]] [[package]]
name = "sum_tree" name = "sum_tree"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"arrayvec", "arrayvec",
"log", "log",
@@ -5575,7 +5575,7 @@ dependencies = [
"serde", "serde",
"serde_spanned", "serde_spanned",
"toml_datetime", "toml_datetime",
"winnow 0.7.0", "winnow 0.7.1",
] ]
[[package]] [[package]]
@@ -5889,7 +5889,7 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
[[package]] [[package]]
name = "util" name = "util"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/zed-industries/zed#1dd2bbe2bae4e7340ffceb6a9be4742f571e9b1d" source = "git+https://github.com/zed-industries/zed#28b80455f97dbe21d5d9845b85928feca652c518"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"async-fs", "async-fs",
@@ -6526,9 +6526,9 @@ dependencies = [
[[package]] [[package]]
name = "winnow" name = "winnow"
version = "0.7.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e49d2d35d3fad69b39b94139037ecfb4f359f08958b9c11e7315ce770462419" checksum = "86e376c75f4f43f44db463cf729e0d3acbf954d13e22c51e26e4c264b4ab545f"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]

View File

@@ -17,7 +17,7 @@ use gpui::{WindowBackgroundAppearance, WindowDecorations};
use log::{error, info}; use log::{error, info};
use nostr_sdk::prelude::*; use nostr_sdk::prelude::*;
use state::{get_client, initialize_client}; use state::{get_client, initialize_client};
use std::{collections::HashSet, ops::Deref, str::FromStr, sync::Arc, time::Duration}; use std::{borrow::Cow, collections::HashSet, ops::Deref, str::FromStr, sync::Arc, time::Duration};
use tokio::sync::mpsc; use tokio::sync::mpsc;
use ui::Root; use ui::Root;
use views::{app::AppView, onboarding::Onboarding, startup::Startup}; use views::{app::AppView, onboarding::Onboarding, startup::Startup};
@@ -60,7 +60,7 @@ fn main() {
}); });
spawn(async move { spawn(async move {
let (batch_tx, mut batch_rx) = mpsc::channel::<Box<Event>>(20); let (batch_tx, mut batch_rx) = mpsc::channel::<Cow<Event>>(20);
async fn sync_metadata(client: &Client, buffer: &HashSet<PublicKey>) { async fn sync_metadata(client: &Client, buffer: &HashSet<PublicKey>) {
let filter = Filter::new() let filter = Filter::new()
@@ -73,7 +73,7 @@ fn main() {
} }
} }
async fn process_batch(client: &Client, events: &[Box<Event>]) { async fn process_batch(client: &Client, events: &[Cow<'_, Event>]) {
let sig = Signature::from_str(FAKE_SIG).unwrap(); let sig = Signature::from_str(FAKE_SIG).unwrap();
let mut buffer: HashSet<PublicKey> = HashSet::with_capacity(100); let mut buffer: HashSet<PublicKey> = HashSet::with_capacity(100);
@@ -157,7 +157,7 @@ fn main() {
subscription_id, subscription_id,
} => match event.kind { } => match event.kind {
Kind::GiftWrap => { Kind::GiftWrap => {
if subscription_id == new_id { if new_id == *subscription_id {
if let Ok(UnwrappedGift { mut rumor, .. }) = if let Ok(UnwrappedGift { mut rumor, .. }) =
client.unwrap_gift_wrap(&event).await client.unwrap_gift_wrap(&event).await
{ {
@@ -201,7 +201,7 @@ fn main() {
_ => {} _ => {}
}, },
RelayMessage::EndOfStoredEvents(subscription_id) => { RelayMessage::EndOfStoredEvents(subscription_id) => {
if subscription_id == all_id { if all_id == *subscription_id {
if let Err(e) = signal_tx.send(Signal::Eose).await { if let Err(e) = signal_tx.send(Signal::Eose).await {
error!("Failed to send eose: {}", e) error!("Failed to send eose: {}", e)
}; };

View File

@@ -1,6 +1,6 @@
use gpui::{ use gpui::{
actions, div, point, prelude::FluentBuilder as _, px, AnyElement, App, AppContext, Bounds, actions, div, point, prelude::FluentBuilder as _, px, AnyElement, App, AppContext, Bounds,
ClipboardItem, Context, Entity, EntityInputHandler, EventEmitter, FocusHandle, Focusable, Half, ClipboardItem, Context, Entity, EntityInputHandler, EventEmitter, FocusHandle, Focusable,
InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent, InteractiveElement as _, IntoElement, KeyBinding, KeyDownEvent, MouseButton, MouseDownEvent,
MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle, MouseMoveEvent, MouseUpEvent, ParentElement as _, Pixels, Point, Rems, Render, ScrollHandle,
ScrollWheelEvent, SharedString, Styled as _, UTF16Selection, Window, WrappedLine, ScrollWheelEvent, SharedString, Styled as _, UTF16Selection, Window, WrappedLine,
@@ -1099,16 +1099,17 @@ impl TextInput {
for line in lines.iter() { for line in lines.iter() {
let line_origin = self.line_origin_with_y_offset(&mut y_offset, line, line_height); let line_origin = self.line_origin_with_y_offset(&mut y_offset, line, line_height);
let mut pos = inner_position - line_origin; let pos = inner_position - line_origin;
// Ignore the y position in single line mode, only check x position. let closest_index = line.unwrapped_layout.closest_index_for_x(pos.x);
// Return offset by use closest_index_for_x if is single line mode.
if self.is_single_line() { if self.is_single_line() {
pos.y = line_height.half(); return closest_index;
} }
let index_result = line.index_for_position(pos, line_height); let index_result = line.closest_index_for_position(pos, line_height);
if let Ok(v) = index_result { if let Ok(v) = index_result {
// Add 1 for place cursor after the character. index += v;
index += v + 1;
break; break;
} else if line } else if line
.index_for_position(point(px(0.), pos.y), line_height) .index_for_position(point(px(0.), pos.y), line_height)