//! Functions for getting core dump information via local rust. use anyhow::Result; use serde_json::Value as JValue; use crate::coredump::CoreDump; #[derive(Debug, Clone)] pub struct CoreDumper {} impl CoreDumper { pub fn new() -> Self { CoreDumper {} } } impl Default for CoreDumper { fn default() -> Self { Self::new() } } #[async_trait::async_trait(?Send)] impl CoreDump for CoreDumper { fn token(&self) -> Result { Ok(std::env::var("KITTYCAD_API_TOKEN").unwrap_or_default()) } fn base_api_url(&self) -> Result { Ok("https://api.zoo.dev".to_string()) } fn version(&self) -> Result { Ok(env!("CARGO_PKG_VERSION").to_string()) } fn kcl_code(&self) -> Result { Ok("".to_owned()) } fn pool(&self) -> Result { Ok("".to_owned()) } fn os(&self) -> Result { Ok(crate::coredump::OsInfo { platform: Some(std::env::consts::OS.to_string()), arch: Some(std::env::consts::ARCH.to_string()), version: None, browser: None, }) } fn is_desktop(&self) -> Result { Ok(false) } async fn get_webrtc_stats(&self) -> Result { // TODO: we could actually implement this. Ok(crate::coredump::WebrtcStats::default()) } async fn get_client_state(&self) -> Result { Ok(JValue::default()) } async fn screenshot(&self) -> Result { // Take a screenshot of the engine. todo!() } }