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:
1 parent
af6fc3a542
commit
1d3168dc4a
6 files changed
+9
-24
No files matched your search
@@ -37,7 +37,6 @@ tokio = { workspace = true, features = [
|
||||
"fs",
|
||||
"io-util",
|
||||
], optional = true }
|
||||
webbrowser = { workspace = true }
|
||||
infer = { workspace = true }
|
||||
dunce = { workspace = true }
|
||||
slab = { workspace = true }
|
||||
@@ -49,6 +48,7 @@ async-trait = { workspace = true }
|
||||
tao = { workspace = true, features = ["rwh_05"] }
|
||||
dioxus-history = { workspace = true }
|
||||
base64 = { workspace = true }
|
||||
open = { workspace = true }
|
||||
libc = "0.2.170"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
|
||||
@@ -271,7 +271,7 @@ impl App {
|
||||
if let Some(temp) = msg.params().as_object() {
|
||||
if temp.contains_key("href") {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,8 +346,11 @@ impl WebviewInstance {
|
||||
if var.starts_with("dioxus://") || var.starts_with("http://dioxus.") {
|
||||
true
|
||||
} else {
|
||||
if var.starts_with("http://") || var.starts_with("https://") {
|
||||
_ = webbrowser::open(&var);
|
||||
if var.starts_with("http://")
|
||||
|| var.starts_with("https://")
|
||||
|| var.starts_with("mailto:")
|
||||
{
|
||||
_ = open::that_detached(&var);
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user