File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
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 @@ -20,7 +20,6 @@ use std::time::Duration;
20
20
21
21
use anyhow:: anyhow;
22
22
use chrono:: { DateTime , Utc } ;
23
- use http:: header;
24
23
25
24
use crate :: { about, parseable:: PARSEABLE } ;
26
25
@@ -33,15 +32,9 @@ pub struct LatestRelease {
33
32
}
34
33
35
34
pub async fn get_latest ( deployment_id : & uid:: Uid ) -> Result < LatestRelease , anyhow:: Error > {
36
- let send_analytics = PARSEABLE . options . send_analytics . to_string ( ) ;
37
- let mut headers = header:: HeaderMap :: new ( ) ;
38
- headers. insert (
39
- "P_SEND_ANONYMOUS_USAGE_DATA" ,
40
- header:: HeaderValue :: from_str ( send_analytics. as_str ( ) ) . expect ( "valid header value" ) ,
41
- ) ;
35
+ let send_analytics = PARSEABLE . options . send_analytics ;
42
36
let agent = reqwest:: ClientBuilder :: new ( )
43
- . user_agent ( about:: user_agent ( deployment_id) )
44
- . default_headers ( headers)
37
+ . user_agent ( about:: user_agent ( deployment_id, send_analytics) )
45
38
. timeout ( Duration :: from_secs ( 8 ) )
46
39
. build ( )
47
40
. expect ( "client can be built on this system" ) ;
You can’t perform that action at this time.
0 commit comments