19 lines
511 B
Rust
19 lines
511 B
Rust
#[tauri::command]
|
|
pub async fn launch_url(url: String) -> Result<(), String> {
|
|
open::that(&url).map_err(|e| format!("Failed to open URL: {}", e))
|
|
}
|
|
|
|
#[tauri::command]
|
|
pub async fn check_privileges() -> Result<bool, String> {
|
|
#[cfg(target_os = "linux")]
|
|
{
|
|
// Check if effective user ID is 0 (root)
|
|
Ok(unsafe { libc::geteuid() } == 0)
|
|
}
|
|
|
|
#[cfg(target_os = "windows")]
|
|
{
|
|
// On Windows, check if running as administrator
|
|
Ok(is_elevated::is_elevated())
|
|
}
|
|
} |