feat(commands): app_info (version+commit) and open_url for the About page

This commit is contained in:
iamdoubz
2026-07-06 07:46:18 -05:00
parent 035abb93ea
commit 0317649b48
+36
View File
@@ -834,6 +834,42 @@ pub async fn map_speaker_to_participant(
Ok(())
}
// ---- App metadata (About page) ----
/// Version + build commit for the About page. Version comes from Cargo; the
/// short commit hash is baked in at build time by `build.rs` (`WA_GIT_HASH`).
#[tauri::command]
pub async fn app_info() -> WaResult<serde_json::Value> {
Ok(serde_json::json!({
"version": env!("CARGO_PKG_VERSION"),
"commit": env!("WA_GIT_HASH"),
}))
}
/// Opens an http(s) URL in the user's default browser (About page source link).
/// Windows-only (WA is Windows-native, ADR-0001). The scheme is validated so
/// this can't be coerced into launching a local path or program, and `explorer`
/// receives the URL as a single argv (no shell), so there's no injection surface.
#[tauri::command]
pub async fn open_url(url: String) -> WaResult<()> {
if !(url.starts_with("https://") || url.starts_with("http://")) {
return Err(WaError::new("app", "only http(s) URLs may be opened"));
}
#[cfg(windows)]
{
std::process::Command::new("explorer")
.arg(&url)
.spawn()
.map_err(|e| WaError::new("app", e.to_string()))?;
Ok(())
}
#[cfg(not(windows))]
{
let _ = url;
Err(WaError::new("app", "unsupported platform"))
}
}
// ---- Hardware + models (Phase 3) ----
#[tauri::command]