Initial Commit
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#[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())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user