diff --git a/src/about.rs b/src/about.rs index 01294e3a5..f2f4593b5 100644 --- a/src/about.rs +++ b/src/about.rs @@ -71,14 +71,15 @@ pub fn get_latest_release() -> &'static Option { } // User Agent for Download API call -// Format: Parseable/// (; ) -pub fn user_agent(uid: &Ulid) -> String { +// Format: Parseable//// (; ) +pub fn user_agent(uid: &Ulid, send_analytics: bool) -> String { analytics::refresh_sys_info(); format!( - "Parseable/{}/{}/{} ({:?}; {})", + "Parseable/{}/{}/{}/{} ({:?}; {})", uid, current().released_version, current().commit_hash, + send_analytics, System::name().unwrap_or_default(), platform() ) diff --git a/src/utils/update.rs b/src/utils/update.rs index f6fe8680f..b0020ae58 100644 --- a/src/utils/update.rs +++ b/src/utils/update.rs @@ -21,7 +21,7 @@ use std::time::Duration; use anyhow::anyhow; use chrono::{DateTime, Utc}; -use crate::about; +use crate::{about, parseable::PARSEABLE}; use super::uid; @@ -32,11 +32,13 @@ pub struct LatestRelease { } pub async fn get_latest(deployment_id: &uid::Uid) -> Result { + let send_analytics = PARSEABLE.options.send_analytics; let agent = reqwest::ClientBuilder::new() - .user_agent(about::user_agent(deployment_id)) + .user_agent(about::user_agent(deployment_id, send_analytics)) .timeout(Duration::from_secs(8)) .build() .expect("client can be built on this system"); + let json: serde_json::Value = agent .get("https://download.parseable.io/latest-version") .send()