feat: add editor screen

This commit is contained in:
2024-02-23 14:56:24 +07:00
parent 64286aa354
commit 84584a4d1f
39 changed files with 917 additions and 493 deletions

View File

@@ -4,7 +4,7 @@ use tauri::State;
#[tauri::command]
pub async fn list_connected_relays(state: State<'_, Nostr>) -> Result<Vec<Url>, ()> {
let client = state.client.lock().await;
let client = &state.client;
let relays = client.relays().await;
let list: Vec<Url> = relays.into_keys().collect();
@@ -13,7 +13,7 @@ pub async fn list_connected_relays(state: State<'_, Nostr>) -> Result<Vec<Url>,
#[tauri::command]
pub async fn connect_relay(relay: &str, state: State<'_, Nostr>) -> Result<bool, ()> {
let client = state.client.lock().await;
let client = &state.client;
if let Ok(_) = client.add_relay(relay).await {
Ok(true)
} else {
@@ -23,7 +23,7 @@ pub async fn connect_relay(relay: &str, state: State<'_, Nostr>) -> Result<bool,
#[tauri::command]
pub async fn remove_relay(relay: &str, state: State<'_, Nostr>) -> Result<bool, ()> {
let client = state.client.lock().await;
let client = &state.client;
if let Ok(_) = client.remove_relay(relay).await {
Ok(true)
} else {