Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

client: Attach system ID to sign-in request (#56675)

Marshall Bowers58d24a610bef
diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs
index 52c3d808ead..d8973166810 100644
--- a/crates/client/src/client.rs
+++ b/crates/client/src/client.rs
@@ -1396,7 +1396,7 @@ impl Client {
// any other app running on the user's device.
let (public_key, private_key) =
rpc::auth::keypair().context("failed to generate keypair for auth")?;
- let public_key_string = String::try_from(public_key)
+ let public_key = String::try_from(public_key)
.context("failed to serialize public key for auth")?;
if let Some((login, token)) =
@@ -1420,11 +1420,22 @@ impl Client {
.context("server not bound to a TCP address")?
.port();
+ #[derive(Serialize)]
+ struct NativeAppSignInQueryParams {
+ native_app_port: u16,
+ native_app_public_key: String,
+ system_id: Option<Arc<str>>,
+ }
+
// Open the Zed sign-in page in the user's browser, with query parameters that indicate
// that the user is signing in from a Zed app running on the same device.
let url = http.build_url(&format!(
- "/native_app_signin?native_app_port={}&native_app_public_key={}",
- port, public_key_string
+ "/native_app_signin?{}",
+ serde_urlencoded::to_string(&NativeAppSignInQueryParams {
+ native_app_port: port,
+ native_app_public_key: public_key,
+ system_id: this.telemetry.system_id(),
+ })?
));
open_url_tx.send(url).log_err();