Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/tauri-cli/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>",
"anyOf": [
{
"$ref": "#/definitions/BackgroundThrottlingPolicy"
Expand Down Expand Up @@ -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 <https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541>",
"type": "string",
"enum": [
"fluentOverlay"
Expand Down
4 changes: 2 additions & 2 deletions crates/tauri-plugin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
8 changes: 4 additions & 4 deletions crates/tauri-runtime/src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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.
Expand All @@ -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 <https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541>
FluentOverlay,
}

Expand Down Expand Up @@ -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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>
#[must_use]
pub fn background_throttling(mut self, policy: Option<BackgroundThrottlingPolicy>) -> Self {
self.background_throttling = policy;
Expand Down
4 changes: 2 additions & 2 deletions crates/tauri-schema-generator/schemas/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>",
"anyOf": [
{
"$ref": "#/definitions/BackgroundThrottlingPolicy"
Expand Down Expand Up @@ -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 <https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541>",
"type": "string",
"enum": [
"fluentOverlay"
Expand Down
28 changes: 23 additions & 5 deletions crates/tauri-schema-worker/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down Expand Up @@ -48,23 +48,26 @@ pub fn router() -> Router {
.route("/config/{version}", get(schema_for_version))
}

async fn schema_for_version(Path(version): Path<String>) -> Result<String> {
async fn schema_for_version(Path(version): Path<String>) -> Result<JsonResponse> {
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<String> {
async fn stable_schema() -> Result<JsonResponse> {
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<String> {
async fn next_schema() -> Result<JsonResponse> {
try_next_schema()
.await
.map(JsonResponse)
.map_err(|e| (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()))
.map_err(Into::into)
}
Expand Down Expand Up @@ -172,3 +175,18 @@ fn fetch_req(url: &str) -> anyhow::Result<worker::Request> {
)
.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()
}
}
4 changes: 2 additions & 2 deletions crates/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 <https://learn.microsoft.com/en-us/microsoft-edge/webview2/release-notes/?tabs=dotnetcsharp#10253541>
FluentOverlay,
}

Expand Down Expand Up @@ -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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>
#[serde(default, alias = "background-throttling")]
pub background_throttling: Option<BackgroundThrottlingPolicy>,
/// Whether we should disable JavaScript code execution on the webview or not.
Expand Down
5 changes: 3 additions & 2 deletions crates/tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ features = [
"test",
"specta",
"dynamic-acl",
"isolation",
]
default-target = "x86_64-unknown-linux-gnu"
targets = [
Expand Down Expand Up @@ -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 }

Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl From<EventLoopMessage> 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<R: Runtime> {
manager: Arc<AppManager<R>>,
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/src/image/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<Image<'_>>> {
match self {
Self::Resource(rid) => resources_table.get::<Image<'static>>(rid),
Expand Down
6 changes: 3 additions & 3 deletions crates/tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/src/resources/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arc<dyn Resource>> {
self
.index
Expand Down
8 changes: 4 additions & 4 deletions crates/tauri/src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ pub enum NewWindowResponse<R: Runtime> {
///
/// ## 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.
Expand Down Expand Up @@ -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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>
#[must_use]
pub fn background_throttling(mut self, policy: BackgroundThrottlingPolicy) -> Self {
self.webview_attributes.background_throttling = Some(policy);
Expand Down Expand Up @@ -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<F: FnOnce(PlatformWebview) + Send + 'static>(
&self,
f: F,
Expand Down
12 changes: 9 additions & 3 deletions crates/tauri/src/webview/webview_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,9 @@ impl<R: Runtime, M: Manager<R>> 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<String>) -> Self {
self.webview_builder = self.webview_builder.initialization_script(script);
Expand Down Expand Up @@ -980,6 +983,9 @@ impl<R: Runtime, M: Manager<R>> 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<String>) -> Self {
self.webview_builder = self
Expand Down Expand Up @@ -1193,7 +1199,7 @@ impl<R: Runtime, M: Manager<R>> 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 <https://github.com/tauri-apps/tauri/issues/5250#issuecomment-2569380578>
#[must_use]
pub fn background_throttling(mut self, policy: BackgroundThrottlingPolicy) -> Self {
self.webview_builder = self.webview_builder.background_throttling(policy);
Expand Down Expand Up @@ -2195,7 +2201,7 @@ impl<R: Runtime> WebviewWindow<R> {
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()
}
Expand Down Expand Up @@ -2349,7 +2355,7 @@ impl<R: Runtime> WebviewWindow<R> {
/// ```
#[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<F: FnOnce(crate::webview::PlatformWebview) + Send + 'static>(
&self,
f: F,
Expand Down
2 changes: 1 addition & 1 deletion crates/tauri/src/window/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1778,7 +1778,7 @@ impl<R: Runtime> Window<R> {
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)
}
Expand Down
Loading