mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Pass secret token when uploading crashes
This commit is contained in:
parent
54a45095cd
commit
da3870ea31
@ -1,6 +1,5 @@
|
||||
use anyhow::{anyhow, Context, Result};
|
||||
use client::http::HttpClient;
|
||||
|
||||
use client::{http::HttpClient, ZED_SECRET_CLIENT_TOKEN};
|
||||
use gpui::{
|
||||
actions,
|
||||
elements::{Empty, MouseEventHandler, Text},
|
||||
@ -16,7 +15,6 @@ use std::{env, ffi::OsString, path::PathBuf, sync::Arc, time::Duration};
|
||||
use workspace::{ItemHandle, StatusItemView};
|
||||
|
||||
const POLL_INTERVAL: Duration = Duration::from_secs(60 * 60);
|
||||
const ACCESS_TOKEN: &'static str = "618033988749894";
|
||||
|
||||
lazy_static! {
|
||||
pub static ref ZED_APP_VERSION: Option<AppVersion> = env::var("ZED_APP_VERSION")
|
||||
@ -135,7 +133,7 @@ impl AutoUpdater {
|
||||
});
|
||||
let mut response = client
|
||||
.get(
|
||||
&format!("{server_url}/api/releases/latest?token={ACCESS_TOKEN}&asset=Zed.dmg"),
|
||||
&format!("{server_url}/api/releases/latest?token={ZED_SECRET_CLIENT_TOKEN}&asset=Zed.dmg"),
|
||||
Default::default(),
|
||||
true,
|
||||
)
|
||||
|
@ -50,6 +50,8 @@ lazy_static! {
|
||||
.and_then(|s| if s.is_empty() { None } else { Some(s) });
|
||||
}
|
||||
|
||||
pub const ZED_SECRET_CLIENT_TOKEN: &'static str = "618033988749894";
|
||||
|
||||
actions!(client, [Authenticate]);
|
||||
|
||||
pub fn init(rpc: Arc<Client>, cx: &mut MutableAppContext) {
|
||||
|
@ -12,7 +12,7 @@ use cli::{
|
||||
use client::{
|
||||
self,
|
||||
http::{self, HttpClient},
|
||||
ChannelList, UserStore,
|
||||
ChannelList, UserStore, ZED_SECRET_CLIENT_TOKEN,
|
||||
};
|
||||
use fs::OpenOptions;
|
||||
use futures::{
|
||||
@ -296,7 +296,8 @@ fn init_crash_handler(
|
||||
.context("error reading crash file")?;
|
||||
let body = serde_json::to_string(&json!({
|
||||
"text": text,
|
||||
"version": version
|
||||
"version": version,
|
||||
"token": ZED_SECRET_CLIENT_TOKEN,
|
||||
}))
|
||||
.unwrap();
|
||||
let request = Request::builder()
|
||||
@ -311,7 +312,10 @@ fn init_crash_handler(
|
||||
.context("error removing crash after sending it successfully")
|
||||
.log_err();
|
||||
} else {
|
||||
log::error!("{:?}", response);
|
||||
return Err(anyhow!(
|
||||
"error uploading crash to server: {}",
|
||||
response.status()
|
||||
));
|
||||
}
|
||||
}
|
||||
Ok::<_, anyhow::Error>(())
|
||||
|
Loading…
Reference in New Issue
Block a user