diff --git a/crates-tauri/yaak-app/src/lib.rs b/crates-tauri/yaak-app/src/lib.rs index ceb6c309..48f6877e 100644 --- a/crates-tauri/yaak-app/src/lib.rs +++ b/crates-tauri/yaak-app/src/lib.rs @@ -1095,13 +1095,9 @@ async fn cmd_get_http_authentication_config( // Convert HashMap to serde_json::Value for rendering let values_json: serde_json::Value = serde_json::to_value(&values)?; - let rendered_json = render_json_value( - values_json, - environment_chain, - &cb, - &RenderOptions::return_empty(), - ) - .await?; + let rendered_json = + render_json_value(values_json, environment_chain, &cb, &RenderOptions::return_empty()) + .await?; // Convert back to HashMap let rendered_values: HashMap = serde_json::from_value(rendered_json)?; diff --git a/crates-tauri/yaak-app/src/notifications.rs b/crates-tauri/yaak-app/src/notifications.rs index 53a5c253..b75c844e 100644 --- a/crates-tauri/yaak-app/src/notifications.rs +++ b/crates-tauri/yaak-app/src/notifications.rs @@ -8,9 +8,9 @@ use serde::{Deserialize, Serialize}; use std::time::Instant; use tauri::{AppHandle, Emitter, Manager, Runtime, WebviewWindow}; use ts_rs::TS; +use yaak_api::yaak_api_client; use yaak_common::platform::get_os_str; use yaak_models::util::UpdateSource; -use yaak_api::yaak_api_client; // Check for updates every hour const MAX_UPDATE_CHECK_SECONDS: u64 = 60 * 60; diff --git a/crates-tauri/yaak-app/src/plugins_ext.rs b/crates-tauri/yaak-app/src/plugins_ext.rs index f3a0af5a..bc252e86 100644 --- a/crates-tauri/yaak-app/src/plugins_ext.rs +++ b/crates-tauri/yaak-app/src/plugins_ext.rs @@ -21,6 +21,7 @@ use tauri::{ }; use tokio::sync::Mutex; use ts_rs::TS; +use yaak_api::yaak_api_client; use yaak_models::models::Plugin; use yaak_models::util::UpdateSource; use yaak_plugins::api::{ @@ -31,7 +32,6 @@ use yaak_plugins::events::{Color, Icon, PluginContext, ShowToastRequest}; use yaak_plugins::install::{delete_and_uninstall, download_and_install}; use yaak_plugins::manager::PluginManager; use yaak_plugins::plugin_meta::get_plugin_meta; -use yaak_api::yaak_api_client; static EXITING: AtomicBool = AtomicBool::new(false); diff --git a/crates-tauri/yaak-app/src/uri_scheme.rs b/crates-tauri/yaak-app/src/uri_scheme.rs index d186bbfc..a9ecd182 100644 --- a/crates-tauri/yaak-app/src/uri_scheme.rs +++ b/crates-tauri/yaak-app/src/uri_scheme.rs @@ -8,11 +8,11 @@ use std::fs; use std::sync::Arc; use tauri::{AppHandle, Emitter, Manager, Runtime, Url}; use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind}; +use yaak_api::yaak_api_client; use yaak_models::util::generate_id; use yaak_plugins::events::{Color, ShowToastRequest}; use yaak_plugins::install::download_and_install; use yaak_plugins::manager::PluginManager; -use yaak_api::yaak_api_client; pub(crate) async fn handle_deep_link( app_handle: &AppHandle, diff --git a/crates-tauri/yaak-app/src/window_menu.rs b/crates-tauri/yaak-app/src/window_menu.rs index a84079dd..41491247 100644 --- a/crates-tauri/yaak-app/src/window_menu.rs +++ b/crates-tauri/yaak-app/src/window_menu.rs @@ -153,11 +153,8 @@ pub fn app_menu(app_handle: &AppHandle) -> tauri::Result> .build(app_handle)?, &MenuItemBuilder::with_id("dev.reset_size".to_string(), "Reset Size") .build(app_handle)?, - &MenuItemBuilder::with_id( - "dev.reset_size_16x9".to_string(), - "Resize to 16x9", - ) - .build(app_handle)?, + &MenuItemBuilder::with_id("dev.reset_size_16x9".to_string(), "Resize to 16x9") + .build(app_handle)?, &MenuItemBuilder::with_id( "dev.reset_size_16x10".to_string(), "Resize to 16x10", diff --git a/crates-tauri/yaak-license/src/license.rs b/crates-tauri/yaak-license/src/license.rs index 3f2c4aa3..93aeb200 100644 --- a/crates-tauri/yaak-license/src/license.rs +++ b/crates-tauri/yaak-license/src/license.rs @@ -7,11 +7,11 @@ use std::ops::Add; use std::time::Duration; use tauri::{AppHandle, Emitter, Manager, Runtime, WebviewWindow, is_dev}; use ts_rs::TS; +use yaak_api::yaak_api_client; use yaak_common::platform::get_os_str; use yaak_models::db_context::DbContext; use yaak_models::query_manager::QueryManager; use yaak_models::util::UpdateSource; -use yaak_api::yaak_api_client; /// Extension trait for accessing the QueryManager from Tauri Manager types. /// This is needed temporarily until all crates are refactored to not use Tauri. @@ -159,10 +159,8 @@ pub async fn deactivate_license(window: &WebviewWindow) -> Result let app_version = window.app_handle().package_info().version.to_string(); let client = yaak_api_client(&app_version)?; let path = format!("/licenses/activations/{}/deactivate", activation_id); - let payload = DeactivateLicenseRequestPayload { - app_platform: get_os_str().to_string(), - app_version, - }; + let payload = + DeactivateLicenseRequestPayload { app_platform: get_os_str().to_string(), app_version }; let response = client.post(build_url(&path)).json(&payload).send().await?; if response.status().is_client_error() { @@ -189,10 +187,8 @@ pub async fn deactivate_license(window: &WebviewWindow) -> Result pub async fn check_license(window: &WebviewWindow) -> Result { let app_version = window.app_handle().package_info().version.to_string(); - let payload = CheckActivationRequestPayload { - app_platform: get_os_str().to_string(), - app_version, - }; + let payload = + CheckActivationRequestPayload { app_platform: get_os_str().to_string(), app_version }; let activation_id = get_activation_id(window.app_handle()).await; let settings = window.db().get_settings(); diff --git a/crates/yaak-http/src/sender.rs b/crates/yaak-http/src/sender.rs index 911f2338..9928ee36 100644 --- a/crates/yaak-http/src/sender.rs +++ b/crates/yaak-http/src/sender.rs @@ -74,15 +74,31 @@ impl Display for HttpResponseEvent { }; write!(f, "* Redirect {} -> {} ({})", status, url, behavior_str) } - HttpResponseEvent::SendUrl { method, scheme, username, password, host, port, path, query, fragment } => { + HttpResponseEvent::SendUrl { + method, + scheme, + username, + password, + host, + port, + path, + query, + fragment, + } => { let auth_str = if username.is_empty() && password.is_empty() { String::new() } else { format!("{}:{}@", username, password) }; - let query_str = if query.is_empty() { String::new() } else { format!("?{}", query) }; - let fragment_str = if fragment.is_empty() { String::new() } else { format!("#{}", fragment) }; - write!(f, "> {} {}://{}{}:{}{}{}{}", method, scheme, auth_str, host, port, path, query_str, fragment_str) + let query_str = + if query.is_empty() { String::new() } else { format!("?{}", query) }; + let fragment_str = + if fragment.is_empty() { String::new() } else { format!("#{}", fragment) }; + write!( + f, + "> {} {}://{}{}:{}{}{}{}", + method, scheme, auth_str, host, port, path, query_str, fragment_str + ) } HttpResponseEvent::ReceiveUrl { version, status } => { write!(f, "< {} {}", version_to_str(version), status) @@ -122,7 +138,17 @@ impl From for yaak_models::models::HttpResponseEventData { RedirectBehavior::DropBody => "drop_body".to_string(), }, }, - HttpResponseEvent::SendUrl { method, scheme, username, password, host, port, path, query, fragment } => { + HttpResponseEvent::SendUrl { + method, + scheme, + username, + password, + host, + port, + path, + query, + fragment, + } => { D::SendUrl { method, scheme, username, password, host, port, path, query, fragment } } HttpResponseEvent::ReceiveUrl { version, status } => { @@ -546,7 +572,10 @@ impl SizedBody { impl HttpBody for SizedBody where - S: futures_util::Stream> + Send + Unpin + 'static, + S: futures_util::Stream> + + Send + + Unpin + + 'static, { type Data = Bytes; type Error = std::io::Error; diff --git a/crates/yaak-http/src/types.rs b/crates/yaak-http/src/types.rs index aee41313..3ca14e15 100644 --- a/crates/yaak-http/src/types.rs +++ b/crates/yaak-http/src/types.rs @@ -37,10 +37,9 @@ impl From for SendableBody { fn from(value: SendableBodyWithMeta) -> Self { match value { SendableBodyWithMeta::Bytes(b) => SendableBody::Bytes(b), - SendableBodyWithMeta::Stream { data, content_length } => SendableBody::Stream { - data, - content_length: content_length.map(|l| l as u64), - }, + SendableBodyWithMeta::Stream { data, content_length } => { + SendableBody::Stream { data, content_length: content_length.map(|l| l as u64) } + } } } }