File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -71,14 +71,15 @@ pub fn get_latest_release() -> &'static Option<LatestRelease> {
71
71
}
72
72
73
73
// User Agent for Download API call
74
- // Format: Parseable/<UID>/<version>/<commit_hash> (<OS>; <Platform>)
75
- pub fn user_agent ( uid : & Ulid ) -> String {
74
+ // Format: Parseable/<UID>/<version>/<commit_hash>/<send_analytics> (<OS>; <Platform>)
75
+ pub fn user_agent ( uid : & Ulid , send_analytics : bool ) -> String {
76
76
analytics:: refresh_sys_info ( ) ;
77
77
format ! (
78
- "Parseable/{}/{}/{} ({:?}; {})" ,
78
+ "Parseable/{}/{}/{}/{} ({:?}; {})" ,
79
79
uid,
80
80
current( ) . released_version,
81
81
current( ) . commit_hash,
82
+ send_analytics,
82
83
System :: name( ) . unwrap_or_default( ) ,
83
84
platform( )
84
85
)
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ use std::time::Duration;
21
21
use anyhow:: anyhow;
22
22
use chrono:: { DateTime , Utc } ;
23
23
24
- use crate :: about;
24
+ use crate :: { about, parseable :: PARSEABLE } ;
25
25
26
26
use super :: uid;
27
27
@@ -32,11 +32,13 @@ pub struct LatestRelease {
32
32
}
33
33
34
34
pub async fn get_latest ( deployment_id : & uid:: Uid ) -> Result < LatestRelease , anyhow:: Error > {
35
+ let send_analytics = PARSEABLE . options . send_analytics ;
35
36
let agent = reqwest:: ClientBuilder :: new ( )
36
- . user_agent ( about:: user_agent ( deployment_id) )
37
+ . user_agent ( about:: user_agent ( deployment_id, send_analytics ) )
37
38
. timeout ( Duration :: from_secs ( 8 ) )
38
39
. build ( )
39
40
. expect ( "client can be built on this system" ) ;
41
+
40
42
let json: serde_json:: Value = agent
41
43
. get ( "https://download.parseable.io/latest-version" )
42
44
. send ( )
You can’t perform that action at this time.
0 commit comments