feat: add open_external_url command to open URLs in the default browser
All checks were successful
Build / check-version (push) Successful in 6s
Build / build-windows (push) Successful in 6m12s
Build / build-linux (push) Successful in 9m27s
Build / build-android (push) Successful in 26m23s
Build / create-release (push) Has been skipped

This commit is contained in:
2026-01-25 21:50:17 +11:00
parent 61c1e3857d
commit 90407c49c6
4 changed files with 11 additions and 2 deletions

View File

@@ -51,6 +51,13 @@ fn read_clipboard_image() -> Result<Option<String>, String> {
Ok(None)
}
/// Open a URL in the default browser (bypasses ACL issues with localhost plugin)
#[cfg(not(any(target_os = "android", target_os = "ios")))]
#[tauri::command]
fn open_external_url(url: String) -> Result<(), String> {
open::that(&url).map_err(|e| e.to_string())
}
/// Runs the Tauri application
pub fn run() {
#[cfg(not(any(target_os = "android", target_os = "ios")))]
@@ -157,7 +164,7 @@ pub fn run() {
api.prevent_close();
}
})
.invoke_handler(tauri::generate_handler![read_clipboard_image])
.invoke_handler(tauri::generate_handler![read_clipboard_image, open_external_url])
.run(tauri::generate_context!())
.expect("error while building tauri application");
}