chore: update gpui and nostr-sdk

This commit is contained in:
2025-06-30 08:20:15 +07:00
parent b212095334
commit abb1474300
22 changed files with 196 additions and 120 deletions

View File

@@ -5,7 +5,7 @@ use std::sync::Arc;
use chats::message::Message;
use chats::room::{Room, RoomKind, SendError};
use common::nip96_upload;
use common::nip96::nip96_upload;
use common::profile::RenderProfile;
use global::shared_state;
use gpui::prelude::FluentBuilder;
@@ -390,16 +390,9 @@ impl Chat {
// Spawn task via async utility instead of GPUI context
nostr_sdk::async_utility::task::spawn(async move {
let url = match nip96_upload(shared_state().client(), nip96, file_data)
let url = nip96_upload(shared_state().client(), &nip96, file_data)
.await
{
Ok(url) => Some(url),
Err(e) => {
log::error!("Upload error: {e}");
None
}
};
.ok();
_ = tx.send(url);
});

View File

@@ -4,7 +4,7 @@ use std::time::Duration;
use anyhow::{anyhow, Error};
use chats::room::{Room, RoomKind};
use chats::ChatRegistry;
use common::nip05_profile;
use common::nip05::nip05_profile;
use common::profile::RenderProfile;
use global::shared_state;
use gpui::prelude::FluentBuilder;

View File

@@ -592,8 +592,7 @@ impl Render for Login {
.text_center()
.text_color(cx.theme().text_muted)
.child(SharedString::from(format!(
"Approve connection request from your signer in {} seconds",
i
"Approve connection request from your signer in {i} seconds"
))),
)
})

View File

@@ -1,4 +1,4 @@
use common::nip96_upload;
use common::nip96::nip96_upload;
use global::shared_state;
use gpui::prelude::FluentBuilder;
use gpui::{
@@ -158,7 +158,7 @@ impl NewAccount {
nostr_sdk::async_utility::task::spawn(async move {
if let Ok(url) =
nip96_upload(shared_state().client(), nip96, file_data).await
nip96_upload(shared_state().client(), &nip96, file_data).await
{
_ = tx.send(url);
}

View File

@@ -1,7 +1,7 @@
use std::str::FromStr;
use std::time::Duration;
use common::nip96_upload;
use common::nip96::nip96_upload;
use global::shared_state;
use gpui::prelude::FluentBuilder;
use gpui::{
@@ -104,7 +104,7 @@ impl Profile {
}
fn upload(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let nip96 = AppSettings::get_global(cx).settings.media_server.clone();
let nip96_server = AppSettings::get_global(cx).settings.media_server.clone();
let avatar_input = self.avatar_input.downgrade();
let paths = cx.prompt_for_paths(PathPromptOptions {
files: true,
@@ -125,7 +125,8 @@ impl Profile {
nostr_sdk::async_utility::task::spawn(async move {
if let Ok(url) =
nip96_upload(shared_state().client(), nip96, file_data).await
nip96_upload(shared_state().client(), &nip96_server, file_data)
.await
{
_ = tx.send(url);
}

View File

@@ -118,7 +118,7 @@ impl Relays {
]);
if let Err(e) = client.send_event_builder(builder).await {
log::error!("Failed to send relay list event: {}", e);
log::error!("Failed to send relay list event: {e}");
}
}
@@ -153,7 +153,7 @@ impl Relays {
)
.await
{
log::error!("Failed to subscribe to new messages: {}", e);
log::error!("Failed to subscribe to new messages: {e}");
}
Ok(output.val)

View File

@@ -6,8 +6,8 @@ use anyhow::Error;
use chats::room::{Room, RoomKind};
use chats::{ChatRegistry, RoomEmitter};
use common::debounced_delay::DebouncedDelay;
use common::nip05::nip05_verify;
use common::profile::RenderProfile;
use common::verify_nip05;
use element::DisplayRoom;
use global::constants::{DEFAULT_MODAL_WIDTH, SEARCH_RELAYS};
use global::shared_state;
@@ -185,7 +185,7 @@ impl Sidebar {
continue;
};
if !verify_nip05(event.pubkey, target).await.unwrap_or(false) {
if !nip05_verify(event.pubkey, target).await.unwrap_or(false) {
// Skip if NIP-05 is not valid or failed to verify
continue;
};
@@ -218,7 +218,7 @@ impl Sidebar {
this.update(cx, |this, cx| {
if result.is_empty() {
let msg =
format!("There are no users matching query {}", query_cloned);
format!("There are no users matching query {query_cloned}");
window.push_notification(Notification::info(msg), cx);
this.set_finding(false, cx);
} else {