Allows desktop apps to open mailto links (#4282)

* Allows desktop apps to open mailto links

* Drop webbrowser, use `open` only

* switch to that_detached

* use workspace `open`

---------

Co-authored-by: Jonathan Kelley <jkelleyrtp@gmail.com>
This commit is contained in:
Juan VásquezandJonathan Kelley authored and GitHub committed 2025-06-18 16:14:54 -07:00
1 parent af6fc3a542
commit 1d3168dc4a
6 files changed
+9 -24

No files matched your search

Generated
+1 -18
View File
@@ -3951,6 +3951,7 @@ dependencies = [
"ndk-sys 0.6.0+11769913", "ndk-sys 0.6.0+11769913",
"objc", "objc",
"objc_id", "objc_id",
"open",
"percent-encoding", "percent-encoding",
"rand 0.8.5", "rand 0.8.5",
"reqwest 0.12.15", "reqwest 0.12.15",
@@ -3967,7 +3968,6 @@ dependencies = [
"tokio-tungstenite", "tokio-tungstenite",
"tracing", "tracing",
"tray-icon", "tray-icon",
"webbrowser",
"wry", "wry",
] ]
@@ -16194,23 +16194,6 @@ dependencies = [
"string_cache_codegen", "string_cache_codegen",
] ]
[[package]]
name = "webbrowser"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5df295f8451142f1856b1bd86a606dfe9587d439bc036e319c827700dbd555e"
dependencies = [
"core-foundation 0.10.0",
"home",
"jni",
"log",
"ndk-context",
"objc2 0.6.1",
"objc2-foundation 0.3.1",
"url",
"web-sys",
]
[[package]] [[package]]
name = "webkit2gtk" name = "webkit2gtk"
version = "2.0.1" version = "2.0.1"
-1
View File
@@ -314,7 +314,6 @@ memfd = "0.6.4"
# desktop # desktop
wry = { version = "0.45.0", default-features = false } wry = { version = "0.45.0", default-features = false }
tao = { version = "0.33.0", features = ["rwh_05"] } tao = { version = "0.33.0", features = ["rwh_05"] }
webbrowser = "1.0.3"
infer = "0.19.0" infer = "0.19.0"
dunce = "1.0.5" dunce = "1.0.5"
percent-encoding = "2.3.1" percent-encoding = "2.3.1"
+1 -1
View File
@@ -4148,7 +4148,7 @@ r#" <script>
.trim() .trim()
.into(); .into();
let path_to_sim = path_to_xcode.join("Applications").join("Simulator.app"); let path_to_sim = path_to_xcode.join("Applications").join("Simulator.app");
open::that(path_to_sim)?; open::that_detached(path_to_sim)?;
} }
Platform::Android => { Platform::Android => {
+1 -1
View File
@@ -37,7 +37,6 @@ tokio = { workspace = true, features = [
"fs", "fs",
"io-util", "io-util",
], optional = true } ], optional = true }
webbrowser = { workspace = true }
infer = { workspace = true } infer = { workspace = true }
dunce = { workspace = true } dunce = { workspace = true }
slab = { workspace = true } slab = { workspace = true }
@@ -49,6 +48,7 @@ async-trait = { workspace = true }
tao = { workspace = true, features = ["rwh_05"] } tao = { workspace = true, features = ["rwh_05"] }
dioxus-history = { workspace = true } dioxus-history = { workspace = true }
base64 = { workspace = true } base64 = { workspace = true }
open = { workspace = true }
libc = "0.2.170" libc = "0.2.170"
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
+1 -1
View File
@@ -271,7 +271,7 @@ impl App {
if let Some(temp) = msg.params().as_object() { if let Some(temp) = msg.params().as_object() {
if temp.contains_key("href") { if temp.contains_key("href") {
if let Some(href) = temp.get("href").and_then(|v| v.as_str()) { if let Some(href) = temp.get("href").and_then(|v| v.as_str()) {
if let Err(e) = webbrowser::open(href) { if let Err(e) = open::that_detached(href) {
tracing::error!("Open Browser error: {:?}", e); tracing::error!("Open Browser error: {:?}", e);
} }
} }
+5 -2
View File
@@ -346,8 +346,11 @@ impl WebviewInstance {
if var.starts_with("dioxus://") || var.starts_with("http://dioxus.") { if var.starts_with("dioxus://") || var.starts_with("http://dioxus.") {
true true
} else { } else {
if var.starts_with("http://") || var.starts_with("https://") { if var.starts_with("http://")
_ = webbrowser::open(&var); || var.starts_with("https://")
|| var.starts_with("mailto:")
{
_ = open::that_detached(&var);
} }
false false
} }