port window ext from encryption PR

This commit is contained in:
Gregory Schier
2025-03-26 11:46:55 -07:00
parent 17657a4d04
commit ce885c3551
21 changed files with 119 additions and 101 deletions

View File

@@ -1,4 +1,4 @@
edition = "2018"
edition = "2024"
# Widths
chain_width = 100

34
src-tauri/Cargo.lock generated
View File

@@ -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",

View File

@@ -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" }

View File

@@ -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<R: Runtime>(
window
}
fn workspace_id_from_window<R: Runtime>(window: &WebviewWindow<R>) -> Option<String> {
let url = window.url().unwrap();
let re = Regex::new(r"/workspaces/(?<wid>\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<R: Runtime>(window: &WebviewWindow<R>) -> Option<Workspace> {
match workspace_id_from_window(&window) {
None => None,
Some(id) => window.db().get_workspace(&id).ok(),
}
}
fn environment_id_from_window<R: Runtime>(window: &WebviewWindow<R>) -> Option<String> {
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<R: Runtime>(window: &WebviewWindow<R>) -> Option<Environment> {
match environment_id_from_window(&window) {
None => None,
Some(id) => window.db().get_environment(&id).ok(),
}
}
fn cookie_jar_id_from_window<R: Runtime>(window: &WebviewWindow<R>) -> Option<String> {
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<R: Runtime>(window: &WebviewWindow<R>) -> Option<CookieJar> {
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())
}

View File

@@ -0,0 +1,9 @@
[package]
name = "yaak-common"
version = "0.1.0"
publish = false
edition = "2024"
[dependencies]
tauri = { workspace = true }
regex = "1.11.0"

View File

@@ -0,0 +1 @@
pub mod window;

View File

@@ -0,0 +1,31 @@
use regex::Regex;
use tauri::{Runtime, WebviewWindow};
pub trait WorkspaceWindowTrait {
fn workspace_id(&self) -> Option<String>;
fn cookie_jar_id(&self) -> Option<String>;
fn environment_id(&self) -> Option<String>;
}
impl<R: Runtime> WorkspaceWindowTrait for WebviewWindow<R> {
fn workspace_id(&self) -> Option<String> {
let url = self.url().unwrap();
let re = Regex::new(r"/workspaces/(?<id>\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<String> {
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<String> {
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())
}
}

View File

@@ -2,7 +2,7 @@
name = "yaak-git"
links = "yaak-git"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -1,7 +1,7 @@
[package]
name = "yaak-grpc"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -1,7 +1,7 @@
[package]
name = "yaak-http"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -2,7 +2,7 @@
name = "yaak-license"
links = "yaak-license"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -2,7 +2,7 @@
name = "yaak-models"
links = "yaak-models"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -1,7 +1,7 @@
[package]
name = "yaak-plugins"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -1,7 +1,7 @@
[package]
name = "yaak-sse"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -2,7 +2,7 @@
name = "yaak-sync"
links = "yaak-sync"
version = "0.1.0"
edition = "2021"
edition = "2024"
publish = false
[dependencies]

View File

@@ -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" }

View File

@@ -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"] }

View File

@@ -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',
)}
>

View File

@@ -530,7 +530,7 @@ const Menu = forwardRef<Omit<DropdownRef, 'open' | 'isOpen' | 'toggle' | 'items'
className={classNames(
className,
'h-auto bg-surface rounded-md shadow-lg py-1.5 border',
'border-border-subtle overflow-auto mx-0.5',
'border-border-subtle overflow-y-auto overflow-x-hidden mx-0.5',
)}
>
{filter && (

View File

@@ -140,21 +140,27 @@ export function SplitLayout({
[width, height, vertical, minHeightPx, setHeight, minWidthPx, setWidth],
);
const containerQueryReady = size.width > 0 || size.height > 0;
return (
<div ref={containerRef} className={classNames(className, 'grid w-full h-full')} style={styles}>
{firstSlot({ style: areaL, orientation: vertical ? 'vertical' : 'horizontal' })}
{secondSlot && (
<div ref={containerRef} style={styles} className={classNames(className, 'grid w-full h-full')}>
{containerQueryReady && (
<>
<ResizeHandle
style={areaD}
isResizing={isResizing}
className={classNames(vertical ? '-translate-y-1.5' : '-translate-x-1.5')}
onResizeStart={handleResizeStart}
onReset={handleReset}
side={vertical ? 'top' : 'left'}
justify="center"
/>
{secondSlot({ style: areaR, orientation: vertical ? 'vertical' : 'horizontal' })}
{firstSlot({ style: areaL, orientation: vertical ? 'vertical' : 'horizontal' })}
{secondSlot && (
<>
<ResizeHandle
style={areaD}
isResizing={isResizing}
className={classNames(vertical ? '-translate-y-1.5' : '-translate-x-1.5')}
onResizeStart={handleResizeStart}
onReset={handleReset}
side={vertical ? 'top' : 'left'}
justify="center"
/>
{secondSlot({ style: areaR, orientation: vertical ? 'vertical' : 'horizontal' })}
</>
)}
</>
)}
</div>

View File

@@ -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;
}
}