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