Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
Seanaye/fix/tauri services ws (#2688)
Sean Aye4c1261ddc5ae
diff --git a/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs b/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rsindex 4ee7424d4a..4ed7fdf89c 100644--- a/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs+++ b/js/app/tauri/macro_bundle_updater_plugin/src/inbound/plugin.rs@@ -90,7 +90,7 @@ pub fn grant_bundle_update(}#[tauri::command]-#[tracing::instrument(err, skip(service, bundle_root))]+#[tracing::instrument(err, skip(service, bundle_root, app_handle))]pub fn perform_update<R: Runtime>(service: tauri::State<'_, Mutex<Service>>,bundle_root: tauri::State<'_, crate::BundleRoot>,diff --git a/js/app/tauri/src-tauri/src/lib.rs b/js/app/tauri/src-tauri/src/lib.rsindex 11e6755ae4..c2520f1ae4 100644--- a/js/app/tauri/src-tauri/src/lib.rs+++ b/js/app/tauri/src-tauri/src/lib.rs@@ -3,7 +3,7 @@ use macro_bundle_updater_plugin::BundleRoot;use navigation_plugin::MacroNavigationPlugin;use navigation_plugin::scheme::MacroScheme;use reqwest::cookie::CookieStore;-use reqwest::header::COOKIE;+use reqwest::header::{COOKIE, ORIGIN};use rootcause::{Report, report};use serde::Serialize;#[cfg(target_os = "ios")]@@ -179,7 +179,13 @@ pub fn run() {.plugin(MacroNavigationPlugin::new(ALLOWED_DOMAINS).expect("Domains must be valid urls")).plugin(macro_bundle_updater_plugin::inbound::plugin::MacroBundleUpdaterPlugin::new(- "http://localhost:3001/".parse().expect("valid url"),+ if cfg!(debug_assertions) {+ "https://auth-service-dev.macro.com/"+ } else {+ "https://auth-service.macro.com/"+ }+ .parse()+ .expect("valid url"),),);@@ -294,24 +300,29 @@ pub fn run() {/// fn to merge the headers from the http cookie store into the initial/// GET request to open a websocketfn merge_header_callback<R: Runtime>(url: String, headers: &mut HeaderMap, handle: &AppHandle<R>) {- tracing::trace!("got url {url}");let Some(s) = handle.try_state::<tauri_plugin_http::Http>() else {return;};- let Ok(mut url) = url.parse::<Url>() else {+ let Ok(mut parsed_url) = url.parse::<Url>() else {return;};- url.set_scheme(match url.scheme() {- "ws" => "http",- _ => "https",- })- .ok();- tracing::trace!("checking cookies for {url}");-- if let Some(cookie) = s.inner().cookies_jar.as_ref().cookies(&url) {- tracing::trace!("inserting cookie value for {url}, {cookie:?}");+ parsed_url+ .set_scheme(match parsed_url.scheme() {+ "ws" => "http",+ _ => "https",+ })+ .ok();+ tracing::trace!("checking cookies for {parsed_url}");++ if let Some(cookie) = s.inner().cookies_jar.as_ref().cookies(&parsed_url) {+ tracing::trace!("inserting cookie value for {parsed_url}");headers.insert(COOKIE, cookie);}++ // The API Gateway authorizer for services.macro.com validates Origin against an allowlist.+ if url.contains("services.macro.com") || url.contains("services-dev.macro.com") {+ headers.insert(ORIGIN, HeaderValue::from_static("https://macro.com"));+ }}trait AppChain {