mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-27 12:54:42 +00:00
parent
f09da1a1c8
commit
fcbc220408
2 changed files with 14 additions and 6 deletions
|
@ -145,11 +145,14 @@ const FLUSH_INTERVAL: Duration = Duration::from_secs(1);
|
|||
#[cfg(not(debug_assertions))]
|
||||
const FLUSH_INTERVAL: Duration = Duration::from_secs(60 * 5);
|
||||
|
||||
static ZED_CLIENT_CHECKSUM_SEED: Lazy<Vec<u8>> = Lazy::new(|| {
|
||||
static ZED_CLIENT_CHECKSUM_SEED: Lazy<Option<Vec<u8>>> = Lazy::new(|| {
|
||||
option_env!("ZED_CLIENT_CHECKSUM_SEED")
|
||||
.unwrap_or("development-checksum-seed")
|
||||
.as_bytes()
|
||||
.into()
|
||||
.map(|s| s.as_bytes().into())
|
||||
.or_else(|| {
|
||||
env::var("ZED_CLIENT_CHECKSUM_SEED")
|
||||
.ok()
|
||||
.map(|s| s.as_bytes().into())
|
||||
})
|
||||
});
|
||||
|
||||
impl Telemetry {
|
||||
|
@ -510,6 +513,10 @@ impl Telemetry {
|
|||
return;
|
||||
}
|
||||
|
||||
let Some(checksum_seed) = &*ZED_CLIENT_CHECKSUM_SEED else {
|
||||
return;
|
||||
};
|
||||
|
||||
let this = self.clone();
|
||||
self.executor
|
||||
.spawn(
|
||||
|
@ -551,9 +558,9 @@ impl Telemetry {
|
|||
}
|
||||
|
||||
let mut summer = Sha256::new();
|
||||
summer.update(&*ZED_CLIENT_CHECKSUM_SEED);
|
||||
summer.update(checksum_seed);
|
||||
summer.update(&json_bytes);
|
||||
summer.update(&*ZED_CLIENT_CHECKSUM_SEED);
|
||||
summer.update(checksum_seed);
|
||||
let mut checksum = String::new();
|
||||
for byte in summer.finalize().as_slice() {
|
||||
use std::fmt::Write;
|
||||
|
|
|
@ -142,6 +142,7 @@ setTimeout(() => {
|
|||
ZED_RPC_URL: "http://localhost:8080/rpc",
|
||||
ZED_ADMIN_API_TOKEN: "secret",
|
||||
ZED_WINDOW_SIZE: size,
|
||||
ZED_CLIENT_CHECKSUM_SEED: "development-checksum-seed",
|
||||
PATH: process.env.PATH,
|
||||
RUST_LOG: process.env.RUST_LOG || "info",
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue