From 0cb491eaf9e0740dbb7e25969a0300b25a805968 Mon Sep 17 00:00:00 2001 From: reya Date: Thu, 7 Nov 2024 14:26:13 +0700 Subject: [PATCH] feat: auto open browser if receive auth_url --- src-tauri/Cargo.lock | 44 +++++++++++++++++++++++++++++++++++-------- src-tauri/Cargo.toml | 4 ++++ src-tauri/src/main.rs | 2 -- 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 6f4bf783..fa7afb93 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2510,6 +2510,15 @@ dependencies = [ "digest", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "html5ever" version = "0.26.0" @@ -3481,7 +3490,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8" [[package]] name = "nostr" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "aes", "async-trait", @@ -3512,7 +3521,7 @@ dependencies = [ [[package]] name = "nostr-connect" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-trait", "async-utility", @@ -3521,12 +3530,13 @@ dependencies = [ "thiserror", "tokio", "tracing", + "webbrowser", ] [[package]] name = "nostr-database" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-trait", "flatbuffers", @@ -3540,7 +3550,7 @@ dependencies = [ [[package]] name = "nostr-lmdb" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "heed", "nostr", @@ -3553,7 +3563,7 @@ dependencies = [ [[package]] name = "nostr-relay-pool" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-utility", "async-wsocket", @@ -3571,7 +3581,7 @@ dependencies = [ [[package]] name = "nostr-sdk" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-utility", "atomic-destructor", @@ -3590,7 +3600,7 @@ dependencies = [ [[package]] name = "nostr-zapper" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-trait", "nostr", @@ -3735,7 +3745,7 @@ dependencies = [ [[package]] name = "nwc" version = "0.36.0" -source = "git+https://github.com/rust-nostr/nostr#33fb0699baf3a98b22b67ee6a86317a22cac927c" +source = "git+https://github.com/reyamir/nostr?branch=feat/open-auth-url#596ad460a6747ccc60c27dce8141bf2dd5765df6" dependencies = [ "async-trait", "async-utility", @@ -7109,6 +7119,24 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webbrowser" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5f07fb9bc8de2ddfe6b24a71a75430673fd679e568c48b52716cef1cfae923" +dependencies = [ + "block2", + "core-foundation 0.10.0", + "home", + "jni", + "log", + "ndk-context", + "objc2", + "objc2-foundation", + "url", + "web-sys", +] + [[package]] name = "webkit2gtk" version = "2.0.1" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a90a7178..265af600 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -50,6 +50,10 @@ keyring = { version = "3", features = ["apple-native", "windows-native"] } keyring-search = { git = "https://github.com/reyamir/keyring-search" } tracing-subscriber = { version = "0.3.18", features = ["fmt"] } +[patch.'https://github.com/rust-nostr/nostr'] +nostr-sdk = { git = "https://github.com/reyamir/nostr", branch = "feat/open-auth-url", features = ["lmdb", "webln", "all-nips"] } +nostr-connect = { git = "https://github.com/reyamir/nostr", branch = "feat/open-auth-url" } + [target.'cfg(target_os = "macos")'.dependencies] border = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" } share-picker = { git = "https://github.com/ahkohd/tauri-toolkit", branch = "v2" } diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 9c19b434..8215a7de 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -549,8 +549,6 @@ fn main() { ) { println!("Emit error: {}", e) } - } else if event.kind == Kind::JobResult(6300) { - println!("Job result: {}", event.as_json()) } } }