diff --git a/Cargo.lock b/Cargo.lock index bc10293acf6c..b36d3592a613 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4738,9 +4738,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.17.2" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c9fec5a4e89860383d778d10563a605838f8f0b2f9303868937e5ff32e86177" +checksum = "0ae8844f63b5b118e334e205585b8c5c17b984121dbdb179d44aeb087ffad3cb" dependencies = [ "crossbeam-channel", "dpi", @@ -4752,7 +4752,7 @@ dependencies = [ "objc2-core-foundation", "objc2-foundation 0.3.0", "once_cell", - "png 0.17.16", + "png 0.18.1", "serde", "thiserror 2.0.12", "windows-sys 0.60.2", @@ -9788,9 +9788,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.22.1" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9eb1da86bd0ab8931fad00650d2ba7473260c5bab06d6f24d04339edb88faa" +checksum = "1064cf4fbfa2c60f453e7a9125bc53add41de2d83d1cba7a497636e6520c345b" dependencies = [ "crossbeam-channel", "dirs 6.0.0", diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index f4381d54c1f0..6878c2b2adc8 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -550,7 +550,7 @@ ] }, "backgroundThrottling": { - "description": "Change the default background throttling behaviour.\n\n By default, browsers use a suspend policy that will throttle timers and even unload\n the whole tab (view) to free resources after roughly 5 minutes when a view became\n minimized or hidden. This will pause all tasks until the documents visibility state\n changes back from hidden to visible by bringing the view back to the foreground.\n\n ## Platform-specific\n\n - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice.\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n\n see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578", + "description": "Change the default background throttling behaviour.\n\n By default, browsers use a suspend policy that will throttle timers and even unload\n the whole tab (view) to free resources after roughly 5 minutes when a view became\n minimized or hidden. This will pause all tasks until the documents visibility state\n changes back from hidden to visible by bringing the view back to the foreground.\n\n ## Platform-specific\n\n - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice.\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n\n see ", "anyOf": [ { "$ref": "#/definitions/BackgroundThrottlingPolicy" @@ -1160,7 +1160,7 @@ ] }, { - "description": "Fluent UI style overlay scrollbars. **Windows Only**\n\n Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions,\n see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541", + "description": "Fluent UI style overlay scrollbars. **Windows Only**\n\n Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions,\n see ", "type": "string", "enum": [ "fluentOverlay" diff --git a/crates/tauri-plugin/src/lib.rs b/crates/tauri-plugin/src/lib.rs index 74c1fb941ed6..4c21a6af46ba 100644 --- a/crates/tauri-plugin/src/lib.rs +++ b/crates/tauri-plugin/src/lib.rs @@ -16,9 +16,9 @@ mod build; mod runtime; #[cfg(feature = "build")] -#[cfg_attr(docsrs, doc(feature = "build"))] +#[cfg_attr(docsrs, doc(cfg(feature = "build")))] pub use build::*; #[cfg(feature = "runtime")] -#[cfg_attr(docsrs, doc(feature = "runtime"))] +#[cfg_attr(docsrs, doc(cfg(feature = "runtime")))] #[allow(unused)] pub use runtime::*; diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs index d4f7e0145313..d7fb9c80f311 100644 --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -104,7 +104,7 @@ pub struct NewWindowOpener { pub webview: webkit2gtk::WebView, /// The instance of the webview that initiated the new window request. /// - /// The target webview environment **MUST** match the environment of the opener webview. See [`WebviewAttributes::environment`]. + /// The target webview environment **MUST** match the environment of the opener webview. See [`WebviewAttributes::with_environment`]. #[cfg(windows)] pub webview: webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2, #[cfg(windows)] @@ -167,7 +167,7 @@ pub enum NewWindowResponse { /// ## Platform-specific: /// /// **Linux**: The webview must be related to the caller webview. See [`WebviewAttributes::related_view`]. - /// **Windows**: The webview must use the same environment as the caller webview. See [`WebviewAttributes::environment`]. + /// **Windows**: The webview must use the same environment as the caller webview. See [`WebviewAttributes::with_environment`]. #[cfg(not(any(target_os = "android", target_os = "ios")))] Create { window_id: WindowId }, /// Deny the window from being opened. @@ -190,7 +190,7 @@ pub enum ScrollBarStyle { /// Fluent UI style overlay scrollbars. **Windows Only** /// /// Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions, - /// see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541 + /// see FluentOverlay, } @@ -802,7 +802,7 @@ impl WebviewAttributes { /// - **iOS**: Supported since version 17.0+. /// - **macOS**: Supported since version 14.0+. /// - /// see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 + /// see #[must_use] pub fn background_throttling(mut self, policy: Option) -> Self { self.background_throttling = policy; diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index f4381d54c1f0..6878c2b2adc8 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -550,7 +550,7 @@ ] }, "backgroundThrottling": { - "description": "Change the default background throttling behaviour.\n\n By default, browsers use a suspend policy that will throttle timers and even unload\n the whole tab (view) to free resources after roughly 5 minutes when a view became\n minimized or hidden. This will pause all tasks until the documents visibility state\n changes back from hidden to visible by bringing the view back to the foreground.\n\n ## Platform-specific\n\n - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice.\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n\n see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578", + "description": "Change the default background throttling behaviour.\n\n By default, browsers use a suspend policy that will throttle timers and even unload\n the whole tab (view) to free resources after roughly 5 minutes when a view became\n minimized or hidden. This will pause all tasks until the documents visibility state\n changes back from hidden to visible by bringing the view back to the foreground.\n\n ## Platform-specific\n\n - **Linux / Windows / Android**: Unsupported. Workarounds like a pending WebLock transaction might suffice.\n - **iOS**: Supported since version 17.0+.\n - **macOS**: Supported since version 14.0+.\n\n see ", "anyOf": [ { "$ref": "#/definitions/BackgroundThrottlingPolicy" @@ -1160,7 +1160,7 @@ ] }, { - "description": "Fluent UI style overlay scrollbars. **Windows Only**\n\n Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions,\n see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541", + "description": "Fluent UI style overlay scrollbars. **Windows Only**\n\n Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions,\n see ", "type": "string", "enum": [ "fluentOverlay" diff --git a/crates/tauri-schema-worker/src/config.rs b/crates/tauri-schema-worker/src/config.rs index f5daef987c32..a5274b89b781 100644 --- a/crates/tauri-schema-worker/src/config.rs +++ b/crates/tauri-schema-worker/src/config.rs @@ -5,8 +5,8 @@ use anyhow::Context; use axum::{ extract::Path, - http::{header, StatusCode}, - response::Result, + http::{header, HeaderValue, StatusCode}, + response::{IntoResponse, Result}, routing::get, Router, }; @@ -48,23 +48,26 @@ pub fn router() -> Router { .route("/config/{version}", get(schema_for_version)) } -async fn schema_for_version(Path(version): Path) -> Result { +async fn schema_for_version(Path(version): Path) -> Result { try_schema_for_version(version) .await + .map(JsonResponse) .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string())) .map_err(Into::into) } -async fn stable_schema() -> Result { +async fn stable_schema() -> Result { try_stable_schema() .await + .map(JsonResponse) .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string())) .map_err(Into::into) } -async fn next_schema() -> Result { +async fn next_schema() -> Result { try_next_schema() .await + .map(JsonResponse) .map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string())) .map_err(Into::into) } @@ -172,3 +175,18 @@ fn fetch_req(url: &str) -> anyhow::Result { ) .map_err(Into::into) } + +struct JsonResponse(String); + +impl IntoResponse for JsonResponse { + fn into_response(self) -> axum::response::Response { + ( + [( + header::CONTENT_TYPE, + HeaderValue::from_static("application/json"), + )], + self.0, + ) + .into_response() + } +} diff --git a/crates/tauri-utils/src/config.rs b/crates/tauri-utils/src/config.rs index e4aeee7ea797..78da42a4945d 100644 --- a/crates/tauri-utils/src/config.rs +++ b/crates/tauri-utils/src/config.rs @@ -1903,7 +1903,7 @@ pub enum ScrollBarStyle { /// Fluent UI style overlay scrollbars. **Windows Only** /// /// Requires WebView2 Runtime version 125.0.2535.41 or higher, does nothing on older versions, - /// see https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541 + /// see FluentOverlay, } @@ -2195,7 +2195,7 @@ pub struct WindowConfig { /// - **iOS**: Supported since version 17.0+. /// - **macOS**: Supported since version 14.0+. /// - /// see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 + /// see #[serde(default, alias = "background-throttling")] pub background_throttling: Option, /// Whether we should disable JavaScript code execution on the webview or not. diff --git a/crates/tauri/Cargo.toml b/crates/tauri/Cargo.toml index 0c9a9665c597..ba2329abc20c 100644 --- a/crates/tauri/Cargo.toml +++ b/crates/tauri/Cargo.toml @@ -26,6 +26,7 @@ features = [ "test", "specta", "dynamic-acl", + "isolation", ] default-target = "x86_64-unknown-linux-gnu" targets = [ @@ -86,11 +87,11 @@ cookie = "0.18" # desktop [target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_os = "windows", target_os = "macos"))'.dependencies] -muda = { version = "0.17", default-features = false, features = [ +muda = { version = "0.19", default-features = false, features = [ "serde", "gtk", ] } -tray-icon = { version = "0.22", default-features = false, features = [ +tray-icon = { version = "0.23", default-features = false, features = [ "serde", ], optional = true } diff --git a/crates/tauri/src/app.rs b/crates/tauri/src/app.rs index 8bd9df66ee8c..5b5bf5ae2e05 100644 --- a/crates/tauri/src/app.rs +++ b/crates/tauri/src/app.rs @@ -285,7 +285,7 @@ impl From for RunEvent { } } -/// The asset resolver is a helper to access the [`tauri_utils::assets::Assets`] interface. +/// The asset resolver is a helper to access the [`crate::Assets`] interface. #[derive(Debug, Clone)] pub struct AssetResolver { manager: Arc>, diff --git a/crates/tauri/src/image/mod.rs b/crates/tauri/src/image/mod.rs index 9dec4165802b..c25e98de5f29 100644 --- a/crates/tauri/src/image/mod.rs +++ b/crates/tauri/src/image/mod.rs @@ -194,7 +194,7 @@ impl JsImage { /// This will retrieve the image from the passed [`ResourceTable`] if it is [`JsImage::Resource`] /// and will return an error if it doesn't exist in the passed [`ResourceTable`] so make sure /// the passed [`ResourceTable`] is the same one used to store the image, usually this should be - /// the webview [resources table](crate::webview::Webview::resources_table). + /// the webview resources table. pub fn into_img(self, resources_table: &ResourceTable) -> crate::Result>> { match self { Self::Resource(rid) => resources_table.get::>(rid), diff --git a/crates/tauri/src/lib.rs b/crates/tauri/src/lib.rs index 38cbbc3a58ec..261f7e887de0 100644 --- a/crates/tauri/src/lib.rs +++ b/crates/tauri/src/lib.rs @@ -33,10 +33,10 @@ //! - **compression** *(enabled by default): Enables asset compression. You should only disable this if you want faster compile times in release builds - it produces larger binaries. //! - **config-json5**: Adds support to JSON5 format for `tauri.conf.json`. //! - **config-toml**: Adds support to TOML format for the configuration `Tauri.toml`. -//! - **image-ico**: Adds support to parse `.ico` image, see [`Image`]. -//! - **image-png**: Adds support to parse `.png` image, see [`Image`]. +//! - **image-ico**: Adds support to parse `.ico` image, see [`image::Image`]. +//! - **image-png**: Adds support to parse `.png` image, see [`image::Image`]. //! - **macos-proxy**: Adds support for [`WebviewBuilder::proxy_url`] on macOS. Requires macOS 14+. -//! - **specta**: Add support for [`specta::specta`](https://docs.rs/specta/%5E2.0.0-rc.9/specta/attr.specta.html) with Tauri arguments such as [`State`](crate::State), [`Window`](crate::Window) and [`AppHandle`](crate::AppHandle) +//! - **specta**: Add support for [`specta::specta`](https://docs.rs/specta/%5E2.0.0-rc.9/specta/attr.specta.html) with Tauri arguments such as [`State`], [`Window`] and [`AppHandle`] //! - **dynamic-acl** *(enabled by default)*: Enables you to add ACLs at runtime, notably it enables the [`Manager::add_capability`] function. //! //! ## Cargo allowlist features diff --git a/crates/tauri/src/resources/mod.rs b/crates/tauri/src/resources/mod.rs index d393bca6577a..3a65c3a6fd6f 100644 --- a/crates/tauri/src/resources/mod.rs +++ b/crates/tauri/src/resources/mod.rs @@ -140,7 +140,7 @@ impl ResourceTable { } /// Returns a reference counted pointer to the resource of the given `rid`. - /// If `rid` is not present, this function returns [`Error::BadResourceId`]. + /// If `rid` is not present, this function returns [`crate::Error::BadResourceId`]. pub fn get_any(&self, rid: ResourceId) -> crate::Result> { self .index diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs index b86eb01a223c..c30b8f040563 100644 --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -243,8 +243,8 @@ pub enum NewWindowResponse { /// /// ## Platform-specific: /// - /// **Linux**: The webview must be related to the caller webview. See [`WebviewBuilder::related_view`]. - /// **Windows**: The webview must use the same environment as the caller webview. See [`WebviewBuilder::environment`]. + /// **Linux**: The webview must be related to the caller webview. See [`WebviewBuilder::with_related_view`]. + /// **Windows**: The webview must use the same environment as the caller webview. See [`WebviewBuilder::with_environment`]. /// **macOS**: The webview must use the same webview configuration as the caller webview. See [`WebviewBuilder::with_webview_configuration`] and [`NewWindowFeatures::webview_configuration`]. Create { /// Window that was created. @@ -1146,7 +1146,7 @@ fn main() { /// - **iOS**: Supported since version 17.0+. /// - **macOS**: Supported since version 14.0+. /// - /// see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 + /// see #[must_use] pub fn background_throttling(mut self, policy: BackgroundThrottlingPolicy) -> Self { self.webview_attributes.background_throttling = Some(policy); @@ -1664,7 +1664,7 @@ tauri::Builder::default() "#### )] #[cfg(feature = "wry")] - #[cfg_attr(docsrs, doc(feature = "wry"))] + #[cfg_attr(docsrs, doc(cfg(feature = "wry")))] pub fn with_webview( &self, f: F, diff --git a/crates/tauri/src/webview/webview_window.rs b/crates/tauri/src/webview/webview_window.rs index 95bf67719399..8db5db27dbd3 100644 --- a/crates/tauri/src/webview/webview_window.rs +++ b/crates/tauri/src/webview/webview_window.rs @@ -938,6 +938,9 @@ impl> WebviewWindowBuilder<'_, R, M> { /// }); /// } /// ``` + /// + /// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E) + /// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap) #[must_use] pub fn initialization_script(mut self, script: impl Into) -> Self { self.webview_builder = self.webview_builder.initialization_script(script); @@ -980,6 +983,9 @@ impl> WebviewWindowBuilder<'_, R, M> { /// }); /// } /// ``` + /// + /// [addDocumentStartJavaScript]: https://developer.android.com/reference/androidx/webkit/WebViewCompat#addDocumentStartJavaScript(android.webkit.WebView,java.lang.String,java.util.Set%3Cjava.lang.String%3E) + /// [onPageStarted]: https://developer.android.com/reference/android/webkit/WebViewClient#onPageStarted(android.webkit.WebView,%20java.lang.String,%20android.graphics.Bitmap) #[must_use] pub fn initialization_script_for_all_frames(mut self, script: impl Into) -> Self { self.webview_builder = self @@ -1193,7 +1199,7 @@ impl> WebviewWindowBuilder<'_, R, M> { /// - **iOS**: Supported since version 17.0+. /// - **macOS**: Supported since version 14.0+. /// - /// see https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578 + /// see #[must_use] pub fn background_throttling(mut self, policy: BackgroundThrottlingPolicy) -> Self { self.webview_builder = self.webview_builder.background_throttling(policy); @@ -2195,7 +2201,7 @@ impl WebviewWindow { self.window.hide() } - /// Closes this window. It emits [`crate::RunEvent::CloseRequested`] first like a user-initiated close request so you can intercept it. + /// Closes this window. It emits [`crate::WindowEvent::CloseRequested`] first like a user-initiated close request so you can intercept it. pub fn close(&self) -> crate::Result<()> { self.window.close() } @@ -2349,7 +2355,7 @@ impl WebviewWindow { /// ``` #[allow(clippy::needless_doctest_main)] // To avoid a large diff #[cfg(feature = "wry")] - #[cfg_attr(docsrs, doc(feature = "wry"))] + #[cfg_attr(docsrs, doc(cfg(feature = "wry")))] pub fn with_webview( &self, f: F, diff --git a/crates/tauri/src/window/mod.rs b/crates/tauri/src/window/mod.rs index faaaca48b006..6be20288bd0c 100644 --- a/crates/tauri/src/window/mod.rs +++ b/crates/tauri/src/window/mod.rs @@ -1778,7 +1778,7 @@ impl Window { self.window.dispatcher.hide().map_err(Into::into) } - /// Closes this window. It emits [`crate::RunEvent::CloseRequested`] first like a user-initiated close request so you can intercept it. + /// Closes this window. It emits [`crate::WindowEvent::CloseRequested`] first like a user-initiated close request so you can intercept it. pub fn close(&self) -> crate::Result<()> { self.window.dispatcher.close().map_err(Into::into) }