From 3ddbd6aaa3447bb15a33669fe82a50e510523d61 Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 21 May 2024 11:36:44 -0300 Subject: [PATCH 1/2] feat: allow accessing the instrumentation server on any URL --- crates/devtools-core/src/server.rs | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/crates/devtools-core/src/server.rs b/crates/devtools-core/src/server.rs index b48e6973..9730f205 100644 --- a/crates/devtools-core/src/server.rs +++ b/crates/devtools-core/src/server.rs @@ -55,13 +55,8 @@ impl Server { let cors = CorsLayer::new() // allow `GET` and `POST` when accessing the resource .allow_methods([Method::GET, Method::POST]) - .allow_headers(AllowHeaders::any()); - - let cors = if option_env!("__DEVTOOLS_LOCAL_DEVELOPMENT").is_some() { - cors.allow_origin(tower_http::cors::Any) - } else { - cors.allow_origin(HeaderValue::from_str("https://devtools.crabnebula.dev").unwrap()) - }; + .allow_headers(AllowHeaders::any()) + .allow_origin(tower_http::cors::Any); let router = tonic::transport::Server::builder() .accept_http1(true) From 6f4d1511985366f2b14a1d661e86d4b3bd39349d Mon Sep 17 00:00:00 2001 From: Lucas Nogueira Date: Tue, 21 May 2024 13:05:03 -0300 Subject: [PATCH 2/2] clippy --- crates/devtools-core/src/server.rs | 1 - crates/devtools-v1/Cargo.lock | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/crates/devtools-core/src/server.rs b/crates/devtools-core/src/server.rs index 9730f205..62665393 100644 --- a/crates/devtools-core/src/server.rs +++ b/crates/devtools-core/src/server.rs @@ -9,7 +9,6 @@ use devtools_wire_format::sources::sources_server::SourcesServer; use devtools_wire_format::tauri::tauri_server; use devtools_wire_format::tauri::tauri_server::TauriServer; use futures::{FutureExt, TryStreamExt}; -use http::HeaderValue; use std::net::SocketAddr; use tokio::sync::mpsc; use tonic::codegen::http::Method; diff --git a/crates/devtools-v1/Cargo.lock b/crates/devtools-v1/Cargo.lock index 34f85b05..9a9b157d 100644 --- a/crates/devtools-v1/Cargo.lock +++ b/crates/devtools-v1/Cargo.lock @@ -649,7 +649,7 @@ dependencies = [ [[package]] name = "devtools-core" -version = "0.3.0" +version = "0.3.1" dependencies = [ "async-stream", "bytes", @@ -673,7 +673,7 @@ dependencies = [ [[package]] name = "devtools-wire-format" -version = "0.5.0" +version = "0.5.1" dependencies = [ "bitflags 2.5.0", "prost",