diff --git a/rustfmt.toml b/rustfmt.toml index 5e9e2206..5a985bac 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1,4 @@ -edition = "2018" +edition = "2024" # Widths chain_width = 100 diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index 1c5289a6..eabdbdd9 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -2848,9 +2848,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" dependencies = [ "value-bag", ] @@ -4680,9 +4680,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.22" +version = "0.23.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9263ab4eb695e42321db096e3b8fbd715a59b154d5c88d82db2175b681ba7" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ "once_cell", "ring", @@ -4717,15 +4717,15 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2bf47e6ff922db3825eb750c4e2ff784c6ff8fb9e13046ef6a1d1c5401b0b37" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" [[package]] name = "rustls-platform-verifier" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e012c45844a1790332c9386ed4ca3a06def221092eda277e6f079728f8ea99da" +checksum = "4a5467026f437b4cb2a533865eaa73eb840019a0916f4b9ec563c6e617e086c9" dependencies = [ "core-foundation 0.10.0", "core-foundation-sys", @@ -4739,7 +4739,7 @@ dependencies = [ "security-framework 3.2.0", "security-framework-sys", "webpki-root-certs", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4750,9 +4750,9 @@ checksum = "f87165f0995f63a9fbeea62b64d10b4d9d8e78ec6d7d51fb2125fda7bb36788f" [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.103.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" dependencies = [ "ring", "rustls-pki-types", @@ -7788,7 +7788,6 @@ dependencies = [ "objc", "openssl-sys", "rand 0.9.0", - "regex", "reqwest", "reqwest_cookie_store", "rustls", @@ -7811,6 +7810,7 @@ dependencies = [ "tokio", "tokio-stream", "uuid", + "yaak-common", "yaak-git", "yaak-grpc", "yaak-http", @@ -7823,6 +7823,14 @@ dependencies = [ "yaak-ws", ] +[[package]] +name = "yaak-common" +version = "0.1.0" +dependencies = [ + "regex", + "tauri", +] + [[package]] name = "yaak-git" version = "0.1.0" @@ -7972,7 +7980,6 @@ name = "yaak-templates" version = "0.1.0" dependencies = [ "base64 0.22.1", - "log", "serde", "serde_json", "thiserror 2.0.11", @@ -7984,7 +7991,6 @@ dependencies = [ name = "yaak-ws" version = "0.1.0" dependencies = [ - "chrono", "futures-util", "log", "md5", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 7ebea8c7..1bd1fa47 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -15,7 +15,7 @@ members = [ [package] name = "yaak-app" version = "0.0.0" -edition = "2021" +edition = "2024" authors = ["Gregory Schier"] publish = false @@ -34,6 +34,7 @@ cargo-clippy = [] tauri-build = { version = "2.1.0", features = [] } [target.'cfg(target_os = "macos")'.dependencies] +hex_color = "3.0.0" objc = "0.2.7" cocoa = "0.26.0" @@ -44,17 +45,15 @@ openssl-sys = { version = "0.9.105", features = ["vendored"] } # For Ubuntu inst chrono = { version = "0.4.31", features = ["serde"] } encoding_rs = "0.8.35" eventsource-client = { git = "https://github.com/yaakapp/rust-eventsource-client", version = "0.14.0" } -hex_color = "3.0.0" http = { version = "1.2.0", default-features = false } -log = "0.4.21" +log = "0.4.27" md5 = "0.7.0" mime_guess = "2.0.5" rand = "0.9.0" -regex = "1.10.2" reqwest = { workspace = true, features = ["multipart", "cookies", "gzip", "brotli", "deflate", "json", "rustls-tls-manual-roots-no-provider"] } reqwest_cookie_store = "0.8.0" -rustls = { version = "0.23.22", default-features = false, features = ["custom-provider", "ring"] } -rustls-platform-verifier = "0.5.0" +rustls = { version = "0.23.25", default-features = false, features = ["custom-provider", "ring"] } +rustls-platform-verifier = "0.5.1" serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true, features = ["raw_value"] } tauri = { workspace = true, features = ["devtools", "protocol-asset"] } @@ -68,10 +67,11 @@ tauri-plugin-shell = { workspace = true } tauri-plugin-single-instance = "2.2.2" tauri-plugin-updater = "2.6.1" tauri-plugin-window-state = "2.2.1" +thiserror = { workspace = true } tokio = { version = "1.43.0", features = ["sync"] } tokio-stream = "0.1.17" -thiserror = { workspace = true } uuid = "1.12.1" +yaak-common = { workspace = true } yaak-git = { path = "yaak-git" } yaak-grpc = { path = "yaak-grpc" } yaak-http = { workspace = true } @@ -92,9 +92,10 @@ tauri-plugin = "2.1.0" tauri-plugin-shell = "2.2.0" thiserror = "2.0.3" ts-rs = "10.0.0" +yaak-common = { path = "yaak-common" } yaak-http = { path = "yaak-http" } yaak-models = { path = "yaak-models" } yaak-plugins = { path = "yaak-plugins" } -yaak-sync = { path = "yaak-sync" } yaak-sse = { path = "yaak-sse" } +yaak-sync = { path = "yaak-sync" } yaak-templates = { path = "yaak-templates" } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 2c00bd68..30fc91fd 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -12,7 +12,6 @@ use crate::uri_scheme::handle_uri_scheme; use error::Result as YaakResult; use eventsource_client::{EventParser, SSE}; use log::{debug, error, warn}; -use regex::Regex; use std::collections::{BTreeMap, HashMap}; use std::fs::{create_dir_all, File}; use std::path::PathBuf; @@ -28,6 +27,7 @@ use tauri_plugin_window_state::{AppHandleExt, StateFlags}; use tokio::fs::read_to_string; use tokio::sync::Mutex; use tokio::task::block_in_place; +use yaak_common::window::WorkspaceWindowTrait; use yaak_grpc::manager::{DynamicMessage, GrpcHandle}; use yaak_grpc::{deserialize_message, serialize_message, Code, ServiceDefinition}; use yaak_models::models::{ @@ -1949,44 +1949,14 @@ fn get_window_from_window_context( window } -fn workspace_id_from_window(window: &WebviewWindow) -> Option { - let url = window.url().unwrap(); - let re = Regex::new(r"/workspaces/(?\w+)").unwrap(); - match re.captures(url.as_str()) { - None => None, - Some(captures) => captures.name("wid").map(|c| c.as_str().to_string()), - } -} - fn workspace_from_window(window: &WebviewWindow) -> Option { - match workspace_id_from_window(&window) { - None => None, - Some(id) => window.db().get_workspace(&id).ok(), - } -} - -fn environment_id_from_window(window: &WebviewWindow) -> Option { - let url = window.url().unwrap(); - let mut query_pairs = url.query_pairs(); - query_pairs.find(|(k, _v)| k == "environment_id").map(|(_k, v)| v.to_string()) + window.workspace_id().and_then(|id| window.db().get_workspace(&id).ok()) } fn environment_from_window(window: &WebviewWindow) -> Option { - match environment_id_from_window(&window) { - None => None, - Some(id) => window.db().get_environment(&id).ok(), - } -} - -fn cookie_jar_id_from_window(window: &WebviewWindow) -> Option { - let url = window.url().unwrap(); - let mut query_pairs = url.query_pairs(); - query_pairs.find(|(k, _v)| k == "cookie_jar_id").map(|(_k, v)| v.to_string()) + window.environment_id().and_then(|id| window.db().get_environment(&id).ok()) } fn cookie_jar_from_window(window: &WebviewWindow) -> Option { - match cookie_jar_id_from_window(&window) { - None => None, - Some(id) => window.db().get_cookie_jar(&id).ok(), - } + window.cookie_jar_id().and_then(|id| window.db().get_cookie_jar(&id).ok()) } diff --git a/src-tauri/yaak-common/Cargo.toml b/src-tauri/yaak-common/Cargo.toml new file mode 100644 index 00000000..8f95b229 --- /dev/null +++ b/src-tauri/yaak-common/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "yaak-common" +version = "0.1.0" +publish = false +edition = "2024" + +[dependencies] +tauri = { workspace = true } +regex = "1.11.0" diff --git a/src-tauri/yaak-common/src/lib.rs b/src-tauri/yaak-common/src/lib.rs new file mode 100644 index 00000000..d42d7dbe --- /dev/null +++ b/src-tauri/yaak-common/src/lib.rs @@ -0,0 +1 @@ +pub mod window; \ No newline at end of file diff --git a/src-tauri/yaak-common/src/window.rs b/src-tauri/yaak-common/src/window.rs new file mode 100644 index 00000000..60bcc076 --- /dev/null +++ b/src-tauri/yaak-common/src/window.rs @@ -0,0 +1,31 @@ +use regex::Regex; +use tauri::{Runtime, WebviewWindow}; + +pub trait WorkspaceWindowTrait { + fn workspace_id(&self) -> Option; + fn cookie_jar_id(&self) -> Option; + fn environment_id(&self) -> Option; +} + +impl WorkspaceWindowTrait for WebviewWindow { + fn workspace_id(&self) -> Option { + let url = self.url().unwrap(); + let re = Regex::new(r"/workspaces/(?\w+)").unwrap(); + match re.captures(url.as_str()) { + None => None, + Some(captures) => captures.name("id").map(|c| c.as_str().to_string()), + } + } + + fn cookie_jar_id(&self) -> Option { + let url = self.url().unwrap(); + let mut query_pairs = url.query_pairs(); + query_pairs.find(|(k, _v)| k == "cookie_jar_id").map(|(_k, v)| v.to_string()) + } + + fn environment_id(&self) -> Option { + let url = self.url().unwrap(); + let mut query_pairs = url.query_pairs(); + query_pairs.find(|(k, _v)| k == "environment_id").map(|(_k, v)| v.to_string()) + } +} diff --git a/src-tauri/yaak-git/Cargo.toml b/src-tauri/yaak-git/Cargo.toml index 28dc1bbc..1f293780 100644 --- a/src-tauri/yaak-git/Cargo.toml +++ b/src-tauri/yaak-git/Cargo.toml @@ -2,7 +2,7 @@ name = "yaak-git" links = "yaak-git" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-grpc/Cargo.toml b/src-tauri/yaak-grpc/Cargo.toml index 1d5fb0df..5cffe57f 100644 --- a/src-tauri/yaak-grpc/Cargo.toml +++ b/src-tauri/yaak-grpc/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "yaak-grpc" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-http/Cargo.toml b/src-tauri/yaak-http/Cargo.toml index 7efe6c23..40a6a2bc 100644 --- a/src-tauri/yaak-http/Cargo.toml +++ b/src-tauri/yaak-http/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "yaak-http" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-license/Cargo.toml b/src-tauri/yaak-license/Cargo.toml index 3602e6ba..a771d97a 100644 --- a/src-tauri/yaak-license/Cargo.toml +++ b/src-tauri/yaak-license/Cargo.toml @@ -2,7 +2,7 @@ name = "yaak-license" links = "yaak-license" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-models/Cargo.toml b/src-tauri/yaak-models/Cargo.toml index 8a7c5898..ce34844f 100644 --- a/src-tauri/yaak-models/Cargo.toml +++ b/src-tauri/yaak-models/Cargo.toml @@ -2,7 +2,7 @@ name = "yaak-models" links = "yaak-models" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-plugins/Cargo.toml b/src-tauri/yaak-plugins/Cargo.toml index 9f5e73fe..02fa40c2 100644 --- a/src-tauri/yaak-plugins/Cargo.toml +++ b/src-tauri/yaak-plugins/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "yaak-plugins" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-sse/Cargo.toml b/src-tauri/yaak-sse/Cargo.toml index 88b3652c..ba07e6f6 100644 --- a/src-tauri/yaak-sse/Cargo.toml +++ b/src-tauri/yaak-sse/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "yaak-sse" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-sync/Cargo.toml b/src-tauri/yaak-sync/Cargo.toml index 0d9871d2..a8f74ce0 100644 --- a/src-tauri/yaak-sync/Cargo.toml +++ b/src-tauri/yaak-sync/Cargo.toml @@ -2,7 +2,7 @@ name = "yaak-sync" links = "yaak-sync" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] diff --git a/src-tauri/yaak-templates/Cargo.toml b/src-tauri/yaak-templates/Cargo.toml index e960475a..312a367d 100644 --- a/src-tauri/yaak-templates/Cargo.toml +++ b/src-tauri/yaak-templates/Cargo.toml @@ -1,14 +1,13 @@ [package] name = "yaak-templates" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] base64 = "0.22.1" serde = { workspace = true, features = ["derive"] } serde_json = { workspace = true } -log = "0.4.22" thiserror = { workspace = true } tokio = { version = "1.39.3", features = ["macros", "rt"] } ts-rs = { version = "10.0.0" } diff --git a/src-tauri/yaak-ws/Cargo.toml b/src-tauri/yaak-ws/Cargo.toml index 2892125d..fcdd7d4f 100644 --- a/src-tauri/yaak-ws/Cargo.toml +++ b/src-tauri/yaak-ws/Cargo.toml @@ -2,7 +2,7 @@ name = "yaak-ws" links = "yaak-ws" version = "0.1.0" -edition = "2021" +edition = "2024" publish = false [dependencies] @@ -21,7 +21,6 @@ yaak-http = { workspace = true } yaak-plugins = { workspace = true } yaak-templates = { workspace = true } serde_json = "1.0.132" -chrono = "0.4.38" [build-dependencies] tauri-plugin = { workspace = true, features = ["build"] } diff --git a/src-web/components/GrpcConnectionSetupPane.tsx b/src-web/components/GrpcConnectionSetupPane.tsx index efc9015d..3397d1c5 100644 --- a/src-web/components/GrpcConnectionSetupPane.tsx +++ b/src-web/components/GrpcConnectionSetupPane.tsx @@ -208,6 +208,7 @@ export function GrpcConnectionSetupPane({ ref={urlContainerEl} className={classNames( 'grid grid-cols-[minmax(0,1fr)_auto] gap-1.5', + paneWidth === 0 && 'opacity-0', paneWidth < 400 && '!grid-cols-1', )} > diff --git a/src-web/components/core/Dropdown.tsx b/src-web/components/core/Dropdown.tsx index 97f6349a..99fefc40 100644 --- a/src-web/components/core/Dropdown.tsx +++ b/src-web/components/core/Dropdown.tsx @@ -530,7 +530,7 @@ const Menu = forwardRef {filter && ( diff --git a/src-web/components/core/SplitLayout.tsx b/src-web/components/core/SplitLayout.tsx index 99317a26..0ad4a64f 100644 --- a/src-web/components/core/SplitLayout.tsx +++ b/src-web/components/core/SplitLayout.tsx @@ -140,21 +140,27 @@ export function SplitLayout({ [width, height, vertical, minHeightPx, setHeight, minWidthPx, setWidth], ); + const containerQueryReady = size.width > 0 || size.height > 0; + return ( -
- {firstSlot({ style: areaL, orientation: vertical ? 'vertical' : 'horizontal' })} - {secondSlot && ( +
+ {containerQueryReady && ( <> - - {secondSlot({ style: areaR, orientation: vertical ? 'vertical' : 'horizontal' })} + {firstSlot({ style: areaL, orientation: vertical ? 'vertical' : 'horizontal' })} + {secondSlot && ( + <> + + {secondSlot({ style: areaR, orientation: vertical ? 'vertical' : 'horizontal' })} + + )} )}
diff --git a/src-web/main.css b/src-web/main.css index 00b85002..12bb477f 100644 --- a/src-web/main.css +++ b/src-web/main.css @@ -55,27 +55,22 @@ @apply text-left; } - ::-webkit-scrollbar, - ::-webkit-scrollbar-corner { - @apply w-[8px] h-[8px] bg-transparent; - } + :not(iframe) { + &::-webkit-scrollbar, + &::-webkit-scrollbar-corner { + @apply w-[8px] h-[8px] bg-transparent; + } - ::-webkit-scrollbar-track { - @apply bg-transparent; - } + &::-webkit-scrollbar-track { + @apply bg-transparent; + } - ::-webkit-scrollbar-thumb { - @apply bg-text-subtlest rounded-[4px] opacity-20; - } + &::-webkit-scrollbar-thumb { + @apply bg-text-subtlest rounded-[4px] opacity-20; + } - ::-webkit-scrollbar-thumb:hover { - @apply opacity-40 !important; - } - - iframe { - &::-webkit-scrollbar-corner, - &::-webkit-scrollbar { - @apply bg-surface-highlight !important; + &::-webkit-scrollbar-thumb:hover { + @apply opacity-40 !important; } }