2024-04-09 18:05:36 -07:00
|
|
|
//! Functions for getting core dump information via local rust.
|
|
|
|
|
|
|
|
use anyhow::Result;
|
2024-06-23 19:19:24 -07:00
|
|
|
use serde_json::Value as JValue;
|
2024-04-09 18:05:36 -07:00
|
|
|
|
|
|
|
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()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-04-11 13:15:49 -07:00
|
|
|
#[async_trait::async_trait(?Send)]
|
2024-04-09 18:05:36 -07:00
|
|
|
impl CoreDump for CoreDumper {
|
2024-04-11 13:15:49 -07:00
|
|
|
fn token(&self) -> Result<String> {
|
|
|
|
Ok(std::env::var("KITTYCAD_API_TOKEN").unwrap_or_default())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn base_api_url(&self) -> Result<String> {
|
|
|
|
Ok("https://api.zoo.dev".to_string())
|
|
|
|
}
|
|
|
|
|
2024-04-09 18:05:36 -07:00
|
|
|
fn version(&self) -> Result<String> {
|
|
|
|
Ok(env!("CARGO_PKG_VERSION").to_string())
|
|
|
|
}
|
|
|
|
|
2024-08-14 17:56:28 -07:00
|
|
|
fn kcl_code(&self) -> Result<String> {
|
|
|
|
Ok("".to_owned())
|
|
|
|
}
|
|
|
|
|
2024-04-25 15:51:33 -04:00
|
|
|
fn pool(&self) -> Result<String> {
|
|
|
|
Ok("".to_owned())
|
|
|
|
}
|
|
|
|
|
2024-08-16 07:15:42 -04:00
|
|
|
fn os(&self) -> Result<crate::coredump::OsInfo> {
|
2024-04-09 18:05:36 -07:00
|
|
|
Ok(crate::coredump::OsInfo {
|
|
|
|
platform: Some(std::env::consts::OS.to_string()),
|
|
|
|
arch: Some(std::env::consts::ARCH.to_string()),
|
|
|
|
version: None,
|
|
|
|
browser: None,
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2024-08-16 07:15:42 -04:00
|
|
|
fn is_desktop(&self) -> Result<bool> {
|
2024-04-09 18:05:36 -07:00
|
|
|
Ok(false)
|
|
|
|
}
|
|
|
|
|
|
|
|
async fn get_webrtc_stats(&self) -> Result<crate::coredump::WebrtcStats> {
|
|
|
|
// TODO: we could actually implement this.
|
|
|
|
Ok(crate::coredump::WebrtcStats::default())
|
|
|
|
}
|
2024-04-11 13:15:49 -07:00
|
|
|
|
2024-06-20 16:36:28 -07:00
|
|
|
async fn get_client_state(&self) -> Result<JValue> {
|
|
|
|
Ok(JValue::default())
|
|
|
|
}
|
|
|
|
|
2024-04-11 13:15:49 -07:00
|
|
|
async fn screenshot(&self) -> Result<String> {
|
|
|
|
// Take a screenshot of the engine.
|
|
|
|
todo!()
|
|
|
|
}
|
2024-04-09 18:05:36 -07:00
|
|
|
}
|