Remove Zed-specific code from core libraries
- Delete script/install-linux (referenced non-existent Zed build files) - Delete crates/util/src/shell_env.rs (Zed --printenv functionality) - Remove Zed API URL builders from http_client: - build_zed_api_url() - build_zed_cloud_url() - build_zed_cloud_url_with_query() - build_zed_llm_url() - Remove Zed-specific functions from util: - prevent_root_execution() - get_shell_safe_zed_path() - get_zed_cli_path() - load_login_shell_environment() - load_shell_from_passwd() - Clean up unused imports
This commit is contained in:
@@ -10,7 +10,7 @@ pub use http::{self, Method, Request, Response, StatusCode, Uri, request::Builde
|
||||
|
||||
use futures::future::BoxFuture;
|
||||
use parking_lot::Mutex;
|
||||
use serde::Serialize;
|
||||
|
||||
use std::sync::Arc;
|
||||
#[cfg(feature = "test-support")]
|
||||
use std::{any::type_name, fmt};
|
||||
@@ -208,63 +208,6 @@ impl HttpClientWithUrl {
|
||||
format!("{}{}", self.base_url(), path)
|
||||
}
|
||||
|
||||
/// Builds a Zed API URL using the given path.
|
||||
pub fn build_zed_api_url(&self, path: &str, query: &[(&str, &str)]) -> Result<Url> {
|
||||
let base_url = self.base_url();
|
||||
let base_api_url = match base_url.as_ref() {
|
||||
"https://zed.dev" => "https://api.zed.dev",
|
||||
"https://staging.zed.dev" => "https://api-staging.zed.dev",
|
||||
"http://localhost:3000" => "http://localhost:8080",
|
||||
other => other,
|
||||
};
|
||||
|
||||
Ok(Url::parse_with_params(
|
||||
&format!("{}{}", base_api_url, path),
|
||||
query,
|
||||
)?)
|
||||
}
|
||||
|
||||
/// Builds a Zed Cloud URL using the given path.
|
||||
pub fn build_zed_cloud_url(&self, path: &str) -> Result<Url> {
|
||||
let base_url = self.base_url();
|
||||
let base_api_url = match base_url.as_ref() {
|
||||
"https://zed.dev" => "https://cloud.zed.dev",
|
||||
"https://staging.zed.dev" => "https://cloud.zed.dev",
|
||||
"http://localhost:3000" => "http://localhost:8787",
|
||||
other => other,
|
||||
};
|
||||
|
||||
Ok(Url::parse(&format!("{}{}", base_api_url, path))?)
|
||||
}
|
||||
|
||||
/// Builds a Zed Cloud URL using the given path and query params.
|
||||
pub fn build_zed_cloud_url_with_query(&self, path: &str, query: impl Serialize) -> Result<Url> {
|
||||
let base_url = self.base_url();
|
||||
let base_api_url = match base_url.as_ref() {
|
||||
"https://zed.dev" => "https://cloud.zed.dev",
|
||||
"https://staging.zed.dev" => "https://cloud.zed.dev",
|
||||
"http://localhost:3000" => "http://localhost:8787",
|
||||
other => other,
|
||||
};
|
||||
let query = serde_urlencoded::to_string(&query)?;
|
||||
Ok(Url::parse(&format!("{}{}?{}", base_api_url, path, query))?)
|
||||
}
|
||||
|
||||
/// Builds a Zed LLM URL using the given path.
|
||||
pub fn build_zed_llm_url(&self, path: &str, query: &[(&str, &str)]) -> Result<Url> {
|
||||
let base_url = self.base_url();
|
||||
let base_api_url = match base_url.as_ref() {
|
||||
"https://zed.dev" => "https://cloud.zed.dev",
|
||||
"https://staging.zed.dev" => "https://llm-staging.zed.dev",
|
||||
"http://localhost:3000" => "http://localhost:8787",
|
||||
other => other,
|
||||
};
|
||||
|
||||
Ok(Url::parse_with_params(
|
||||
&format!("{}{}", base_api_url, path),
|
||||
query,
|
||||
)?)
|
||||
}
|
||||
}
|
||||
|
||||
impl HttpClient for HttpClientWithUrl {
|
||||
|
||||
Reference in New Issue
Block a user