chore: fix build
This commit is contained in:
@@ -47,12 +47,3 @@ default = ["custom-protocol"]
|
||||
# this feature is used used for production builds where `devPath` points to the filesystem
|
||||
# DO NOT remove this
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
# Optimized for bundle size. If you want faster builds comment out/delete this section.
|
||||
[profile.release]
|
||||
lto = true # Enable Link Time Optimization
|
||||
opt-level = "z" # Optimize for size.
|
||||
codegen-units = 1 # Reduce number of codegen units to increase optimizations.
|
||||
panic = "abort" # Abort on panic
|
||||
strip = true # Automatically strip symbols from the binary.
|
||||
debug = false
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
"updater:allow-check",
|
||||
"updater:default",
|
||||
"window:allow-start-dragging",
|
||||
"store:allow-get",
|
||||
{
|
||||
"identifier": "http:default",
|
||||
"allow": [
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"Capability for the desktop","context":"local","windows":["main","settings","event-*","user-*","column-*"],"permissions":["path:default","event:default","window:default","app:default","resources:default","menu:default","tray:default","theme:allow-set-theme","theme:allow-get-theme","notification:allow-is-permission-granted","notification:allow-request-permission","notification:default","os:allow-locale","os:allow-platform","updater:allow-check","updater:default","window:allow-start-dragging","store:allow-get",{"identifier":"http:default","allow":[{"url":"http://**/"},{"url":"https://**/"}]},{"identifier":"fs:allow-read-text-file","allow":[{"path":"$RESOURCE/locales/*"}]}],"platforms":["linux","macOS","windows"]}}
|
||||
@@ -126,6 +126,7 @@ fn main() {
|
||||
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_store::Builder::default().build())
|
||||
.plugin(tauri_plugin_theme::init(ctx.config_mut()))
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::{str::FromStr, time::Duration};
|
||||
use tauri::State;
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result<String, ()> {
|
||||
pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result<String, String> {
|
||||
let client = &nostr.client;
|
||||
let event_id;
|
||||
|
||||
@@ -21,9 +21,12 @@ pub async fn get_event(id: &str, nostr: State<'_, Nostr>) -> Result<String, ()>
|
||||
.get_events_of(vec![filter], Some(Duration::from_secs(10)))
|
||||
.await
|
||||
.expect("Get event failed");
|
||||
let event = events.first().unwrap().as_json();
|
||||
|
||||
Ok(event)
|
||||
if let Some(event) = events.first() {
|
||||
Ok(event.as_json())
|
||||
} else {
|
||||
Err("Event not found".into())
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
@@ -48,12 +51,14 @@ pub async fn get_text_events(
|
||||
.limit(limit)
|
||||
.until(final_until);
|
||||
|
||||
let events = client
|
||||
if let Ok(events) = client
|
||||
.get_events_of(vec![filter], Some(Duration::from_secs(10)))
|
||||
.await
|
||||
.expect("Get event failed");
|
||||
|
||||
Ok(events)
|
||||
{
|
||||
Ok(events)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
@@ -62,12 +67,14 @@ pub async fn get_event_thread(id: &str, nostr: State<'_, Nostr>) -> Result<Vec<E
|
||||
let event_id = EventId::from_hex(id).unwrap();
|
||||
let filter = Filter::new().kinds(vec![Kind::TextNote]).event(event_id);
|
||||
|
||||
let events = client
|
||||
if let Ok(events) = client
|
||||
.get_events_of(vec![filter], Some(Duration::from_secs(10)))
|
||||
.await
|
||||
.expect("Get event failed");
|
||||
|
||||
Ok(events)
|
||||
{
|
||||
Ok(events)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
|
||||
@@ -26,8 +26,10 @@ pub async fn get_profile(id: &str, nostr: State<'_, Nostr>) -> Result<Metadata,
|
||||
.await
|
||||
.expect("Get metadata failed");
|
||||
|
||||
let event = events.first().unwrap();
|
||||
let metadata: Metadata = Metadata::from_json(&event.content).unwrap();
|
||||
|
||||
Ok(metadata)
|
||||
if let Some(event) = events.first() {
|
||||
let metadata: Metadata = Metadata::from_json(&event.content).unwrap();
|
||||
Ok(metadata)
|
||||
} else {
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user