feat: add proxy configuration support
- Add proxy settings UI component with enable/disable toggle - Support HTTP, HTTPS, NO_PROXY, and ALL_PROXY environment variables - Store proxy settings in app database for persistence - Apply proxy settings on app startup and when saved - Pass proxy environment variables to Claude command execution - Integrate proxy settings into main Settings page with unified save - Add proxy support for both system binary and sidecar execution This allows users to configure proxy settings for Claude API requests, which is essential for users behind corporate firewalls or in regions requiring proxy access. Fixes network connectivity issues in restricted environments.
This commit is contained in:
@@ -266,6 +266,42 @@ fn create_command_with_env(program: &str) -> Command {
|
||||
tokio_cmd
|
||||
}
|
||||
|
||||
/// Determines whether to use sidecar or system binary execution
|
||||
fn should_use_sidecar(claude_path: &str) -> bool {
|
||||
claude_path == "claude-code"
|
||||
}
|
||||
|
||||
/// Creates a sidecar command with the given arguments
|
||||
fn create_sidecar_command(
|
||||
app: &AppHandle,
|
||||
args: Vec<String>,
|
||||
project_path: &str,
|
||||
) -> Result<tauri_plugin_shell::process::Command, String> {
|
||||
let mut sidecar_cmd = app
|
||||
.shell()
|
||||
.sidecar("claude-code")
|
||||
.map_err(|e| format!("Failed to create sidecar command: {}", e))?;
|
||||
|
||||
// Add all arguments
|
||||
sidecar_cmd = sidecar_cmd.args(args);
|
||||
|
||||
// Set working directory
|
||||
sidecar_cmd = sidecar_cmd.current_dir(project_path);
|
||||
|
||||
// Pass through proxy environment variables if they exist (only uppercase)
|
||||
for (key, value) in std::env::vars() {
|
||||
if key == "HTTP_PROXY"
|
||||
|| key == "HTTPS_PROXY"
|
||||
|| key == "NO_PROXY"
|
||||
|| key == "ALL_PROXY"
|
||||
{
|
||||
log::debug!("Setting proxy env var for sidecar: {}={}", key, value);
|
||||
sidecar_cmd = sidecar_cmd.env(&key, &value);
|
||||
}
|
||||
}
|
||||
|
||||
Ok(sidecar_cmd)
|
||||
}
|
||||
|
||||
/// Creates a system binary command with the given arguments
|
||||
fn create_system_command(
|
||||
|
Reference in New Issue
Block a user