From 995a47fdb0e2b3d8e08bf12ec184cfffaf95eff3 Mon Sep 17 00:00:00 2001 From: Chris Tate Date: Thu, 26 Mar 2026 13:36:22 -0700 Subject: [PATCH] fix: use TCP instead of Unix socket on Windows in dashboard relay (#1038) `relay_command_to_daemon` in stream.rs used `tokio::net::UnixStream` unconditionally, which doesn't compile on Windows. Add platform- conditional code matching the existing pattern in daemon.rs and connection.rs: Unix sockets on unix, TCP on Windows. --- cli/src/connection.rs | 2 +- cli/src/native/stream.rs | 30 +++++++++++++++++++++--------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/cli/src/connection.rs b/cli/src/connection.rs index 41440f3..d734f9d 100644 --- a/cli/src/connection.rs +++ b/cli/src/connection.rs @@ -144,7 +144,7 @@ fn get_port_path(session: &str) -> PathBuf { } #[cfg(windows)] -fn get_port_for_session(session: &str) -> u16 { +pub fn get_port_for_session(session: &str) -> u16 { let mut hash: i32 = 0; for c in session.chars() { hash = ((hash << 5).wrapping_sub(hash)).wrapping_add(c as i32); diff --git a/cli/src/native/stream.rs b/cli/src/native/stream.rs index a5288db..31cd98f 100644 --- a/cli/src/native/stream.rs +++ b/cli/src/native/stream.rs @@ -10,6 +10,8 @@ use tokio::sync::{broadcast, watch, Mutex, Notify, RwLock}; use tokio_tungstenite::tungstenite::Message; use super::cdp::client::CdpClient; +#[cfg(windows)] +use crate::connection::get_port_for_session; use crate::connection::get_socket_dir; use crate::install::get_dashboard_dir; @@ -1183,7 +1185,7 @@ fn extract_http_body(request: &str) -> Option<&str> { .or_else(|| request.find("\n\n").map(|pos| &request[pos + 2..])) } -/// Relay a command JSON body to the daemon's Unix socket and return the response. +/// Relay a command JSON body to the daemon and return the response. async fn relay_command_to_daemon(session_name: &str, body: &str) -> Result { let mut cmd: Value = serde_json::from_str(body).map_err(|e| format!("Invalid JSON: {}", e))?; @@ -1198,17 +1200,27 @@ async fn relay_command_to_daemon(session_name: &str, body: &str) -> Result