diff --git a/.changes/cli-acl-subcommands.md b/.changes/cli-acl-subcommands.md new file mode 100644 index 000000000000..44895acfcef5 --- /dev/null +++ b/.changes/cli-acl-subcommands.md @@ -0,0 +1,12 @@ +--- +'tauri-cli': 'patch:feat' +'@tauri-apps/cli': 'patch:feat' +--- + +Add new subcommands for managing permissions and cababilities: + +- `tauri permission new` +- `tauri permission add` +- `tauri permission rm` +- `tauri permission ls` +- `tauri capability new` diff --git a/.changes/cli-plugins-migrate.md b/.changes/cli-plugins-migrate.md new file mode 100644 index 000000000000..be41341fad23 --- /dev/null +++ b/.changes/cli-plugins-migrate.md @@ -0,0 +1,6 @@ +--- +'tauri-cli': 'patch:enhance' +'@tauri-apps/cli': 'patch:enhance' +--- + +Add plugins to `Cargo.toml` when using `tauri migrate` diff --git a/.changes/csp-header-linux.md b/.changes/csp-header-linux.md new file mode 100644 index 000000000000..4ca673cc3986 --- /dev/null +++ b/.changes/csp-header-linux.md @@ -0,0 +1,7 @@ +--- +"tauri": patch:enhance +"tauri-utils": patch:enhance +"tauri-codegen": patch:enhance +--- + +Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead. diff --git a/.changes/fix-ios-dev-logs.md b/.changes/fix-ios-dev-logs.md new file mode 100644 index 000000000000..eaa22703a38f --- /dev/null +++ b/.changes/fix-ios-dev-logs.md @@ -0,0 +1,6 @@ +--- +"@tauri-apps/cli": patch:bug +"tauri-cli": patch:bug +--- + +Fixes process logs not showing on `ios dev`. diff --git a/.changes/fix-mobile-cmd-case.md b/.changes/fix-mobile-cmd-case.md new file mode 100644 index 000000000000..653e2c007327 --- /dev/null +++ b/.changes/fix-mobile-cmd-case.md @@ -0,0 +1,5 @@ +--- +"tauri": patch:bug +--- + +Convert the command name to camelCase when executing a mobile plugin command. diff --git a/.changes/pre.json b/.changes/pre.json index aa035e4bd8c0..3008512bf008 100644 --- a/.changes/pre.json +++ b/.changes/pre.json @@ -13,20 +13,25 @@ ".changes/capabilities-multiwebview.md", ".changes/capabilities-tauri-conf.md", ".changes/capability-context-refactor.md", + ".changes/cli-acl-subcommands.md", ".changes/cli-plugin-android-init.md", + ".changes/cli-plugins-migrate.md", ".changes/cli-windows-build-tools-detect-utf8.md", ".changes/codegen-capabilities-attribute.md", ".changes/context-runtime-authority.md", ".changes/core-center-window.md", ".changes/core-js-event-anytarget.md", ".changes/core-once-event-return-event-id.md", + ".changes/csp-header-linux.md", ".changes/downgrade-minisign.md", ".changes/enhance-resource-dir-resolution.md", ".changes/fix-capability-schema-definitions.md", ".changes/fix-codegen-rerun-if-changed.md", ".changes/fix-config-arg.md", ".changes/fix-invoke-devtools-by-hotkey.md", + ".changes/fix-ios-dev-logs.md", ".changes/fix-migrate-updater.md", + ".changes/fix-mobile-cmd-case.md", ".changes/fix-mobile-process-spawn.md", ".changes/fix-process-ipc-message-fn.md", ".changes/fix-rewrite-schema.md", @@ -40,8 +45,10 @@ ".changes/ios-signing-optional.md", ".changes/nsis-dpi-aware.md", ".changes/progress-bar-state-refactor.md", + ".changes/re-export-progress-bar-status.md", ".changes/refactor-capabilities-schema.md", ".changes/refactor-capability-remote-option.md", + ".changes/remove-app-custom-protocol-feature.md", ".changes/remove-unit-uri.md", ".changes/reparent.md", ".changes/rerun-if-permission-created.md", @@ -49,6 +56,7 @@ ".changes/rwh-06.md", ".changes/schema_str.md", ".changes/tauri-build-codegen-capabilities.md", + ".changes/tauri-build-dev-changes.md", ".changes/tauri-close-requested-target-specific.md", ".changes/tauri-error-sync.md", ".changes/tauri-plugin-identifier-alphanumeric.md", diff --git a/.changes/re-export-progress-bar-status.md b/.changes/re-export-progress-bar-status.md new file mode 100644 index 000000000000..edec293a28bd --- /dev/null +++ b/.changes/re-export-progress-bar-status.md @@ -0,0 +1,5 @@ +--- +'tauri': 'patch:bug' +--- + +Export `ProgressBarStatus`, regression introduced in `2.0.0-beta.4` diff --git a/.changes/remove-app-custom-protocol-feature.md b/.changes/remove-app-custom-protocol-feature.md new file mode 100644 index 000000000000..ffd7353aa0b6 --- /dev/null +++ b/.changes/remove-app-custom-protocol-feature.md @@ -0,0 +1,8 @@ +--- +"@tauri-apps/cli": patch:breaking +"tauri-cli": patch:breaking +"tauri": patch:breaking +"tauri-build": patch:breaking +--- + +The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`. diff --git a/.changes/tauri-build-dev-changes.md b/.changes/tauri-build-dev-changes.md new file mode 100644 index 000000000000..bcf4204f64b7 --- /dev/null +++ b/.changes/tauri-build-dev-changes.md @@ -0,0 +1,5 @@ +--- +"tauri-build": patch:breaking +--- + +Removed `tauri_build::CodegenContext::dev()` and added `tauri_build::dev()`. diff --git a/Cargo.lock b/Cargo.lock index 82a54d160b01..eb2abffd6c18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3616,7 +3616,7 @@ checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" [[package]] name = "tauri" -version = "2.0.0-beta.5" +version = "2.0.0-beta.7" dependencies = [ "anyhow", "bytes", @@ -3674,7 +3674,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "anyhow", "cargo_toml", @@ -3696,7 +3696,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "base64", "brotli", @@ -3733,7 +3733,7 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "heck", "proc-macro2", @@ -3745,7 +3745,7 @@ dependencies = [ [[package]] name = "tauri-plugin" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "anyhow", "glob", @@ -3760,7 +3760,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "gtk", "http", @@ -3776,7 +3776,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "cocoa", "gtk", @@ -3798,7 +3798,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "aes-gcm", "brotli", diff --git a/core/tauri-build/CHANGELOG.md b/core/tauri-build/CHANGELOG.md index 852dee289c85..1a96c8e811f8 100644 --- a/core/tauri-build/CHANGELOG.md +++ b/core/tauri-build/CHANGELOG.md @@ -1,5 +1,18 @@ # Changelog +## \[2.0.0-beta.5] + +### Breaking Changes + +- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`. +- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) Removed `tauri_build::CodegenContext::dev()` and added `tauri_build::dev()`. + + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` +- Upgraded to `tauri-codegen@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### Enhancements diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index b3ec29e85bef..4401a1025b23 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-build" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "build time code to pair with https://crates.io/crates/tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -28,8 +28,8 @@ rustdoc-args = [ "--cfg", "docsrs" ] [dependencies] anyhow = "1" quote = { version = "1", optional = true } -tauri-codegen = { version = "2.0.0-beta.4", path = "../tauri-codegen", optional = true } -tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils", features = [ "build", "resources" ] } +tauri-codegen = { version = "2.0.0-beta.5", path = "../tauri-codegen", optional = true } +tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils", features = [ "build", "resources" ] } cargo_toml = "0.17" serde = "1" serde_json = "1" diff --git a/core/tauri-build/src/codegen/context.rs b/core/tauri-build/src/codegen/context.rs index dc07c63b8fc4..857a2d498d3c 100644 --- a/core/tauri-build/src/codegen/context.rs +++ b/core/tauri-build/src/codegen/context.rs @@ -17,7 +17,6 @@ use tauri_utils::config::FrontendDist; #[cfg_attr(docsrs, doc(cfg(feature = "codegen")))] #[derive(Debug)] pub struct CodegenContext { - dev: bool, config_path: PathBuf, out_file: PathBuf, capabilities: Option>, @@ -26,7 +25,6 @@ pub struct CodegenContext { impl Default for CodegenContext { fn default() -> Self { Self { - dev: false, config_path: PathBuf::from("tauri.conf.json"), out_file: PathBuf::from("tauri-build-context.rs"), capabilities: None, @@ -68,14 +66,6 @@ impl CodegenContext { self } - /// Run the codegen in a `dev` context, meaning that Tauri is using a dev server or local file for development purposes, - /// usually with the `tauri dev` CLI command. - #[must_use] - pub fn dev(mut self) -> Self { - self.dev = true; - self - } - /// Adds a capability file to the generated context. #[must_use] pub fn capability>(mut self, path: P) -> Self { @@ -131,7 +121,7 @@ impl CodegenContext { ); let code = context_codegen(ContextData { - dev: self.dev, + dev: crate::dev(), config, config_parent, // it's very hard to have a build script for unit tests, so assume this is always called from diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 2042047aaf28..458b7d0281bf 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -15,7 +15,6 @@ use anyhow::Context; pub use anyhow::Result; use cargo_toml::Manifest; -use heck::AsShoutySnakeCase; use tauri_utils::{ acl::build::parse_capabilities, @@ -207,15 +206,6 @@ fn copy_frameworks(dest_dir: &Path, frameworks: &[String]) -> Result<()> { Ok(()) } -// checks if the given Cargo feature is enabled. -fn has_feature(feature: &str) -> bool { - // when a feature is enabled, Cargo sets the `CARGO_FEATURE_ bool { + std::env::var("DEP_TAURI_DEV") + .expect("missing `cargo:dev` instruction, please update tauri to latest") + == "true" +} + /// Run all build time helpers for your Tauri Application. /// /// The current helpers include the following: @@ -499,7 +495,7 @@ pub fn try_build(attributes: Attributes) -> Result<()> { mobile::generate_gradle_files(project_dir)?; } - cfg_alias("dev", !has_feature("custom-protocol")); + cfg_alias("dev", dev()); let ws_path = get_workspace_dir()?; let mut manifest = diff --git a/core/tauri-codegen/CHANGELOG.md b/core/tauri-codegen/CHANGELOG.md index 96fd612fcf44..4f46718a03f8 100644 --- a/core/tauri-codegen/CHANGELOG.md +++ b/core/tauri-codegen/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## \[2.0.0-beta.5] + +### Enhancements + +- [`bc5b5e67`](https://www.github.com/tauri-apps/tauri/commit/bc5b5e671a546512f823f1c157421b4c3311dfc0)([#8984](https://www.github.com/tauri-apps/tauri/pull/8984)) Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### Dependencies diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index 5356fdda33b0..51563e5b6ba6 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-codegen" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -20,7 +20,7 @@ quote = "1" syn = "2" serde = { version = "1", features = [ "derive" ] } serde_json = "1" -tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils", features = [ "build" ] } +tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils", features = [ "build" ] } thiserror = "1" walkdir = "2" brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] } diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index d371580bfc6f..3b48f247ae6d 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -40,7 +40,6 @@ pub struct ContextData { fn map_core_assets( options: &AssetOptions, - target: Target, ) -> impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError> { #[cfg(feature = "isolation")] let pattern = tauri_utils::html::PatternObject::from(&options.pattern); @@ -53,10 +52,6 @@ fn map_core_assets( if csp { let document = parse_html(String::from_utf8_lossy(input).into_owned()); - if target == Target::Linux { - ::tauri_utils::html::inject_csp_token(&document); - } - inject_nonce_token(&document, &dangerous_disable_asset_csp_modification); if dangerous_disable_asset_csp_modification.can_modify("script-src") { @@ -176,7 +171,7 @@ pub fn context_codegen(data: ContextData) -> Result EmbeddedAssets::new( files @@ -184,7 +179,7 @@ pub fn context_codegen(data: ContextData) -> Result>(), &options, - map_core_assets(&options, target), + map_core_assets(&options), )?, _ => unimplemented!(), }, diff --git a/core/tauri-macros/CHANGELOG.md b/core/tauri-macros/CHANGELOG.md index 9734d6e31cc2..415751e25bb0 100644 --- a/core/tauri-macros/CHANGELOG.md +++ b/core/tauri-macros/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` +- Upgraded to `tauri-codegen@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### Dependencies diff --git a/core/tauri-macros/Cargo.toml b/core/tauri-macros/Cargo.toml index 5f4da196d5e3..5ac640745847 100644 --- a/core/tauri-macros/Cargo.toml +++ b/core/tauri-macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-macros" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "Macros for the tauri crate." exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -20,8 +20,8 @@ proc-macro2 = { version = "1", features = [ "span-locations" ] } quote = "1" syn = { version = "2", features = [ "full" ] } heck = "0.4" -tauri-codegen = { version = "2.0.0-beta.4", default-features = false, path = "../tauri-codegen" } -tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils" } +tauri-codegen = { version = "2.0.0-beta.5", default-features = false, path = "../tauri-codegen" } +tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils" } [features] custom-protocol = [ ] diff --git a/core/tauri-plugin/CHANGELOG.md b/core/tauri-plugin/CHANGELOG.md index 42aacb6efe51..c694ff112990 100644 --- a/core/tauri-plugin/CHANGELOG.md +++ b/core/tauri-plugin/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### Dependencies diff --git a/core/tauri-plugin/Cargo.toml b/core/tauri-plugin/Cargo.toml index 06419b7b0ac9..542d99e5fc87 100644 --- a/core/tauri-plugin/Cargo.toml +++ b/core/tauri-plugin/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-plugin" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "Build script and runtime Tauri plugin definitions" authors = { workspace = true } homepage = { workspace = true } @@ -30,7 +30,7 @@ runtime = [ ] [dependencies] anyhow = { version = "1", optional = true } serde = { version = "1", optional = true } -tauri-utils = { version = "2.0.0-beta.4", default-features = false, path = "../tauri-utils" } +tauri-utils = { version = "2.0.0-beta.5", default-features = false, path = "../tauri-utils" } serde_json = { version = "1", optional = true } glob = { version = "0.3", optional = true } toml = { version = "0.8", optional = true } diff --git a/core/tauri-plugin/src/build/mod.rs b/core/tauri-plugin/src/build/mod.rs index a3f0dd297f88..de65ab6086ce 100644 --- a/core/tauri-plugin/src/build/mod.rs +++ b/core/tauri-plugin/src/build/mod.rs @@ -105,7 +105,7 @@ impl<'a> Builder<'a> { let _ = std::fs::remove_file(format!( "./permissions/{}/{}", acl::build::PERMISSION_SCHEMAS_FOLDER_NAME, - acl::build::PERMISSION_SCHEMA_FILE_NAME + acl::PERMISSION_SCHEMA_FILE_NAME )); let _ = std::fs::remove_file(autogenerated.join(acl::build::PERMISSION_DOCS_FILE_NAME)); } else { diff --git a/core/tauri-runtime-wry/CHANGELOG.md b/core/tauri-runtime-wry/CHANGELOG.md index 0bda19e8e41f..d9a103a76b53 100644 --- a/core/tauri-runtime-wry/CHANGELOG.md +++ b/core/tauri-runtime-wry/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` +- Upgraded to `tauri-runtime@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### New Features diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index e45f278fc14e..28335519e8be 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime-wry" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "Wry bindings to the Tauri runtime" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -15,8 +15,8 @@ rust-version = { workspace = true } [dependencies] wry = { version = "0.37", default-features = false, features = [ "file-drop", "protocol", "os-webview" ] } tao = { version = "0.26", default-features = false, features = [ "rwh_06" ] } -tauri-runtime = { version = "2.0.0-beta.4", path = "../tauri-runtime" } -tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils" } +tauri-runtime = { version = "2.0.0-beta.5", path = "../tauri-runtime" } +tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils" } raw-window-handle = "0.6" http = "0.2" url = "2" diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 4e1a34f1d0ee..fb1f5dfd118c 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -2723,6 +2723,15 @@ fn handle_user_message( } } Message::Webview(window_id, webview_id, webview_message) => { + #[cfg(any( + target_os = "macos", + windows, + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] if let WebviewMessage::Reparent(new_parent_window_id) = webview_message { let webview_handle = windows.0.borrow_mut().get_mut(&window_id).and_then(|w| { w.webviews @@ -2764,157 +2773,159 @@ fn handle_user_message( } } } - } else { - let webview_handle = windows.0.borrow().get(&window_id).map(|w| { - ( - w.inner.clone(), - w.webviews.iter().find(|w| w.id == webview_id).cloned(), - ) - }); - if let Some((Some(window), Some(webview))) = webview_handle { - match webview_message { - WebviewMessage::WebviewEvent(_) => { /* already handled */ } - WebviewMessage::SynthesizedWindowEvent(_) => { /* already handled */ } - WebviewMessage::Reparent(_window_id) => { /* already handled */ } - WebviewMessage::AddEventListener(id, listener) => { - webview - .webview_event_listeners - .lock() - .unwrap() - .insert(id, listener); - } - #[cfg(all(feature = "tracing", not(target_os = "android")))] - WebviewMessage::EvaluateScript(script, tx, span) => { - let _span = span.entered(); - if let Err(e) = webview.evaluate_script(&script) { - debug_eprintln!("{}", e); - } - tx.send(()).unwrap(); - } - #[cfg(not(all(feature = "tracing", not(target_os = "android"))))] - WebviewMessage::EvaluateScript(script) => { - if let Err(e) = webview.evaluate_script(&script) { - debug_eprintln!("{}", e); - } - } - WebviewMessage::Navigate(url) => webview.load_url(url.as_str()), - WebviewMessage::Print => { - let _ = webview.print(); - } - WebviewMessage::Close => { - windows.0.borrow_mut().get_mut(&window_id).map(|window| { - if let Some(i) = window.webviews.iter().position(|w| w.id == webview.id) { - window.webviews.remove(i); - } - window - }); - } - WebviewMessage::SetSize(size) => { - let mut bounds = webview.bounds(); - let size = size.to_logical(window.scale_factor()); - bounds.width = size.width; - bounds.height = size.height; - - if let Some(b) = &webview.bounds { - let window_size = window.inner_size(); - let mut bounds = b.lock().unwrap(); - bounds.width_rate = size.width as f32 / window_size.width as f32; - bounds.height_rate = size.height as f32 / window_size.height as f32; - } + return; + } - webview.set_bounds(bounds); - } - WebviewMessage::SetPosition(position) => { - let mut bounds = webview.bounds(); - let position = position.to_logical(window.scale_factor()); - bounds.x = position.x; - bounds.y = position.y; - - if let Some(b) = &webview.bounds { - let window_size = window.inner_size(); - let mut bounds = b.lock().unwrap(); - bounds.width_rate = position.x as f32 / window_size.width as f32; - bounds.height_rate = position.y as f32 / window_size.height as f32; - } + let webview_handle = windows.0.borrow().get(&window_id).map(|w| { + ( + w.inner.clone(), + w.webviews.iter().find(|w| w.id == webview_id).cloned(), + ) + }); + if let Some((Some(window), Some(webview))) = webview_handle { + match webview_message { + WebviewMessage::WebviewEvent(_) => { /* already handled */ } + WebviewMessage::SynthesizedWindowEvent(_) => { /* already handled */ } + WebviewMessage::Reparent(_window_id) => { /* already handled */ } + WebviewMessage::AddEventListener(id, listener) => { + webview + .webview_event_listeners + .lock() + .unwrap() + .insert(id, listener); + } - webview.set_bounds(bounds); + #[cfg(all(feature = "tracing", not(target_os = "android")))] + WebviewMessage::EvaluateScript(script, tx, span) => { + let _span = span.entered(); + if let Err(e) = webview.evaluate_script(&script) { + debug_eprintln!("{}", e); } - // Getters - WebviewMessage::Url(tx) => { - tx.send(webview.url().parse().unwrap()).unwrap(); + tx.send(()).unwrap(); + } + #[cfg(not(all(feature = "tracing", not(target_os = "android"))))] + WebviewMessage::EvaluateScript(script) => { + if let Err(e) = webview.evaluate_script(&script) { + debug_eprintln!("{}", e); } - WebviewMessage::Position(tx) => { - let bounds = webview.bounds(); - let position = - LogicalPosition::new(bounds.x, bounds.y).to_physical(window.scale_factor()); - tx.send(position).unwrap(); + } + WebviewMessage::Navigate(url) => webview.load_url(url.as_str()), + WebviewMessage::Print => { + let _ = webview.print(); + } + WebviewMessage::Close => { + windows.0.borrow_mut().get_mut(&window_id).map(|window| { + if let Some(i) = window.webviews.iter().position(|w| w.id == webview.id) { + window.webviews.remove(i); + } + window + }); + } + WebviewMessage::SetSize(size) => { + let mut bounds = webview.bounds(); + let size = size.to_logical(window.scale_factor()); + bounds.width = size.width; + bounds.height = size.height; + + if let Some(b) = &webview.bounds { + let window_size = window.inner_size(); + let mut bounds = b.lock().unwrap(); + bounds.width_rate = size.width as f32 / window_size.width as f32; + bounds.height_rate = size.height as f32 / window_size.height as f32; } - WebviewMessage::Size(tx) => { - let bounds = webview.bounds(); - let size = - LogicalSize::new(bounds.width, bounds.height).to_physical(window.scale_factor()); - tx.send(size).unwrap(); + + webview.set_bounds(bounds); + } + WebviewMessage::SetPosition(position) => { + let mut bounds = webview.bounds(); + let position = position.to_logical(window.scale_factor()); + bounds.x = position.x; + bounds.y = position.y; + + if let Some(b) = &webview.bounds { + let window_size = window.inner_size(); + let mut bounds = b.lock().unwrap(); + bounds.width_rate = position.x as f32 / window_size.width as f32; + bounds.height_rate = position.y as f32 / window_size.height as f32; } - WebviewMessage::SetFocus => { - webview.focus(); + + webview.set_bounds(bounds); + } + // Getters + WebviewMessage::Url(tx) => { + tx.send(webview.url().parse().unwrap()).unwrap(); + } + WebviewMessage::Position(tx) => { + let bounds = webview.bounds(); + let position = + LogicalPosition::new(bounds.x, bounds.y).to_physical(window.scale_factor()); + tx.send(position).unwrap(); + } + WebviewMessage::Size(tx) => { + let bounds = webview.bounds(); + let size = + LogicalSize::new(bounds.width, bounds.height).to_physical(window.scale_factor()); + tx.send(size).unwrap(); + } + WebviewMessage::SetFocus => { + webview.focus(); + } + WebviewMessage::WithWebview(f) => { + #[cfg(any( + target_os = "linux", + target_os = "dragonfly", + target_os = "freebsd", + target_os = "netbsd", + target_os = "openbsd" + ))] + { + f(webview.webview()); } - WebviewMessage::WithWebview(f) => { - #[cfg(any( - target_os = "linux", - target_os = "dragonfly", - target_os = "freebsd", - target_os = "netbsd", - target_os = "openbsd" - ))] - { - f(webview.webview()); - } - #[cfg(target_os = "macos")] - { - use wry::WebViewExtMacOS; - f(Webview { - webview: webview.webview(), - manager: webview.manager(), - ns_window: webview.ns_window(), - }); - } - #[cfg(target_os = "ios")] - { - use tao::platform::ios::WindowExtIOS; - use wry::WebViewExtIOS; - - f(Webview { - webview: webview.inner.webview(), - manager: webview.inner.manager(), - view_controller: window.ui_view_controller() as cocoa::base::id, - }); - } - #[cfg(windows)] - { - f(Webview { - controller: webview.controller(), - }); - } - #[cfg(target_os = "android")] - { - f(webview.handle()) - } + #[cfg(target_os = "macos")] + { + use wry::WebViewExtMacOS; + f(Webview { + webview: webview.webview(), + manager: webview.manager(), + ns_window: webview.ns_window(), + }); } + #[cfg(target_os = "ios")] + { + use tao::platform::ios::WindowExtIOS; + use wry::WebViewExtIOS; - #[cfg(any(debug_assertions, feature = "devtools"))] - WebviewMessage::OpenDevTools => { - webview.open_devtools(); + f(Webview { + webview: webview.inner.webview(), + manager: webview.inner.manager(), + view_controller: window.ui_view_controller() as cocoa::base::id, + }); } - #[cfg(any(debug_assertions, feature = "devtools"))] - WebviewMessage::CloseDevTools => { - webview.close_devtools(); + #[cfg(windows)] + { + f(Webview { + controller: webview.controller(), + }); } - #[cfg(any(debug_assertions, feature = "devtools"))] - WebviewMessage::IsDevToolsOpen(tx) => { - tx.send(webview.is_devtools_open()).unwrap(); + #[cfg(target_os = "android")] + { + f(webview.handle()) } } + + #[cfg(any(debug_assertions, feature = "devtools"))] + WebviewMessage::OpenDevTools => { + webview.open_devtools(); + } + #[cfg(any(debug_assertions, feature = "devtools"))] + WebviewMessage::CloseDevTools => { + webview.close_devtools(); + } + #[cfg(any(debug_assertions, feature = "devtools"))] + WebviewMessage::IsDevToolsOpen(tx) => { + tx.send(webview.is_devtools_open()).unwrap(); + } } } } diff --git a/core/tauri-runtime/CHANGELOG.md b/core/tauri-runtime/CHANGELOG.md index 5c607d5f720e..61e00e434752 100644 --- a/core/tauri-runtime/CHANGELOG.md +++ b/core/tauri-runtime/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-beta.5] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### New Features diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 7474c5b53dd5..a2375e65714e 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-runtime" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "Runtime for Tauri applications" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" @@ -29,7 +29,7 @@ targets = [ serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" thiserror = "1.0" -tauri-utils = { version = "2.0.0-beta.4", path = "../tauri-utils" } +tauri-utils = { version = "2.0.0-beta.5", path = "../tauri-utils" } http = "0.2.4" raw-window-handle = "0.6" url = { version = "2" } diff --git a/core/tauri-utils/CHANGELOG.md b/core/tauri-utils/CHANGELOG.md index d65e1e97398b..a3e80668f90b 100644 --- a/core/tauri-utils/CHANGELOG.md +++ b/core/tauri-utils/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.0-beta.5] + +### Enhancements + +- [`bc5b5e67`](https://www.github.com/tauri-apps/tauri/commit/bc5b5e671a546512f823f1c157421b4c3311dfc0)([#8984](https://www.github.com/tauri-apps/tauri/pull/8984)) Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead. + ## \[2.0.0-beta.4] ### Breaking Changes diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index 0621b4236dad..a97d9a9bbb70 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri-utils" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" description = "Utilities for Tauri" exclude = [ "CHANGELOG.md", "/target" ] readme = "README.md" diff --git a/core/tauri-utils/src/acl/build.rs b/core/tauri-utils/src/acl/build.rs index b922ce674529..3287337dc0f7 100644 --- a/core/tauri-utils/src/acl/build.rs +++ b/core/tauri-utils/src/acl/build.rs @@ -20,6 +20,7 @@ use schemars::{ use super::{ capability::{Capability, CapabilityFile}, plugin::PermissionFile, + PERMISSION_SCHEMA_FILE_NAME, }; /// Known name of the folder containing autogenerated permissions. @@ -37,9 +38,6 @@ pub const PERMISSION_FILE_EXTENSIONS: &[&str] = &["json", "toml"]; /// Known foldername of the permission schema files pub const PERMISSION_SCHEMAS_FOLDER_NAME: &str = "schemas"; -/// Known filename of the permission schema JSON file -pub const PERMISSION_SCHEMA_FILE_NAME: &str = "schema.json"; - /// Known filename of the permission documentation file pub const PERMISSION_DOCS_FILE_NAME: &str = "reference.md"; diff --git a/core/tauri-utils/src/acl/capability.rs b/core/tauri-utils/src/acl/capability.rs index e5dd69cfa7f4..927a317c91e6 100644 --- a/core/tauri-utils/src/acl/capability.rs +++ b/core/tauri-utils/src/acl/capability.rs @@ -57,6 +57,7 @@ pub struct Capability { #[serde(default)] pub description: String, /// Configure remote URLs that can use the capability permissions. + #[serde(default, skip_serializing_if = "Option::is_none")] pub remote: Option, /// Whether this capability is enabled for local app URLs or not. Defaults to `true`. #[serde(default = "default_capability_local")] @@ -74,7 +75,7 @@ pub struct Capability { /// List of permissions attached to this capability. Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`. pub permissions: Vec, /// Target platforms this capability applies. By default all platforms applies. - #[serde(default = "default_platforms")] + #[serde(default = "default_platforms", skip_serializing_if = "Vec::is_empty")] pub platforms: Vec, } diff --git a/core/tauri-utils/src/acl/mod.rs b/core/tauri-utils/src/acl/mod.rs index e354ef9eaebe..33affe0273ac 100644 --- a/core/tauri-utils/src/acl/mod.rs +++ b/core/tauri-utils/src/acl/mod.rs @@ -11,6 +11,9 @@ use thiserror::Error; pub use self::{identifier::*, value::*}; +/// Known filename of the permission schema JSON file +pub const PERMISSION_SCHEMA_FILE_NAME: &str = "schema.json"; + #[cfg(feature = "build")] pub mod build; pub mod capability; @@ -142,6 +145,12 @@ pub struct Scopes { pub deny: Option>, } +impl Scopes { + fn is_empty(&self) -> bool { + self.allow.is_none() && self.deny.is_none() + } +} + /// Descriptions of explicit privileges of commands. /// /// It can enable commands to be accessible in the frontend of the application. @@ -151,12 +160,14 @@ pub struct Scopes { #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] pub struct Permission { /// The version of the permission. + #[serde(skip_serializing_if = "Option::is_none")] pub version: Option, /// A unique identifier for the permission. pub identifier: String, /// Human-readable description of what the permission does. + #[serde(skip_serializing_if = "Option::is_none")] pub description: Option, /// Allowed or denied commands when using this permission. @@ -164,7 +175,7 @@ pub struct Permission { pub commands: Commands, /// Allowed or denied scoped when using this permission. - #[serde(default)] + #[serde(default, skip_serializing_if = "Scopes::is_empty")] pub scope: Scopes, } diff --git a/core/tauri-utils/src/acl/plugin.rs b/core/tauri-utils/src/acl/plugin.rs index 9f427651b675..63eec392f737 100644 --- a/core/tauri-utils/src/acl/plugin.rs +++ b/core/tauri-utils/src/acl/plugin.rs @@ -12,7 +12,7 @@ use serde::{Deserialize, Serialize}; /// The default permission set of the plugin. /// /// Works similarly to a permission with the "default" identifier. -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] pub struct DefaultPermission { /// The version of the permission. @@ -26,14 +26,14 @@ pub struct DefaultPermission { } /// Permission file that can define a default permission, a set of permissions or a list of inlined permissions. -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(schemars::JsonSchema))] pub struct PermissionFile { /// The default permission set for the plugin pub default: Option, /// A list of permissions sets defined - #[serde(default)] + #[serde(default, skip_serializing_if = "Vec::is_empty")] pub set: Vec, /// A list of inlined permissions diff --git a/core/tauri-utils/src/html.rs b/core/tauri-utils/src/html.rs index 082a5daadb99..09a6d07543cb 100644 --- a/core/tauri-utils/src/html.rs +++ b/core/tauri-utils/src/html.rs @@ -23,8 +23,6 @@ use crate::config::{DisabledCspModificationKind, PatternKind}; #[cfg(feature = "isolation")] use crate::pattern::isolation::IsolationJavascriptCodegen; -/// The token used on the CSP tag content. -pub const CSP_TOKEN: &str = "__TAURI_CSP__"; /// The token used for script nonces. pub const SCRIPT_NONCE_TOKEN: &str = "__TAURI_SCRIPT_NONCE__"; /// The token used for style nonces. @@ -168,11 +166,6 @@ pub fn inject_csp(document: &NodeRef, csp: &str) { }); } -/// Injects a content security policy token to the HTML. -pub fn inject_csp_token(document: &NodeRef) { - inject_csp(document, CSP_TOKEN) -} - fn create_csp_meta_tag(csp: &str) -> NodeRef { NodeRef::new_element( QualName::new(None, ns!(html), LocalName::from("meta")), @@ -298,12 +291,12 @@ mod tests { ]; for html in htmls { let document = kuchiki::parse_html().one(html); - super::inject_csp_token(&document); + let csp = "csp-string"; + super::inject_csp(&document, csp); assert_eq!( document.to_string(), format!( - r#""#, - super::CSP_TOKEN + r#""#, ) ); } diff --git a/core/tauri/CHANGELOG.md b/core/tauri/CHANGELOG.md index 5e3894ed1044..f66db9c2a454 100644 --- a/core/tauri/CHANGELOG.md +++ b/core/tauri/CHANGELOG.md @@ -1,5 +1,28 @@ # Changelog +### Breaking Changes + +- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`. + +## \[2.0.0-beta.7] + +### Enhancements + +- [`bc5b5e67`](https://www.github.com/tauri-apps/tauri/commit/bc5b5e671a546512f823f1c157421b4c3311dfc0)([#8984](https://www.github.com/tauri-apps/tauri/pull/8984)) Do not include a CSP tag in the application HTML and rely on the custom protocol response header instead. + +### Bug Fixes + +- [`6cb601d4`](https://www.github.com/tauri-apps/tauri/commit/6cb601d42e2af75aa818371b8b8f7d5b2e77dc90)([#8983](https://www.github.com/tauri-apps/tauri/pull/8983)) Convert the command name to camelCase when executing a mobile plugin command. +- [`60bf11ab`](https://www.github.com/tauri-apps/tauri/commit/60bf11abcbec8d0362aa256e2293985bfd62620f)([#8986](https://www.github.com/tauri-apps/tauri/pull/8986)) Export `ProgressBarStatus`, regression introduced in `2.0.0-beta.4` + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` +- Upgraded to `tauri-runtime@2.0.0-beta.5` +- Upgraded to `tauri-runtime-wry@2.0.0-beta.5` +- Upgraded to `tauri-macros@2.0.0-beta.5` +- Upgraded to `tauri-build@2.0.0-beta.5` + ## \[2.0.0-beta.6] ### Bug Fixes diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index fcc441729119..dd9d15182a3b 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tauri" -version = "2.0.0-beta.6" +version = "2.0.0-beta.7" description = "Make tiny, secure apps for all desktop platforms with Tauri" exclude = [ "/test", "/.scripts", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -50,10 +50,10 @@ uuid = { version = "1", features = [ "v4" ], optional = true } url = { version = "2.4" } anyhow = "1.0" thiserror = "1.0" -tauri-runtime = { version = "2.0.0-beta.4", path = "../tauri-runtime" } -tauri-macros = { version = "2.0.0-beta.4", path = "../tauri-macros" } -tauri-utils = { version = "2.0.0-beta.4", features = [ "resources" ], path = "../tauri-utils" } -tauri-runtime-wry = { version = "2.0.0-beta.4", path = "../tauri-runtime-wry", optional = true } +tauri-runtime = { version = "2.0.0-beta.5", path = "../tauri-runtime" } +tauri-macros = { version = "2.0.0-beta.5", path = "../tauri-macros" } +tauri-utils = { version = "2.0.0-beta.5", features = [ "resources" ], path = "../tauri-utils" } +tauri-runtime-wry = { version = "2.0.0-beta.5", path = "../tauri-runtime-wry", optional = true } getrandom = "0.2" serde_repr = "0.1" state = "0.6" @@ -111,8 +111,8 @@ swift-rs = "1.0.6" [build-dependencies] heck = "0.4" -tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.0-beta.4" } -tauri-utils = { path = "../tauri-utils/", version = "2.0.0-beta.4", features = [ "build" ] } +tauri-build = { path = "../tauri-build/", default-features = false, version = "2.0.0-beta.5" } +tauri-utils = { path = "../tauri-utils/", version = "2.0.0-beta.5", features = [ "build" ] } [dev-dependencies] proptest = "1.4.0" diff --git a/core/tauri/build.rs b/core/tauri/build.rs index 040e2e3fb7cd..422464a3fbde 100644 --- a/core/tauri/build.rs +++ b/core/tauri/build.rs @@ -206,8 +206,12 @@ fn alias(alias: &str, has_feature: bool) { } fn main() { - alias("custom_protocol", has_feature("custom-protocol")); - alias("dev", !has_feature("custom-protocol")); + let custom_protocol = has_feature("custom-protocol"); + let dev = !custom_protocol; + alias("custom_protocol", custom_protocol); + alias("dev", dev); + + println!("cargo:dev={}", dev); let target_os = std::env::var("CARGO_CFG_TARGET_OS").unwrap(); let mobile = target_os == "ios" || target_os == "android"; diff --git a/core/tauri/mobile/ios-api/Sources/Tauri/Logger.swift b/core/tauri/mobile/ios-api/Sources/Tauri/Logger.swift index 115359f8ffbe..686255b25fac 100644 --- a/core/tauri/mobile/ios-api/Sources/Tauri/Logger.swift +++ b/core/tauri/mobile/ios-api/Sources/Tauri/Logger.swift @@ -37,11 +37,19 @@ public class Logger { } public static func debug(_ items: Any..., category: String = "app") { + #if DEBUG + Logger.log(items, category: category, type: OSLogType.default) + #else Logger.log(items, category: category, type: OSLogType.debug) + #endif } public static func info(_ items: Any..., category: String = "app") { + #if DEBUG + Logger.log(items, category: category, type: OSLogType.default) + #else Logger.log(items, category: category, type: OSLogType.info) + #endif } public static func error(_ items: Any..., category: String = "app") { diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 35ad0de4166d..cf7ff53b1b99 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -71,7 +71,7 @@ true) const action = () => { - window.window.__TAURI_INTERNALS__.ipc({ + window.__TAURI_INTERNALS__.ipc({ cmd, callback, error, diff --git a/core/tauri/src/protocol/tauri.rs b/core/tauri/src/protocol/tauri.rs index d7629d7c4296..fa36fd6eca90 100644 --- a/core/tauri/src/protocol/tauri.rs +++ b/core/tauri/src/protocol/tauri.rs @@ -164,14 +164,6 @@ fn get_response( if let Some(handler) = &web_resource_request_handler { handler(request, &mut response); } - // if it's an HTML file, we need to set the CSP meta tag on Linux - #[cfg(target_os = "linux")] - if let Some(response_csp) = response.headers().get("Content-Security-Policy") { - let response_csp = String::from_utf8_lossy(response_csp.as_bytes()); - let html = String::from_utf8_lossy(response.body()); - let body = html.replacen(tauri_utils::html::CSP_TOKEN, &response_csp, 1); - *response.body_mut() = body.as_bytes().to_vec().into(); - } Ok(response) } diff --git a/core/tauri/src/webview/mod.rs b/core/tauri/src/webview/mod.rs index e01fbaea22aa..de225e53a525 100644 --- a/core/tauri/src/webview/mod.rs +++ b/core/tauri/src/webview/mod.rs @@ -1232,7 +1232,7 @@ fn main() { if let Err(e) = crate::plugin::mobile::run_command( plugin, &app_handle, - message.command, + heck::AsLowerCamelCase(message.command).to_string(), payload, move |response| match response { Ok(r) => resolver_.resolve(r), diff --git a/core/tauri/src/window/mod.rs b/core/tauri/src/window/mod.rs index dc7e37d36018..bf6edcc7606d 100644 --- a/core/tauri/src/window/mod.rs +++ b/core/tauri/src/window/mod.rs @@ -12,6 +12,9 @@ use tauri_runtime::{ }; pub use tauri_utils::{config::Color, WindowEffect as Effect, WindowEffectState as EffectState}; +#[cfg(desktop)] +pub use crate::runtime::ProgressBarStatus; + use crate::{ app::AppHandle, event::{Event, EventId, EventTarget}, @@ -1939,7 +1942,7 @@ tauri::Builder::default() #[derive(serde::Deserialize)] pub struct ProgressBarState { /// The progress bar status. - pub status: Option, + pub status: Option, /// The progress bar progress. This can be a value ranging from `0` to `100` pub progress: Option, } diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 1ae88bedf2c7..29d78a99b510 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -29,9 +29,9 @@ dependencies = [ [[package]] name = "aes" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" dependencies = [ "cfg-if", "cipher", @@ -93,9 +93,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -141,9 +141,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "api" @@ -274,15 +274,15 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "bytemuck" -version = "1.14.1" +version = "1.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2490600f404f2b94c167e31d3ed1d5f3c225a0f3b80230053b3e0b7b962bd9" +checksum = "a2ef034f05691a48569bd920a96c81b9d91bbad1ab5ac7c4616c1f6ef36cb79f" dependencies = [ "bytemuck_derive", ] @@ -295,7 +295,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -349,9 +349,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" +checksum = "694c8807f2ae16faecc43dc17d74b3eb042482789fd0eb64b39a2e04e087053f" dependencies = [ "serde", ] @@ -382,12 +382,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" [[package]] name = "cesu8" @@ -408,9 +405,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.6" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6100bc57b6209840798d95cb2775684849d332f7bd788db2a8c8caf7ef82a41a" +checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" dependencies = [ "smallvec", "target-lexicon", @@ -436,15 +433,15 @@ checksum = "77e53693616d3075149f4ead59bdeecd204ac6b8192d8969757601b74bddf00f" [[package]] name = "chrono" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" +checksum = "5bc015644b92d5890fab7489e49d21f879d5c990186827d42ec511919404f38b" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -465,30 +462,30 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.18" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.11.0", ] [[package]] name = "clap_lex" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" +checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" [[package]] name = "cocoa" @@ -599,9 +596,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.2" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" +checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" dependencies = [ "cfg-if", ] @@ -656,17 +653,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] name = "ctor" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30d2b3721e861707777e3195b0158f950ae6dc4a27e4d02ff9f67e3eb3de199e" +checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -680,9 +677,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc5d6b04b3fd0ba9926f945895de7d806260a2d7431ba82e7edaecb043c4c6b8" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -690,27 +687,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04e48a959bcd5c761246f5d090ebc2fbf7b9cd527a492b07a67510c108f1e7e3" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", - "strsim", - "syn 2.0.48", + "strsim 0.10.0", + "syn 2.0.51", ] [[package]] name = "darling_macro" -version = "0.20.5" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1545d67a2149e1d93b7e5c7752dce5a7426eb5d1357ddcfd89336b94444f77" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -802,7 +799,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -873,9 +870,9 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "dyn-clone" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545b22097d44f8a9581187cdf93de7a71e4722bf51200cfaba810865b49a495d" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" [[package]] name = "embed-resource" @@ -981,7 +978,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -1049,7 +1046,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -1326,7 +1323,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -1405,7 +1402,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -1420,7 +1417,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.2", + "indexmap 2.2.3", "slab", "tokio", "tokio-util", @@ -1447,9 +1444,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.5" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" +checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" [[package]] name = "hex" @@ -1586,9 +1583,9 @@ dependencies = [ [[package]] name = "image" -version = "0.24.8" +version = "0.24.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "034bbe799d1909622a74d1193aa50147769440040ff36cb2baa947609b0a4e23" +checksum = "5690139d2f55868e080017335e4b94cb7414274c74f1669c84fb5feba2c9f69d" dependencies = [ "bytemuck", "byteorder", @@ -1609,9 +1606,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.2" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1710,9 +1707,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -1979,9 +1976,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.11.4" +version = "0.11.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e406691fa7749604bbc7964bde28a300572d52621bb84540f6907c0f8fe08737" +checksum = "4c47e7625990fc1af2226ea4f34fb2412b03c12639fcb91868581eb3a6893453" dependencies = [ "cocoa", "crossbeam-channel", @@ -2054,9 +2051,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -2305,7 +2302,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -2349,9 +2346,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" [[package]] name = "plist" @@ -2360,7 +2357,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef" dependencies = [ "base64", - "indexmap 2.2.2", + "indexmap 2.2.3", "line-wrap", "quick-xml", "serde", @@ -2369,9 +2366,9 @@ dependencies = [ [[package]] name = "png" -version = "0.17.11" +version = "0.17.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f6c3c3e617595665b8ea2ff95a86066be38fb121ff920a9c0eb282abcd1da5a" +checksum = "06e4b0d3d1312775e782c86c91a111aa1f910cbb65e1337f9975b5f9a554b5e1" dependencies = [ "bitflags 1.3.2", "crc32fast", @@ -2718,9 +2715,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "safemem" @@ -2807,31 +2804,31 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -2847,9 +2844,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "itoa 1.0.10", "ryu", @@ -2864,7 +2861,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -2890,16 +2887,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b0ed1662c5a68664f45b76d18deb0e234aff37207086803165c961eb695e981" +checksum = "15d167997bd841ec232f5b2b8e0e26606df2e7caa4c31b95ea9ca52b200bd270" dependencies = [ "base64", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -2907,14 +2905,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.6.0" +version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568577ff0ef47b879f736cd66740e022f3672788cdf002a05a4e609ea5a6fb15" +checksum = "865f9743393e638991566a8b7a479043c2c8da94a33e0a31f18214c9cae0a64d" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -2998,12 +2996,12 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -3116,6 +3114,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "subtle" version = "2.5.0" @@ -3146,9 +3150,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" dependencies = [ "proc-macro2", "quote", @@ -3248,13 +3252,13 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" [[package]] name = "tauri" -version = "2.0.0-beta.4" +version = "2.0.0-beta.6" dependencies = [ "anyhow", "bytes", @@ -3305,7 +3309,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "anyhow", "cargo_toml", @@ -3327,7 +3331,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "base64", "brotli", @@ -3341,7 +3345,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.48", + "syn 2.0.51", "tauri-utils", "thiserror", "time", @@ -3352,19 +3356,19 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", "tauri-codegen", "tauri-utils", ] [[package]] name = "tauri-plugin" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "anyhow", "glob", @@ -3379,8 +3383,8 @@ dependencies = [ [[package]] name = "tauri-plugin-cli" -version = "2.0.0-beta.0" -source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#dac8b6331ca1a90df5e5dac27a209445fd6e5124" +version = "2.0.0-beta.1" +source = "git+https://github.com/tauri-apps/plugins-workspace?branch=v2#dc6d3321e5305fa8b7250553bd179cbee995998a" dependencies = [ "clap", "log", @@ -3404,7 +3408,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "gtk", "http", @@ -3420,7 +3424,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "cocoa", "gtk", @@ -3441,7 +3445,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-beta.3" +version = "2.0.0-beta.4" dependencies = [ "aes-gcm", "brotli", @@ -3502,29 +3506,29 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3670,7 +3674,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -3683,7 +3687,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.2", + "indexmap 2.2.3", "serde", "serde_spanned", "toml_datetime", @@ -3715,7 +3719,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -3759,9 +3763,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.11.2" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd26786733426b0bf632ebab410c162859a911f26c7c9e208b9e329a8ca94481" +checksum = "7a4d9ddd4a7c0f3b6862af1c4911b529a49db4ee89310d3a258859c2f5053fdd" dependencies = [ "cocoa", "core-graphics", @@ -3812,18 +3816,18 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "universal-hash" @@ -3950,9 +3954,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3960,24 +3964,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "877b9c3f61ceea0e56331985743b13f3d25c406a7098d45180fb5f09bc19ed97" dependencies = [ "cfg-if", "js-sys", @@ -3987,9 +3991,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3997,22 +4001,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "wasm-streams" @@ -4078,9 +4082,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "96565907687f7aceb35bc5fc03770a8a0471d82e479f25832f54a0e3f4b28446" dependencies = [ "js-sys", "wasm-bindgen", @@ -4152,7 +4156,7 @@ checksum = "ac1345798ecd8122468840bcdf1b95e5dc6d2206c5e4b0eafa078d061f59c9bc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -4240,7 +4244,7 @@ dependencies = [ "windows-core", "windows-implement", "windows-interface", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -4249,7 +4253,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -4260,7 +4264,7 @@ checksum = "12168c33176773b86799be25e2a2ba07c7aab9968b37541f1094dbd7a60c8946" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -4271,7 +4275,7 @@ checksum = "9d8dc32e0095a7eeccebd0e3f09e9509365ecb3fc6ac4d6f5f14a3f6392942d1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.51", ] [[package]] @@ -4298,7 +4302,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -4333,17 +4337,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -4352,7 +4356,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75aa004c988e080ad34aff5739c39d0312f4684699d6d71fc8a198d057b8b9b4" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -4369,9 +4373,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -4387,9 +4391,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -4405,9 +4409,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -4423,9 +4427,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -4441,9 +4445,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -4459,9 +4463,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -4477,15 +4481,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winnow" -version = "0.5.37" +version = "0.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cad8365489051ae9f054164e459304af2e7e9bb407c958076c8bf4aef52da5" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" dependencies = [ "memchr", ] diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index 0dcab204740e..490fd613a8b8 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -44,7 +44,7 @@ path = "../../../core/tauri" features = ["test"] [features] -custom-protocol = [ "tauri/custom-protocol" ] +prod = [ "tauri/custom-protocol" ] # default to small, optimized release binaries [profile.release] diff --git a/examples/api/src-tauri/build.rs b/examples/api/src-tauri/build.rs index da2b155edba6..25a74c1eb10e 100644 --- a/examples/api/src-tauri/build.rs +++ b/examples/api/src-tauri/build.rs @@ -3,14 +3,13 @@ // SPDX-License-Identifier: MIT fn main() { - let mut codegen = tauri_build::CodegenContext::new(); - if !cfg!(feature = "custom-protocol") { - codegen = codegen.dev(); - } - - tauri_build::try_build(tauri_build::Attributes::new().codegen(codegen).plugin( - "app-menu", - tauri_build::InlinedPlugin::new().commands(&["toggle", "popup"]), - )) + tauri_build::try_build( + tauri_build::Attributes::new() + .codegen(tauri_build::CodegenContext::new()) + .plugin( + "app-menu", + tauri_build::InlinedPlugin::new().commands(&["toggle", "popup"]), + ), + ) .expect("failed to run tauri-build"); } diff --git a/examples/api/src-tauri/tauri-plugin-sample/permissions/schemas/schema.json b/examples/api/src-tauri/tauri-plugin-sample/permissions/schemas/schema.json index 74919da73af8..79b1967f9192 100644 --- a/examples/api/src-tauri/tauri-plugin-sample/permissions/schemas/schema.json +++ b/examples/api/src-tauri/tauri-plugin-sample/permissions/schemas/schema.json @@ -17,7 +17,6 @@ }, "set": { "description": "A list of permissions sets defined", - "default": [], "type": "array", "items": { "$ref": "#/definitions/PermissionSet" @@ -132,7 +131,6 @@ }, "scope": { "description": "Allowed or denied scoped when using this permission.", - "default": {}, "allOf": [ { "$ref": "#/definitions/Scopes" diff --git a/examples/file-associations/src-tauri/Cargo.toml b/examples/file-associations/src-tauri/Cargo.toml index 79f85632c0c2..b12592efb407 100644 --- a/examples/file-associations/src-tauri/Cargo.toml +++ b/examples/file-associations/src-tauri/Cargo.toml @@ -15,5 +15,4 @@ tauri = { path = "../../../core/tauri", features = [] } url = "2" [features] -default = [ "custom-protocol" ] -custom-protocol = [ "tauri/custom-protocol" ] +default = [ "tauri/custom-protocol" ] diff --git a/examples/resources/src-tauri/Cargo.toml b/examples/resources/src-tauri/Cargo.toml index cb2f7e5fcfd7..4a06a2a3d5e4 100644 --- a/examples/resources/src-tauri/Cargo.toml +++ b/examples/resources/src-tauri/Cargo.toml @@ -12,6 +12,3 @@ tauri-build = { path = "../../../core/tauri-build", features = ["codegen"] } serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } tauri = { path = "../../../core/tauri" } - -[features] -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/examples/web/core/tauri/Cargo.toml b/examples/web/core/tauri/Cargo.toml index 68742c9f732f..b8273be74312 100644 --- a/examples/web/core/tauri/Cargo.toml +++ b/examples/web/core/tauri/Cargo.toml @@ -16,6 +16,3 @@ tauri-build = { path = "../../../../core/tauri-build", features = [] } api = { path = "../api" } tauri = { path = "../../../../core/tauri" } tauri-plugin-dialog = "2.0.0-alpha.7" - -[features] -custom-protocol = ["tauri/custom-protocol"] diff --git a/examples/workspace/src-tauri/Cargo.toml b/examples/workspace/src-tauri/Cargo.toml index 8d1bd8f2cf5f..a2f885961b00 100644 --- a/examples/workspace/src-tauri/Cargo.toml +++ b/examples/workspace/src-tauri/Cargo.toml @@ -17,6 +17,3 @@ serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } tauri = { workspace = true } core-api = { path = "../core" } - -[features] -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/api/src/webview.ts b/tooling/api/src/webview.ts index 3200ed72c960..f03fc7d96e86 100644 --- a/tooling/api/src/webview.ts +++ b/tooling/api/src/webview.ts @@ -93,9 +93,9 @@ export type WebviewLabel = string * import { Window } from "@tauri-apps/api/window" * import { Webview } from "@tauri-apps/api/webview" * - * // loading embedded asset: - * const appWindow = new Window('uniqueLabel') + * const appWindow = new Window('uniqueLabel'); * + * // loading embedded asset: * const webview = new Webview(appWindow, 'theUniqueLabel', { * url: 'path/to/page.html' * }); @@ -112,9 +112,9 @@ export type WebviewLabel = string * }); * * // emit an event to the backend - * await webview.emit("some event", "data"); + * await webview.emit("some-event", "data"); * // listen to an event from the backend - * const unlisten = await webview.listen("event name", e => {}); + * const unlisten = await webview.listen("event-name", e => {}); * unlisten(); * ``` * @@ -136,7 +136,7 @@ class Webview { * import { Window } from '@tauri-apps/api/window' * import { Webview } from '@tauri-apps/api/webview' * const appWindow = new Window('my-label') - * const webview = new Window(appWindow, 'my-label', { + * const webview = new Webview(appWindow, 'my-label', { * url: 'https://github.com/tauri-apps/tauri' * }); * webview.once('tauri://created', function () { diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index 4506f8541ce5..fa28d931c6ab 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -235,14 +235,9 @@ export type WindowLabel = string * * @example * ```typescript - * // loading embedded asset: - * const appWindow = new Window('theUniqueLabel', { - * url: 'path/to/page.html' - * }); - * // alternatively, load a remote URL: - * const appWindow = new Window('theUniqueLabel', { - * url: 'https://github.com/tauri-apps/tauri' - * }); + * import { Window } from "@tauri-apps/api/window" + * + * const appWindow = new Window('theUniqueLabel'); * * appWindow.once('tauri://created', function () { * // window successfully created @@ -252,9 +247,9 @@ export type WindowLabel = string * }); * * // emit an event to the backend - * await appWindow.emit("some event", "data"); + * await appWindow.emit("some-event", "data"); * // listen to an event from the backend - * const unlisten = await appWindow.listen("event name", e => {}); + * const unlisten = await appWindow.listen("event-name", e => {}); * unlisten(); * ``` * @@ -272,9 +267,7 @@ class Window { * @example * ```typescript * import { Window } from '@tauri-apps/api/window'; - * const appWindow = new Window('my-label', { - * url: 'https://github.com/tauri-apps/tauri' - * }); + * const appWindow = new Window('my-label'); * appWindow.once('tauri://created', function () { * // window successfully created * }); diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml b/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml index 62af8d0ff297..51d3c1ea18e5 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml +++ b/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml @@ -12,6 +12,3 @@ tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } tauri = { path = "../../../../../core/tauri", features = [] } - -[features] -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml b/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml index 42bf24fd8fcc..c331c77ba0c7 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml +++ b/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml @@ -12,6 +12,3 @@ tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } tauri = { path = "../../../../../core/tauri", features = [] } - -[features] -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/bench/tests/helloworld/src-tauri/Cargo.toml b/tooling/bench/tests/helloworld/src-tauri/Cargo.toml index 7192a5c7eef2..188e10a571ea 100644 --- a/tooling/bench/tests/helloworld/src-tauri/Cargo.toml +++ b/tooling/bench/tests/helloworld/src-tauri/Cargo.toml @@ -12,6 +12,3 @@ tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } tauri = { path = "../../../../../core/tauri", features = [] } - -[features] -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/bundler/CHANGELOG.md b/tooling/bundler/CHANGELOG.md index 7957a54f5ce0..5484278c230d 100644 --- a/tooling/bundler/CHANGELOG.md +++ b/tooling/bundler/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## \[2.0.1-beta.1] + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` + ## \[2.0.1-beta.0] ### Bug Fixes diff --git a/tooling/bundler/Cargo.toml b/tooling/bundler/Cargo.toml index df18e54150ce..215ce605e3f1 100644 --- a/tooling/bundler/Cargo.toml +++ b/tooling/bundler/Cargo.toml @@ -2,7 +2,7 @@ workspace = { } [package] name = "tauri-bundler" -version = "2.0.1-beta.0" +version = "2.0.1-beta.1" authors = [ "George Burton ", "Tauri Programme within The Commons Conservancy" @@ -17,7 +17,7 @@ rust-version = "1.70" exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ] [dependencies] -tauri-utils = { version = "2.0.0-beta.4", path = "../../core/tauri-utils", features = [ "resources" ] } +tauri-utils = { version = "2.0.0-beta.5", path = "../../core/tauri-utils", features = [ "resources" ] } image = "0.24.7" flate2 = "1.0" anyhow = "1.0" diff --git a/tooling/cli/CHANGELOG.md b/tooling/cli/CHANGELOG.md index 9c29fef38be1..33e84b331585 100644 --- a/tooling/cli/CHANGELOG.md +++ b/tooling/cli/CHANGELOG.md @@ -1,5 +1,34 @@ # Changelog +## \[2.0.0-beta.5] + +### New Features + +- [`06d63d67`](https://www.github.com/tauri-apps/tauri/commit/06d63d67a061459dd533ddcae755922427a6dfc5)([#8827](https://www.github.com/tauri-apps/tauri/pull/8827)) Add new subcommands for managing permissions and cababilities: + + - `tauri permission new` + - `tauri permission add` + - `tauri permission rm` + - `tauri permission ls` + - `tauri capability new` + +### Breaking Changes + +- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`. + +### Enhancements + +- [`9be314f0`](https://www.github.com/tauri-apps/tauri/commit/9be314f07a4ca5d14433d41919492f3e91b5536a)([#8951](https://www.github.com/tauri-apps/tauri/pull/8951)) Add plugins to `Cargo.toml` when using `tauri migrate` + +### Bug Fixes + +- [`cbd9755e`](https://www.github.com/tauri-apps/tauri/commit/cbd9755e0926a7e47e59deb50f4bb93d621791a5)([#8977](https://www.github.com/tauri-apps/tauri/pull/8977)) Fixes process logs not showing on `ios dev`. + +### Dependencies + +- Upgraded to `tauri-utils@2.0.0-beta.5` +- Upgraded to `tauri-bundler@2.0.1-beta.1` + ## \[2.0.0-beta.4] ### Bug Fixes diff --git a/tooling/cli/Cargo.lock b/tooling/cli/Cargo.lock index 00e6f11e663e..af3726d5c103 100644 --- a/tooling/cli/Cargo.lock +++ b/tooling/cli/Cargo.lock @@ -459,9 +459,9 @@ dependencies = [ [[package]] name = "cargo-mobile2" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099563294a8f548dc70c2e5aecf61039c54e2af64526c0af348f2da41a6da622" +checksum = "9b4151a9a0e09e3acc2695c326cfdcf0b5ce5b04ab617cea6405a085f639b001" dependencies = [ "colored", "core-foundation", @@ -4112,6 +4112,7 @@ version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ + "indexmap 2.2.3", "itoa 1.0.10", "ryu", "serde", @@ -4640,7 +4641,7 @@ dependencies = [ [[package]] name = "tauri-bundler" -version = "2.0.1-beta.0" +version = "2.0.1-beta.1" dependencies = [ "anyhow", "ar", @@ -4668,7 +4669,7 @@ dependencies = [ "strsim 0.10.0", "tar", "tauri-icns", - "tauri-utils 2.0.0-beta.4", + "tauri-utils 2.0.0-beta.5", "tempfile", "thiserror", "time", @@ -4682,7 +4683,7 @@ dependencies = [ [[package]] name = "tauri-cli" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "anyhow", "axum", @@ -4697,6 +4698,7 @@ dependencies = [ "ctrlc", "dialoguer", "duct", + "dunce", "env_logger", "glob", "handlebars 5.1.0", @@ -4733,11 +4735,11 @@ dependencies = [ "tauri-bundler", "tauri-icns", "tauri-utils 1.5.3", - "tauri-utils 2.0.0-beta.4", + "tauri-utils 2.0.0-beta.5", "thiserror", "tokio", "toml 0.8.10", - "toml_edit 0.21.1", + "toml_edit 0.22.6", "unicode-width", "ureq", "url", @@ -4799,7 +4801,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" dependencies = [ "aes-gcm", "ctor", @@ -5103,17 +5105,6 @@ dependencies = [ "winnow 0.5.40", ] -[[package]] -name = "toml_edit" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" -dependencies = [ - "indexmap 2.2.3", - "toml_datetime", - "winnow 0.5.40", -] - [[package]] name = "toml_edit" version = "0.22.6" diff --git a/tooling/cli/Cargo.toml b/tooling/cli/Cargo.toml index d5072a3f2617..c1476aea2d43 100644 --- a/tooling/cli/Cargo.toml +++ b/tooling/cli/Cargo.toml @@ -3,7 +3,7 @@ members = [ "node" ] [package] name = "tauri-cli" -version = "2.0.0-beta.4" +version = "2.0.0-beta.5" authors = [ "Tauri Programme within The Commons Conservancy" ] edition = "2021" rust-version = "1.70" @@ -39,7 +39,7 @@ name = "cargo-tauri" path = "src/main.rs" [dependencies] -cargo-mobile2 = { version = "0.10.2", default-features = false } +cargo-mobile2 = { version = "0.10.3", default-features = false } jsonrpsee = { version = "0.20", features = [ "server" ] } jsonrpsee-core = "0.20" jsonrpsee-client-transport = { version = "0.20", features = [ "ws" ] } @@ -49,17 +49,17 @@ sublime_fuzzy = "0.7" clap_complete = "4" clap = { version = "4.4", features = [ "derive", "env" ] } anyhow = "1.0" -tauri-bundler = { version = "2.0.1-beta.0", default-features = false, path = "../bundler" } +tauri-bundler = { version = "2.0.1-beta.1", default-features = false, path = "../bundler" } colored = "2.0" serde = { version = "1.0", features = [ "derive" ] } -serde_json = "1.0" +serde_json = { version = "1.0", features = [ "preserve_order" ] } notify = "6.1" notify-debouncer-mini = "0.4" shared_child = "1.0" duct = "0.13" -toml_edit = "0.21" +toml_edit = { version = "0.22", features = [ "serde" ] } json-patch = "1.2" -tauri-utils = { version = "2.0.0-beta.4", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } +tauri-utils = { version = "2.0.0-beta.5", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] } toml = "0.8" jsonschema = "0.17" @@ -93,6 +93,7 @@ itertools = "0.11" local-ip-address = "0.5" css-color = "0.2" resvg = "0.36.0" +dunce = "1" glob = "0.3" [target."cfg(windows)".dependencies] diff --git a/tooling/cli/metadata-v2.json b/tooling/cli/metadata-v2.json index 3ffa2d4e0684..aabdc38da649 100644 --- a/tooling/cli/metadata-v2.json +++ b/tooling/cli/metadata-v2.json @@ -1,9 +1,9 @@ { "cli.js": { - "version": "2.0.0-beta.4", + "version": "2.0.0-beta.6", "node": ">= 10.0.0" }, - "tauri": "2.0.0-beta.6", - "tauri-build": "2.0.0-beta.4", - "tauri-plugin": "2.0.0-beta.4" + "tauri": "2.0.0-beta.8", + "tauri-build": "2.0.0-beta.6", + "tauri-plugin": "2.0.0-beta.5" } diff --git a/tooling/cli/node/CHANGELOG.md b/tooling/cli/node/CHANGELOG.md index 3227a900bf24..94c0e8cdfa1d 100644 --- a/tooling/cli/node/CHANGELOG.md +++ b/tooling/cli/node/CHANGELOG.md @@ -1,5 +1,33 @@ # Changelog +## \[2.0.0-beta.5] + +### New Features + +- [`06d63d67`](https://www.github.com/tauri-apps/tauri/commit/06d63d67a061459dd533ddcae755922427a6dfc5)([#8827](https://www.github.com/tauri-apps/tauri/pull/8827)) Add new subcommands for managing permissions and cababilities: + + - `tauri permission new` + - `tauri permission add` + - `tauri permission rm` + - `tauri permission ls` + - `tauri capability new` + +### Breaking Changes + +- [`b9e6a018`](https://www.github.com/tauri-apps/tauri/commit/b9e6a01879d9233040f3d3fab11c59e70563da7e)([#8937](https://www.github.com/tauri-apps/tauri/pull/8937)) The `custom-protocol` Cargo feature is no longer required on your application and is now ignored. To check if running on production, use `#[cfg(not(dev))]` instead of `#[cfg(feature = "custom-protocol")]`. + +### Enhancements + +- [`9be314f0`](https://www.github.com/tauri-apps/tauri/commit/9be314f07a4ca5d14433d41919492f3e91b5536a)([#8951](https://www.github.com/tauri-apps/tauri/pull/8951)) Add plugins to `Cargo.toml` when using `tauri migrate` + +### Bug Fixes + +- [`cbd9755e`](https://www.github.com/tauri-apps/tauri/commit/cbd9755e0926a7e47e59deb50f4bb93d621791a5)([#8977](https://www.github.com/tauri-apps/tauri/pull/8977)) Fixes process logs not showing on `ios dev`. + +### Dependencies + +- Upgraded to `tauri-cli@2.0.0-beta.5` + ## \[2.0.0-beta.4] ### Bug Fixes diff --git a/tooling/cli/node/package.json b/tooling/cli/node/package.json index d1fedfa4747f..520262056e83 100644 --- a/tooling/cli/node/package.json +++ b/tooling/cli/node/package.json @@ -1,6 +1,6 @@ { "name": "@tauri-apps/cli", - "version": "2.0.0-beta.4", + "version": "2.0.0-beta.5", "description": "Command line interface for building Tauri apps", "funding": { "type": "opencollective", diff --git a/tooling/cli/src/acl/capability/mod.rs b/tooling/cli/src/acl/capability/mod.rs new file mode 100644 index 000000000000..8696dc1f619b --- /dev/null +++ b/tooling/cli/src/acl/capability/mod.rs @@ -0,0 +1,28 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use clap::{Parser, Subcommand}; + +use crate::Result; + +mod new; + +#[derive(Debug, Parser)] +#[clap(about = "Manage or create capabilities for your app")] +pub struct Cli { + #[clap(subcommand)] + command: Commands, +} + +#[derive(Subcommand, Debug)] +enum Commands { + #[clap(alias = "create")] + New(new::Options), +} + +pub fn command(cli: Cli) -> Result<()> { + match cli.command { + Commands::New(options) => new::command(options), + } +} diff --git a/tooling/cli/src/acl/capability/new.rs b/tooling/cli/src/acl/capability/new.rs new file mode 100644 index 000000000000..f7a81bb9e314 --- /dev/null +++ b/tooling/cli/src/acl/capability/new.rs @@ -0,0 +1,141 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::{collections::HashSet, path::PathBuf}; + +use clap::Parser; +use tauri_utils::acl::capability::{Capability, PermissionEntry}; + +use crate::{ + acl::FileFormat, + helpers::{app_paths::tauri_dir, prompts}, + Result, +}; + +#[derive(Debug, Parser)] +#[clap(about = "Create a new permission file")] +pub struct Options { + /// Capability identifier. + identifier: Option, + /// Capability description + #[clap(long)] + description: Option, + /// Capability windows + #[clap(long)] + windows: Option>, + /// Capability permissions + #[clap(long)] + permission: Option>, + /// Output file format. + #[clap(long, default_value_t = FileFormat::Json)] + format: FileFormat, + /// The output file. + #[clap(short, long)] + out: Option, +} + +pub fn command(options: Options) -> Result<()> { + let identifier = match options.identifier { + Some(i) => i, + None => prompts::input("What's the capability identifier?", None, false, false)?.unwrap(), + }; + + let description = match options.description { + Some(d) => Some(d), + None => prompts::input::("What's the capability description?", None, false, true)? + .and_then(|d| if d.is_empty() { None } else { Some(d) }), + }; + + let windows = match options.windows.map(FromIterator::from_iter) { + Some(w) => w, + None => prompts::input::( + "Which windows should be affected by this? (comma separated)", + Some("main".into()), + false, + false, + )? + .and_then(|d| { + if d.is_empty() { + None + } else { + Some(d.split(',').map(ToString::to_string).collect()) + } + }) + .unwrap_or_default(), + }; + + let permissions: HashSet = match options.permission.map(FromIterator::from_iter) { + Some(p) => p, + None => prompts::input::( + "What permissions to enable? (comma separated)", + None, + false, + true, + )? + .and_then(|p| { + if p.is_empty() { + None + } else { + Some(p.split(',').map(ToString::to_string).collect()) + } + }) + .unwrap_or_default(), + }; + + let capability = Capability { + identifier, + description: description.unwrap_or_default(), + remote: None, + local: true, + windows, + webviews: Vec::new(), + permissions: permissions + .into_iter() + .map(|p| { + PermissionEntry::PermissionRef( + p.clone() + .try_into() + .unwrap_or_else(|_| panic!("invalid permission {}", p)), + ) + }) + .collect(), + platforms: Vec::new(), + }; + + let path = match options.out { + Some(o) => o.canonicalize()?, + None => { + let dir = tauri_dir(); + let capabilities_dir = dir.join("capabilities"); + capabilities_dir.join(format!( + "{}.{}", + capability.identifier, + options.format.extension() + )) + } + }; + + if path.exists() { + let msg = format!( + "Capability already exists at {}", + dunce::simplified(&path).display() + ); + let overwrite = prompts::confirm(&format!("{msg}, overwrite?"), Some(false))?; + if overwrite { + std::fs::remove_file(&path)?; + } else { + anyhow::bail!(msg); + } + } + + if let Some(parent) = path.parent() { + std::fs::create_dir_all(parent)?; + } + + std::fs::write(&path, options.format.serialize(&capability)?)?; + + log::info!(action = "Created"; "capability at {}", dunce::simplified(&path).display()); + + Ok(()) +} diff --git a/tooling/cli/src/acl/mod.rs b/tooling/cli/src/acl/mod.rs new file mode 100644 index 000000000000..a6f987b45799 --- /dev/null +++ b/tooling/cli/src/acl/mod.rs @@ -0,0 +1,41 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use serde::Serialize; +use std::fmt::Display; + +pub mod capability; +pub mod permission; + +#[derive(Debug, clap::ValueEnum, Clone)] +enum FileFormat { + Json, + Toml, +} + +impl Display for FileFormat { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + Self::Json => write!(f, "json"), + Self::Toml => write!(f, "toml"), + } + } +} + +impl FileFormat { + pub fn extension(&self) -> &'static str { + match self { + Self::Json => "json", + Self::Toml => "toml", + } + } + + pub fn serialize(&self, s: &S) -> crate::Result { + let contents = match self { + Self::Json => serde_json::to_string_pretty(s)?, + Self::Toml => toml_edit::ser::to_string_pretty(s)?, + }; + Ok(contents) + } +} diff --git a/tooling/cli/src/acl/permission/add.rs b/tooling/cli/src/acl/permission/add.rs new file mode 100644 index 000000000000..bd724bd6e63f --- /dev/null +++ b/tooling/cli/src/acl/permission/add.rs @@ -0,0 +1,147 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::Path; + +use clap::Parser; + +use crate::{ + helpers::{app_paths::tauri_dir_opt, prompts}, + Result, +}; + +#[derive(Clone)] +enum TomlOrJson { + Toml(toml_edit::Document), + Json(serde_json::Value), +} + +impl TomlOrJson { + fn identifier(&self) -> &str { + match self { + TomlOrJson::Toml(t) => t + .get("identifier") + .and_then(|k| k.as_str()) + .unwrap_or_default(), + TomlOrJson::Json(j) => j + .get("identifier") + .and_then(|k| k.as_str()) + .unwrap_or_default(), + } + } + + fn insert_permission(&mut self, idenitifer: String) { + match self { + TomlOrJson::Toml(t) => { + let permissions = t.entry("permissions").or_insert_with(|| { + toml_edit::Item::Value(toml_edit::Value::Array(toml_edit::Array::new())) + }); + if let Some(permissions) = permissions.as_array_mut() { + permissions.push(idenitifer) + }; + } + + TomlOrJson::Json(j) => { + if let Some(o) = j.as_object_mut() { + let permissions = o + .entry("permissions") + .or_insert_with(|| serde_json::Value::Array(Vec::new())); + if let Some(permissions) = permissions.as_array_mut() { + permissions.push(serde_json::Value::String(idenitifer)) + }; + } + } + }; + } + + fn to_string(&self) -> Result { + Ok(match self { + TomlOrJson::Toml(t) => t.to_string(), + TomlOrJson::Json(j) => serde_json::to_string_pretty(&j)?, + }) + } +} + +fn capability_from_path>(path: P) -> Option { + match path.as_ref().extension().and_then(|o| o.to_str()) { + Some("toml") => std::fs::read_to_string(&path) + .ok() + .and_then(|c| c.parse::().ok()) + .map(TomlOrJson::Toml), + Some("json") => std::fs::read(&path) + .ok() + .and_then(|c| serde_json::from_slice::(&c).ok()) + .map(TomlOrJson::Json), + _ => None, + } +} + +#[derive(Debug, Parser)] +#[clap(about = "Add a permission to capabilities")] +pub struct Options { + /// Permission to remove. + identifier: String, + /// Capability to add the permission to. + capability: Option, +} + +pub fn command(options: Options) -> Result<()> { + let dir = match tauri_dir_opt() { + Some(t) => t, + None => std::env::current_dir()?, + }; + + let capabilities_dir = dir.join("capabilities"); + if !capabilities_dir.exists() { + anyhow::bail!( + "Couldn't find capabilities directory at {}", + dunce::simplified(&capabilities_dir).display() + ); + } + + let capabilities = std::fs::read_dir(&capabilities_dir)? + .flatten() + .filter(|e| e.file_type().map(|e| e.is_file()).unwrap_or_default()) + .filter_map(|e| { + let path = e.path(); + capability_from_path(&path).and_then(|capability| match &options.capability { + Some(c) => (c == capability.identifier()).then_some((capability, path)), + None => Some((capability, path)), + }) + }) + .collect::>(); + + let mut capabilities = if capabilities.len() > 1 { + let selections = prompts::multiselect( + "Choose which capabilities to add the permission to:", + capabilities + .iter() + .map(|(c, p)| { + let id = c.identifier(); + if id.is_empty() { + dunce::simplified(p).to_str().unwrap_or_default() + } else { + id + } + }) + .collect::>() + .as_slice(), + None, + )?; + selections + .into_iter() + .map(|idx| capabilities[idx].clone()) + .collect() + } else { + capabilities + }; + + for (capability, path) in &mut capabilities { + capability.insert_permission(options.identifier.clone()); + std::fs::write(&path, capability.to_string()?)?; + log::info!(action = "Added"; "permission `{}` to `{}` at {}", options.identifier, capability.identifier(), dunce::simplified(path).display()); + } + + Ok(()) +} diff --git a/tooling/cli/src/acl/permission/ls.rs b/tooling/cli/src/acl/permission/ls.rs new file mode 100644 index 000000000000..499a9f4f603a --- /dev/null +++ b/tooling/cli/src/acl/permission/ls.rs @@ -0,0 +1,148 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use clap::Parser; + +use crate::{helpers::app_paths::tauri_dir, Result}; +use colored::Colorize; +use tauri_utils::acl::plugin::Manifest; + +use std::{collections::BTreeMap, fs::read_to_string}; + +#[derive(Debug, Parser)] +#[clap(about = "List permissions available to your application")] +pub struct Options { + /// Name of the plugin to list permissions. + plugin: Option, + /// Permission identifier filter. + #[clap(short, long)] + filter: Option, +} + +pub fn command(options: Options) -> Result<()> { + let tauri_dir = tauri_dir(); + let plugin_manifests_path = tauri_dir + .join("gen") + .join("schemas") + .join("plugin-manifests.json"); + + if plugin_manifests_path.exists() { + let plugin_manifest_json = read_to_string(&plugin_manifests_path)?; + let acl = serde_json::from_str::>(&plugin_manifest_json)?; + + for (plugin, manifest) in acl { + if options + .plugin + .as_ref() + .map(|p| p != &plugin) + .unwrap_or_default() + { + continue; + } + + let mut permissions = Vec::new(); + + if let Some(default) = manifest.default_permission { + if options + .filter + .as_ref() + .map(|f| "default".contains(f)) + .unwrap_or(true) + { + permissions.push(format!( + "{}:{}\n{}\nPermissions: {}", + plugin.magenta(), + "default".cyan(), + default.description, + default + .permissions + .iter() + .map(|c| c.cyan().to_string()) + .collect::>() + .join(", ") + )); + } + } + + for set in manifest.permission_sets.values() { + if options + .filter + .as_ref() + .map(|f| set.identifier.contains(f)) + .unwrap_or(true) + { + permissions.push(format!( + "{}:{}\n{}\nPermissions: {}", + plugin.magenta(), + set.identifier.cyan(), + set.description, + set + .permissions + .iter() + .map(|c| c.cyan().to_string()) + .collect::>() + .join(", ") + )); + } + } + + for permission in manifest.permissions.into_values() { + if options + .filter + .as_ref() + .map(|f| permission.identifier.contains(f)) + .unwrap_or(true) + { + permissions.push(format!( + "{}:{}{}{}{}", + plugin.magenta(), + permission.identifier.cyan(), + permission + .description + .map(|d| format!("\n{d}")) + .unwrap_or_default(), + if permission.commands.allow.is_empty() { + "".to_string() + } else { + format!( + "\n{}: {}", + "Allow commands".bold(), + permission + .commands + .allow + .iter() + .map(|c| c.green().to_string()) + .collect::>() + .join(", ") + ) + }, + if permission.commands.deny.is_empty() { + "".to_string() + } else { + format!( + "\n{}: {}", + "Deny commands".bold(), + permission + .commands + .deny + .iter() + .map(|c| c.red().to_string()) + .collect::>() + .join(", ") + ) + }, + )); + } + } + + if !permissions.is_empty() { + println!("{}\n", permissions.join("\n\n")); + } + } + + Ok(()) + } else { + anyhow::bail!("permission file not found, please build your application once first") + } +} diff --git a/tooling/cli/src/acl/permission/mod.rs b/tooling/cli/src/acl/permission/mod.rs new file mode 100644 index 000000000000..27661e6626c0 --- /dev/null +++ b/tooling/cli/src/acl/permission/mod.rs @@ -0,0 +1,39 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use clap::{Parser, Subcommand}; + +use crate::Result; + +mod add; +mod ls; +mod new; +mod rm; + +#[derive(Debug, Parser)] +#[clap(about = "Manage or create permissions for your app or plugin")] +pub struct Cli { + #[clap(subcommand)] + command: Commands, +} + +#[derive(Subcommand, Debug)] +enum Commands { + #[clap(alias = "create")] + New(new::Options), + Add(add::Options), + #[clap(alias = "remove")] + Rm(rm::Options), + #[clap(alias = "list")] + Ls(ls::Options), +} + +pub fn command(cli: Cli) -> Result<()> { + match cli.command { + Commands::New(options) => new::command(options), + Commands::Add(options) => add::command(options), + Commands::Rm(options) => rm::command(options), + Commands::Ls(options) => ls::command(options), + } +} diff --git a/tooling/cli/src/acl/permission/new.rs b/tooling/cli/src/acl/permission/new.rs new file mode 100644 index 000000000000..298a878edf18 --- /dev/null +++ b/tooling/cli/src/acl/permission/new.rs @@ -0,0 +1,113 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::PathBuf; + +use clap::Parser; + +use crate::{ + acl::FileFormat, + helpers::{app_paths::tauri_dir_opt, prompts}, + Result, +}; + +use tauri_utils::acl::{plugin::PermissionFile, Commands, Permission}; + +#[derive(Debug, Parser)] +#[clap(about = "Create a new permission file")] +pub struct Options { + /// Permission identifier. + identifier: Option, + /// Permission description + #[clap(long)] + description: Option, + /// List of commands to allow + #[clap(short, long, use_value_delimiter = true)] + allow: Option>, + /// List of commands to deny + #[clap(short, long, use_value_delimiter = true)] + deny: Option>, + /// Output file format. + #[clap(long, default_value_t = FileFormat::Json)] + format: FileFormat, + /// The output file. + #[clap(short, long)] + out: Option, +} + +pub fn command(options: Options) -> Result<()> { + let identifier = match options.identifier { + Some(i) => i, + None => prompts::input("What's the permission identifier?", None, false, false)?.unwrap(), + }; + + let description = match options.description { + Some(d) => Some(d), + None => prompts::input::("What's the permission description?", None, false, true)? + .and_then(|d| if d.is_empty() { None } else { Some(d) }), + }; + + let allow: Vec = options + .allow + .map(FromIterator::from_iter) + .unwrap_or_default(); + let deny: Vec = options + .deny + .map(FromIterator::from_iter) + .unwrap_or_default(); + + let permission = Permission { + version: None, + identifier, + description, + commands: Commands { allow, deny }, + scope: Default::default(), + }; + + let path = match options.out { + Some(o) => o.canonicalize()?, + None => { + let dir = match tauri_dir_opt() { + Some(t) => t, + None => std::env::current_dir()?, + }; + let permissions_dir = dir.join("permissions"); + permissions_dir.join(format!( + "{}.{}", + permission.identifier, + options.format.extension() + )) + } + }; + + if path.exists() { + let msg = format!( + "Permission already exists at {}", + dunce::simplified(&path).display() + ); + let overwrite = prompts::confirm(&format!("{msg}, overwrite?"), Some(false))?; + if overwrite { + std::fs::remove_file(&path)?; + } else { + anyhow::bail!(msg); + } + } + + if let Some(parent) = path.parent() { + std::fs::create_dir_all(parent)?; + } + + std::fs::write( + &path, + options.format.serialize(&PermissionFile { + default: None, + set: Vec::new(), + permission: vec![permission], + })?, + )?; + + log::info!(action = "Created"; "permission at {}", dunce::simplified(&path).display()); + + Ok(()) +} diff --git a/tooling/cli/src/acl/permission/rm.rs b/tooling/cli/src/acl/permission/rm.rs new file mode 100644 index 000000000000..595fef661e96 --- /dev/null +++ b/tooling/cli/src/acl/permission/rm.rs @@ -0,0 +1,137 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::path::Path; + +use clap::Parser; +use tauri_utils::acl::{plugin::PermissionFile, PERMISSION_SCHEMA_FILE_NAME}; + +use crate::{acl::FileFormat, helpers::app_paths::tauri_dir_opt, Result}; + +fn rm_permission_files(identifier: &str, dir: &Path) -> Result<()> { + for entry in std::fs::read_dir(dir)?.flatten() { + let file_type = entry.file_type()?; + let path = entry.path(); + if file_type.is_dir() { + rm_permission_files(identifier, &path)?; + } else { + if path + .file_name() + .map(|name| name == PERMISSION_SCHEMA_FILE_NAME) + .unwrap_or_default() + { + continue; + } + + let (mut permission_file, format): (PermissionFile, FileFormat) = + match path.extension().and_then(|o| o.to_str()) { + Some("toml") => { + let content = std::fs::read_to_string(&path)?; + (toml::from_str(&content)?, FileFormat::Toml) + } + Some("json") => { + let content = std::fs::read(&path)?; + (serde_json::from_slice(&content)?, FileFormat::Json) + } + _ => { + continue; + } + }; + + let mut updated; + + if identifier == "default" { + updated = permission_file.default.is_some(); + permission_file.default = None; + } else { + let set_len = permission_file.set.len(); + permission_file.set.retain(|s| s.identifier != identifier); + updated = permission_file.set.len() != set_len; + + let permission_len = permission_file.permission.len(); + permission_file + .permission + .retain(|s| s.identifier != identifier); + updated = updated || permission_file.permission.len() != permission_len; + } + + // if the file is empty, let's remove it + if permission_file.default.is_none() + && permission_file.set.is_empty() + && permission_file.permission.is_empty() + { + std::fs::remove_file(&path)?; + log::info!(action = "Removed"; "file {}", dunce::simplified(&path).display()); + } else if updated { + std::fs::write(&path, format.serialize(&permission_file)?)?; + log::info!(action = "Removed"; "permission {identifier} from {}", dunce::simplified(&path).display()); + } + } + } + + Ok(()) +} + +fn rm_permission_from_capabilities(identifier: &str, dir: &Path) -> Result<()> { + for entry in std::fs::read_dir(dir)?.flatten() { + let file_type = entry.file_type()?; + if file_type.is_file() { + let path = entry.path(); + match path.extension().and_then(|o| o.to_str()) { + Some("toml") => { + let content = std::fs::read_to_string(&path)?; + if let Ok(mut value) = content.parse::() { + if let Some(permissions) = value.get_mut("permissions").and_then(|p| p.as_array_mut()) { + let prev_len = permissions.len(); + permissions.retain(|p| p.as_str().map(|p| p != identifier).unwrap_or(false)); + if prev_len != permissions.len() { + std::fs::write(&path, value.to_string())?; + log::info!(action = "Removed"; "permission from capability at {}", dunce::simplified(&path).display()); + } + } + } + } + Some("json") => { + let content = std::fs::read(&path)?; + if let Ok(mut value) = serde_json::from_slice::(&content) { + if let Some(permissions) = value.get_mut("permissions").and_then(|p| p.as_array_mut()) { + let prev_len = permissions.len(); + permissions.retain(|p| p.as_str().map(|p| p != identifier).unwrap_or(false)); + if prev_len != permissions.len() { + std::fs::write(&path, serde_json::to_vec_pretty(&value)?)?; + log::info!(action = "Removed"; "permission from capability at {}", dunce::simplified(&path).display()); + } + } + } + } + _ => {} + } + } + } + + Ok(()) +} + +#[derive(Debug, Parser)] +#[clap(about = "Remove a permission file, and its reference from any capability")] +pub struct Options { + /// Permission to remove. + identifier: String, +} + +pub fn command(options: Options) -> Result<()> { + let permissions_dir = std::env::current_dir()?.join("permissions"); + if permissions_dir.exists() { + rm_permission_files(&options.identifier, &permissions_dir)?; + } + + if let Some(tauri_dir) = tauri_dir_opt() { + let capabilities_dir = tauri_dir.join("capabilities"); + if capabilities_dir.exists() { + rm_permission_from_capabilities(&options.identifier, &capabilities_dir)?; + } + } + + Ok(()) +} diff --git a/tooling/cli/src/add.rs b/tooling/cli/src/add.rs index 83c96afa4b3c..5092a85e9753 100644 --- a/tooling/cli/src/add.rs +++ b/tooling/cli/src/add.rs @@ -22,16 +22,16 @@ use std::{collections::HashMap, process::Command}; #[clap(about = "Add a tauri plugin to the project")] pub struct Options { /// The plugin to add. - plugin: String, + pub plugin: String, /// Git tag to use. #[clap(short, long)] - tag: Option, + pub tag: Option, /// Git rev to use. #[clap(short, long)] - rev: Option, + pub rev: Option, /// Git branch to use. #[clap(short, long)] - branch: Option, + pub branch: Option, } pub fn command(options: Options) -> Result<()> { diff --git a/tooling/cli/src/build.rs b/tooling/cli/src/build.rs index 17aacfb09636..664313e43739 100644 --- a/tooling/cli/src/build.rs +++ b/tooling/cli/src/build.rs @@ -60,12 +60,11 @@ pub struct Options { /// Command line arguments passed to the runner. Use `--` to explicitly mark the start of the arguments. pub args: Vec, /// Skip prompting for values - #[clap(long)] + #[clap(long, env = "CI")] pub ci: bool, } pub fn command(mut options: Options, verbosity: u8) -> Result<()> { - options.ci = options.ci || std::env::var("CI").is_ok(); let ci = options.ci; let target = options diff --git a/tooling/cli/src/helpers/app_paths.rs b/tooling/cli/src/helpers/app_paths.rs index dacbb0eb6e28..63578340f905 100644 --- a/tooling/cli/src/helpers/app_paths.rs +++ b/tooling/cli/src/helpers/app_paths.rs @@ -66,14 +66,16 @@ fn lookup bool>(dir: &Path, checker: F) -> Option { None } -fn get_tauri_dir() -> PathBuf { - let cwd = current_dir().expect("failed to read cwd"); +pub fn tauri_dir_opt() -> Option { + let Ok(cwd) = current_dir() else { + return None; + }; if cwd.join(ConfigFormat::Json.into_file_name()).exists() || cwd.join(ConfigFormat::Json5.into_file_name()).exists() || cwd.join(ConfigFormat::Toml.into_file_name()).exists() { - return cwd; + return Some(cwd); } let src_tauri = cwd.join("src-tauri"); @@ -83,12 +85,23 @@ fn get_tauri_dir() -> PathBuf { .exists() || src_tauri.join(ConfigFormat::Toml.into_file_name()).exists() { - return src_tauri; + return Some(src_tauri); } - lookup(&cwd, |path| folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path)) - .map(|p| if p.is_dir() { p } else { p.parent().unwrap().to_path_buf() }) - .unwrap_or_else(|| + lookup(&cwd, |path| { + folder_has_configuration_file(Target::Linux, path) || is_configuration_file(Target::Linux, path) + }) + .map(|p| { + if p.is_dir() { + p + } else { + p.parent().unwrap().to_path_buf() + } + }) +} + +pub fn tauri_dir() -> PathBuf { + tauri_dir_opt().unwrap_or_else(|| panic!("Couldn't recognize the current folder as a Tauri project. It must contain a `{}`, `{}` or `{}` file in any subfolder.", ConfigFormat::Json.into_file_name(), ConfigFormat::Json5.into_file_name(), @@ -116,11 +129,6 @@ fn get_app_dir() -> Option { pub fn app_dir() -> &'static PathBuf { static APP_DIR: OnceLock = OnceLock::new(); - APP_DIR.get_or_init(|| { - get_app_dir().unwrap_or_else(|| get_tauri_dir().parent().unwrap().to_path_buf()) - }) -} - -pub fn tauri_dir() -> PathBuf { - get_tauri_dir() + APP_DIR + .get_or_init(|| get_app_dir().unwrap_or_else(|| tauri_dir().parent().unwrap().to_path_buf())) } diff --git a/tooling/cli/src/helpers/mod.rs b/tooling/cli/src/helpers/mod.rs index daa29d7bd847..f3e59ead78e4 100644 --- a/tooling/cli/src/helpers/mod.rs +++ b/tooling/cli/src/helpers/mod.rs @@ -7,6 +7,7 @@ pub mod config; pub mod flock; pub mod framework; pub mod npm; +pub mod prompts; pub mod template; pub mod updater_signature; pub mod web_dev_server; diff --git a/tooling/cli/src/helpers/prompts.rs b/tooling/cli/src/helpers/prompts.rs new file mode 100644 index 000000000000..08753671a004 --- /dev/null +++ b/tooling/cli/src/helpers/prompts.rs @@ -0,0 +1,57 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::{fmt::Display, str::FromStr}; + +use crate::Result; + +pub fn input( + prompt: &str, + initial: Option, + skip: bool, + allow_empty: bool, +) -> Result> +where + T: Clone + FromStr + Display + ToString, + T::Err: Display + std::fmt::Debug, +{ + if skip { + Ok(initial) + } else { + let theme = dialoguer::theme::ColorfulTheme::default(); + let mut builder = dialoguer::Input::with_theme(&theme) + .with_prompt(prompt) + .allow_empty(allow_empty); + + if let Some(v) = initial { + builder = builder.with_initial_text(v.to_string()); + } + + builder.interact_text().map(Some).map_err(Into::into) + } +} + +pub fn confirm(prompt: &str, default: Option) -> Result { + let theme = dialoguer::theme::ColorfulTheme::default(); + let mut builder = dialoguer::Confirm::with_theme(&theme).with_prompt(prompt); + if let Some(default) = default { + builder = builder.default(default); + } + builder.interact().map_err(Into::into) +} + +pub fn multiselect( + prompt: &str, + items: &[T], + defaults: Option<&[bool]>, +) -> Result> { + let theme = dialoguer::theme::ColorfulTheme::default(); + let mut builder = dialoguer::MultiSelect::with_theme(&theme) + .with_prompt(prompt) + .items(items); + if let Some(defaults) = defaults { + builder = builder.defaults(defaults); + } + builder.interact().map_err(Into::into) +} diff --git a/tooling/cli/src/init.rs b/tooling/cli/src/init.rs index e08f7ae59eaa..5d23318e2776 100644 --- a/tooling/cli/src/init.rs +++ b/tooling/cli/src/init.rs @@ -5,23 +5,20 @@ use crate::{ helpers::{ framework::{infer_from_package_json as infer_framework, Framework}, - resolve_tauri_path, template, + prompts, resolve_tauri_path, template, }, VersionMetadata, }; use std::{ collections::BTreeMap, env::current_dir, - fmt::Display, fs::{read_to_string, remove_dir_all}, path::PathBuf, - str::FromStr, }; use crate::Result; use anyhow::Context; use clap::Parser; -use dialoguer::Input; use handlebars::{to_json, Handlebars}; use include_dir::{include_dir, Dir}; use log::warn; @@ -33,7 +30,7 @@ const TAURI_CONF_TEMPLATE: &str = include_str!("../templates/tauri.conf.json"); #[clap(about = "Initialize a Tauri project in an existing directory")] pub struct Options { /// Skip prompting for values - #[clap(long)] + #[clap(long, env = "CI")] ci: bool, /// Force init to overwrite the src-tauri folder #[clap(short, long)] @@ -76,7 +73,6 @@ struct InitDefaults { impl Options { fn load(mut self) -> Result { - self.ci = self.ci || std::env::var("CI").is_ok(); let package_json_path = PathBuf::from(&self.directory).join("package.json"); let init_defaults = if package_json_path.exists() { @@ -92,7 +88,7 @@ impl Options { }; self.app_name = self.app_name.map(|s| Ok(Some(s))).unwrap_or_else(|| { - request_input( + prompts::input( "What is your app name?", init_defaults.app_name.clone(), self.ci, @@ -101,7 +97,7 @@ impl Options { })?; self.window_title = self.window_title.map(|s| Ok(Some(s))).unwrap_or_else(|| { - request_input( + prompts::input( "What should the window title be?", init_defaults.app_name.clone(), self.ci, @@ -109,7 +105,7 @@ impl Options { ) })?; - self.frontend_dist = self.frontend_dist.map(|s| Ok(Some(s))).unwrap_or_else(|| request_input( + self.frontend_dist = self.frontend_dist.map(|s| Ok(Some(s))).unwrap_or_else(|| prompts::input( r#"Where are your web assets (HTML/CSS/JS) located, relative to the "/src-tauri/tauri.conf.json" file that will be created?"#, init_defaults.framework.as_ref().map(|f| f.frontend_dist()), self.ci, @@ -117,7 +113,7 @@ impl Options { ))?; self.dev_url = self.dev_url.map(|s| Ok(Some(s))).unwrap_or_else(|| { - request_input( + prompts::input( "What is the url of your dev server?", init_defaults.framework.map(|f| f.dev_url()), self.ci, @@ -129,7 +125,7 @@ impl Options { .before_dev_command .map(|s| Ok(Some(s))) .unwrap_or_else(|| { - request_input( + prompts::input( "What is your frontend dev command?", Some("npm run dev".to_string()), self.ci, @@ -140,7 +136,7 @@ impl Options { .before_build_command .map(|s| Ok(Some(s))) .unwrap_or_else(|| { - request_input( + prompts::input( "What is your frontend build command?", Some("npm run build".to_string()), self.ci, @@ -283,29 +279,3 @@ pub fn command(mut options: Options) -> Result<()> { Ok(()) } - -fn request_input( - prompt: &str, - initial: Option, - skip: bool, - allow_empty: bool, -) -> Result> -where - T: Clone + FromStr + Display + ToString, - T::Err: Display + std::fmt::Debug, -{ - if skip { - Ok(initial) - } else { - let theme = dialoguer::theme::ColorfulTheme::default(); - let mut builder = Input::with_theme(&theme) - .with_prompt(prompt) - .allow_empty(allow_empty); - - if let Some(v) = initial { - builder = builder.with_initial_text(v.to_string()); - } - - builder.interact_text().map(Some).map_err(Into::into) - } -} diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 8e2a78eab9a6..dd3984f72a00 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -464,7 +464,7 @@ impl Rust { ) { features .get_or_insert(Vec::new()) - .push("custom-protocol".into()); + .push("tauri/custom-protocol".into()); shared_options(mobile, args, features, &self.app_settings); } diff --git a/tooling/cli/src/lib.rs b/tooling/cli/src/lib.rs index 3ddbc8ce44cd..da1d080a121d 100644 --- a/tooling/cli/src/lib.rs +++ b/tooling/cli/src/lib.rs @@ -14,6 +14,7 @@ use anyhow::Context; pub use anyhow::Result; +mod acl; mod add; mod build; mod completions; @@ -145,6 +146,8 @@ enum Commands { Icon(icon::Options), Signer(signer::Cli), Completions(completions::Options), + Permission(acl::permission::Cli), + Capability(acl::capability::Cli), } fn format_error(err: clap::Error) -> clap::Error { @@ -247,6 +250,8 @@ where Commands::Plugin(cli) => plugin::command(cli)?, Commands::Signer(cli) => signer::command(cli)?, Commands::Completions(options) => completions::command(options, cli_)?, + Commands::Permission(options) => acl::permission::command(options)?, + Commands::Capability(options) => acl::capability::command(options)?, Commands::Android(c) => mobile::android::command(c, cli.verbose)?, #[cfg(target_os = "macos")] Commands::Ios(c) => mobile::ios::command(c, cli.verbose)?, diff --git a/tooling/cli/src/migrate/config.rs b/tooling/cli/src/migrate/config.rs index 2f296091770c..256eaa9b0c5b 100644 --- a/tooling/cli/src/migrate/config.rs +++ b/tooling/cli/src/migrate/config.rs @@ -14,24 +14,12 @@ use tauri_utils::{ }; use std::{ + collections::HashSet, fs::{create_dir_all, write}, path::Path, }; -macro_rules! move_allowlist_object { - ($plugins: ident, $value: expr, $plugin: literal, $field: literal) => {{ - if $value != Default::default() { - $plugins - .entry($plugin) - .or_insert_with(|| Value::Object(Default::default())) - .as_object_mut() - .unwrap() - .insert($field.into(), serde_json::to_value($value.clone())?); - } - }}; -} - -pub fn migrate(tauri_dir: &Path) -> Result<()> { +pub fn migrate(tauri_dir: &Path) -> Result { if let Ok((mut config, config_path)) = tauri_utils_v1::config::parse::parse_value(tauri_dir.join("tauri.conf.json")) { @@ -50,7 +38,7 @@ pub fn migrate(tauri_dir: &Path) -> Result<()> { .into_iter() .map(|p| PermissionEntry::PermissionRef(p.to_string().try_into().unwrap())) .collect(); - permissions.extend(migrated.permissions); + permissions.extend(migrated.permissions.clone()); let capabilities_path = config_path.parent().unwrap().join("capabilities"); create_dir_all(&capabilities_path)?; @@ -73,18 +61,23 @@ pub fn migrate(tauri_dir: &Path) -> Result<()> { ], })?, )?; + + return Ok(migrated); } - Ok(()) + Ok(Default::default()) } -struct MigratedConfig { - permissions: Vec, +#[derive(Default)] +pub struct MigratedConfig { + pub permissions: Vec, + pub plugins: HashSet, } fn migrate_config(config: &mut Value) -> Result { let mut migrated = MigratedConfig { permissions: Vec::new(), + plugins: HashSet::new(), }; if let Some(config) = config.as_object_mut() { @@ -101,8 +94,9 @@ fn migrate_config(config: &mut Value) -> Result { if let Some(tauri_config) = config.get_mut("tauri").and_then(|c| c.as_object_mut()) { // allowlist if let Some(allowlist) = tauri_config.remove("allowlist") { - let allowlist = process_allowlist(tauri_config, &mut plugins, allowlist)?; + let allowlist = process_allowlist(tauri_config, allowlist)?; let permissions = allowlist_to_permissions(allowlist); + migrated.plugins = plugins_from_permissions(&permissions); migrated.permissions = permissions; } @@ -178,8 +172,11 @@ fn process_build(config: &mut Map) { if let Some(dist_dir) = build_config.remove("distDir") { build_config.insert("frontendDist".into(), dist_dir); } - if let Some(dist_dir) = build_config.remove("devPath") { - build_config.insert("devUrl".into(), dist_dir); + if let Some(dev_path) = build_config.remove("devPath") { + let is_url = url::Url::parse(dev_path.as_str().unwrap_or_default()).is_ok(); + if is_url { + build_config.insert("devUrl".into(), dev_path); + } } if let Some(with_global_tauri) = build_config.remove("withGlobalTauri") { config @@ -282,13 +279,10 @@ fn process_security(security: &mut Map) -> Result<()> { fn process_allowlist( tauri_config: &mut Map, - plugins: &mut Map, allowlist: Value, ) -> Result { let allowlist: tauri_utils_v1::config::AllowlistConfig = serde_json::from_value(allowlist)?; - move_allowlist_object!(plugins, allowlist.shell.open, "shell", "open"); - if allowlist.protocol.asset_scope != Default::default() { let security = tauri_config .entry("security") @@ -524,6 +518,34 @@ fn process_updater( Ok(()) } +const KNOWN_PLUGINS: &[&str] = &[ + "fs", + "shell", + "dialog", + "http", + "notification", + "global-shortcut", + "os", + "process", + "clipboard-manager", +]; + +fn plugins_from_permissions(permissions: &Vec) -> HashSet { + let mut plugins = HashSet::new(); + + for permission in permissions { + let permission = permission.identifier().get(); + for plugin in KNOWN_PLUGINS { + if permission.starts_with(plugin) { + plugins.insert(plugin.to_string()); + break; + } + } + } + + plugins +} + #[cfg(test)] mod test { fn migrate(original: &serde_json::Value) -> serde_json::Value { @@ -846,4 +868,22 @@ mod test { "connect-src migration failed" ); } + + #[test] + fn migrate_invalid_url_dev_path() { + let original = serde_json::json!({ + "build": { + "devPath": "../src", + "distDir": "../src" + } + }); + + let migrated = migrate(&original); + + assert!(migrated["build"].get("devUrl").is_none()); + assert_eq!( + migrated["build"]["distDir"], + original["build"]["frontendDist"] + ); + } } diff --git a/tooling/cli/src/migrate/manifest.rs b/tooling/cli/src/migrate/manifest.rs index 8d7bc3526ea6..f2071f4dde20 100644 --- a/tooling/cli/src/migrate/manifest.rs +++ b/tooling/cli/src/migrate/manifest.rs @@ -11,7 +11,7 @@ use toml_edit::{Document, Entry, Item, Table, TableLike, Value}; use std::{fs::File, io::Write, path::Path}; -const CRATE_TYPES: &[&str] = &["staticlib", "cdylib", "rlib"]; +const CRATE_TYPES: [&str; 3] = ["lib", "staticlib", "cdylib"]; pub fn migrate(tauri_dir: &Path) -> Result<()> { let manifest_path = tauri_dir.join("Cargo.toml"); @@ -57,34 +57,34 @@ fn migrate_manifest(manifest: &mut Document) -> Result<()> { migrate_dependency(build_dependencies, "tauri-build", &version, &[]); - let lib = manifest + if let Some(lib) = manifest .as_table_mut() - .entry("lib") - .or_insert(Item::Table(Table::new())) - .as_table_mut() - .expect("manifest lib isn't a table"); - match lib.entry("crate-type") { - Entry::Occupied(mut e) => { - if let Item::Value(Value::Array(types)) = e.get_mut() { - let mut crate_types_to_add = CRATE_TYPES.to_vec(); - for t in types.iter() { - // type is already in the manifest, skip adding it - if let Some(i) = crate_types_to_add - .iter() - .position(|ty| Some(ty) == t.as_str().as_ref()) - { - crate_types_to_add.remove(i); + .get_mut("lib") + .and_then(|l| l.as_table_mut()) + { + match lib.entry("crate-type") { + Entry::Occupied(mut e) => { + if let Item::Value(Value::Array(types)) = e.get_mut() { + let mut crate_types_to_add = CRATE_TYPES.to_vec(); + for t in types.iter() { + // type is already in the manifest, skip adding it + if let Some(i) = crate_types_to_add + .iter() + .position(|ty| Some(ty) == t.as_str().as_ref()) + { + crate_types_to_add.remove(i); + } + } + for t in crate_types_to_add { + types.push(t); } - } - for t in crate_types_to_add { - types.push(t); } } - } - Entry::Vacant(e) => { - let mut arr = toml_edit::Array::new(); - arr.extend(CRATE_TYPES.to_vec()); - e.insert(Item::Value(arr.into())); + Entry::Vacant(e) => { + let mut arr = toml_edit::Array::new(); + arr.extend(CRATE_TYPES.to_vec()); + e.insert(Item::Value(arr.into())); + } } } @@ -265,35 +265,6 @@ mod tests { } } - fn migrate_lib(toml: &str) { - let mut manifest = toml.parse::().expect("invalid toml"); - super::migrate_manifest(&mut manifest).expect("failed to migrate manifest"); - - let lib = manifest - .as_table() - .get("lib") - .expect("missing manifest lib") - .as_table() - .expect("manifest lib isn't a table"); - - let crate_types = lib - .get("crate-type") - .expect("missing lib crate-type") - .as_array() - .expect("crate-type must be an array"); - let mut not_added_crate_types = super::CRATE_TYPES.to_vec(); - for t in crate_types { - let t = t.as_str().expect("crate-type must be a string"); - if let Some(i) = not_added_crate_types.iter().position(|ty| ty == &t) { - not_added_crate_types.remove(i); - } - } - assert!( - not_added_crate_types.is_empty(), - "missing crate-type: {not_added_crate_types:?}" - ); - } - #[test] fn migrate_table() { migrate_deps(|features| { @@ -332,22 +303,32 @@ mod tests { }) } - #[test] - fn migrate_missing_lib() { - migrate_lib("[dependencies]"); - } - - #[test] - fn migrate_missing_crate_types() { - migrate_lib("[lib]"); - } - #[test] fn migrate_add_crate_types() { - migrate_lib( - r#" + let toml = r#" [lib] - crate-type = ["something"]"#, - ); + crate-type = ["something"]"#; + + let mut manifest = toml.parse::().expect("invalid toml"); + super::migrate_manifest(&mut manifest).expect("failed to migrate manifest"); + + if let Some(crate_types) = manifest + .as_table() + .get("lib") + .and_then(|l| l.get("crate-type")) + .and_then(|c| c.as_array()) + { + let mut not_added_crate_types = super::CRATE_TYPES.to_vec(); + for t in crate_types { + let t = t.as_str().expect("crate-type must be a string"); + if let Some(i) = not_added_crate_types.iter().position(|ty| ty == &t) { + not_added_crate_types.remove(i); + } + } + assert!( + not_added_crate_types.is_empty(), + "missing crate-type: {not_added_crate_types:?}" + ); + } } } diff --git a/tooling/cli/src/migrate/mod.rs b/tooling/cli/src/migrate/mod.rs index 4d507fab6c9f..6d762a1c1941 100644 --- a/tooling/cli/src/migrate/mod.rs +++ b/tooling/cli/src/migrate/mod.rs @@ -15,9 +15,19 @@ pub fn command() -> Result<()> { let tauri_dir = tauri_dir(); let app_dir = app_dir(); - config::migrate(&tauri_dir)?; + let migrated = config::migrate(&tauri_dir)?; manifest::migrate(&tauri_dir)?; frontend::migrate(app_dir, &tauri_dir)?; + // Add plugins + for plugin in migrated.plugins { + crate::add::command(crate::add::Options { + plugin, + branch: None, + tag: None, + rev: None, + })? + } + Ok(()) } diff --git a/tooling/cli/src/mobile/android/android_studio_script.rs b/tooling/cli/src/mobile/android/android_studio_script.rs index 67eb4d223181..3ee701e1c4e9 100644 --- a/tooling/cli/src/mobile/android/android_studio_script.rs +++ b/tooling/cli/src/mobile/android/android_studio_script.rs @@ -49,6 +49,7 @@ pub fn command(options: Options) -> Result<()> { let (config, metadata) = get_config( &get_app(tauri_config_, &AppInterface::new(tauri_config_, None)?), tauri_config_, + None, &cli_options, ); (config, metadata, cli_options) diff --git a/tooling/cli/src/mobile/android/build.rs b/tooling/cli/src/mobile/android/build.rs index 8ab64f8d9787..5886d3d72340 100644 --- a/tooling/cli/src/mobile/android/build.rs +++ b/tooling/cli/src/mobile/android/build.rs @@ -64,6 +64,9 @@ pub struct Options { /// Open Android Studio #[clap(short, long)] pub open: bool, + /// Skip prompting for values + #[clap(long, env = "CI")] + pub ci: bool, } impl From for BuildOptions { @@ -76,7 +79,7 @@ impl From for BuildOptions { bundles: None, config: options.config, args: Vec::new(), - ci: false, + ci: options.ci, } } } @@ -102,9 +105,15 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { let tauri_config_ = tauri_config_guard.as_ref().unwrap(); let interface = AppInterface::new(tauri_config_, build_options.target.clone())?; + interface.build_options(&mut Vec::new(), &mut build_options.features, true); let app = get_app(tauri_config_, &interface); - let (config, metadata) = get_config(&app, tauri_config_, &Default::default()); + let (config, metadata) = get_config( + &app, + tauri_config_, + build_options.features.as_ref(), + &Default::default(), + ); (interface, app, config, metadata) }; @@ -125,6 +134,8 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { let mut env = env()?; configure_cargo(&app, Some((&mut env, &config)))?; + crate::build::setup(&interface, &mut build_options, tauri_config.clone(), true)?; + // run an initial build to initialize plugins Target::all().values().next().unwrap().build( &config, @@ -132,11 +143,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { &env, noise_level, true, - if options.debug { - Profile::Debug - } else { - Profile::Release - }, + profile, )?; let open = options.open; @@ -162,7 +169,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { fn run_build( interface: AppInterface, mut options: Options, - mut build_options: BuildOptions, + build_options: BuildOptions, tauri_config: ConfigHandle, profile: Profile, config: &AndroidConfig, @@ -175,8 +182,6 @@ fn run_build( options.aab = true; } - crate::build::setup(&interface, &mut build_options, tauri_config.clone(), true)?; - let interface_options = InterfaceOptions { debug: build_options.debug, target: build_options.target.clone(), @@ -199,11 +204,6 @@ fn run_build( cli_options, )?; - options - .features - .get_or_insert(Vec::new()) - .push("custom-protocol".into()); - inject_assets(config, tauri_config.lock().unwrap().as_ref().unwrap())?; let apk_outputs = if options.apk { diff --git a/tooling/cli/src/mobile/android/dev.rs b/tooling/cli/src/mobile/android/dev.rs index 46ef29493848..591341561539 100644 --- a/tooling/cli/src/mobile/android/dev.rs +++ b/tooling/cli/src/mobile/android/dev.rs @@ -145,7 +145,12 @@ fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> { let interface = AppInterface::new(tauri_config_, dev_options.target.clone())?; let app = get_app(tauri_config_, &interface); - let (config, metadata) = get_config(&app, tauri_config_, &Default::default()); + let (config, metadata) = get_config( + &app, + tauri_config_, + dev_options.features.as_ref(), + &Default::default(), + ); (interface, app, config, metadata) }; diff --git a/tooling/cli/src/mobile/android/mod.rs b/tooling/cli/src/mobile/android/mod.rs index bb61b16ab905..330666d78969 100644 --- a/tooling/cli/src/mobile/android/mod.rs +++ b/tooling/cli/src/mobile/android/mod.rs @@ -57,7 +57,7 @@ pub struct Cli { #[clap(about = "Initialize Android target in the project")] pub struct InitOptions { /// Skip prompting for values - #[clap(long)] + #[clap(long, env = "CI")] ci: bool, /// Skips installing rust toolchains via rustup #[clap(long)] @@ -96,9 +96,16 @@ pub fn command(cli: Cli, verbosity: u8) -> Result<()> { pub fn get_config( app: &App, config: &TauriConfig, + features: Option<&Vec>, cli_options: &CliOptions, ) -> (AndroidConfig, AndroidMetadata) { - let android_options = cli_options.clone(); + let mut android_options = cli_options.clone(); + if let Some(features) = features { + android_options + .features + .get_or_insert(Vec::new()) + .extend_from_slice(features); + } let raw = RawAndroidConfig { features: android_options.features.clone(), diff --git a/tooling/cli/src/mobile/android/open.rs b/tooling/cli/src/mobile/android/open.rs index c1d9b9a35bd6..318e239f0f9f 100644 --- a/tooling/cli/src/mobile/android/open.rs +++ b/tooling/cli/src/mobile/android/open.rs @@ -20,6 +20,7 @@ pub fn command() -> Result<()> { get_config( &get_app(tauri_config_, &AppInterface::new(tauri_config_, None)?), tauri_config_, + None, &Default::default(), ) }; diff --git a/tooling/cli/src/mobile/init.rs b/tooling/cli/src/mobile/init.rs index 0f4dd51b5419..9f195016f473 100644 --- a/tooling/cli/src/mobile/init.rs +++ b/tooling/cli/src/mobile/init.rs @@ -38,14 +38,8 @@ pub fn command( ) -> Result<()> { let wrapper = TextWrapper::default(); - exec( - target, - &wrapper, - ci || var_os("CI").is_some(), - reinstall_deps, - skip_targets_install, - ) - .map_err(|e| anyhow::anyhow!("{:#}", e))?; + exec(target, &wrapper, ci, reinstall_deps, skip_targets_install) + .map_err(|e| anyhow::anyhow!("{:#}", e))?; Ok(()) } @@ -182,7 +176,7 @@ pub fn exec( Target::Android => match AndroidEnv::new() { Ok(_env) => { let (config, metadata) = - super::android::get_config(&app, tauri_config_, &Default::default()); + super::android::get_config(&app, tauri_config_, None, &Default::default()); map.insert("android", &config); super::android::project::gen( &config, @@ -209,7 +203,8 @@ pub fn exec( #[cfg(target_os = "macos")] // Generate Xcode project Target::Ios => { - let (config, metadata) = super::ios::get_config(&app, tauri_config_, &Default::default()); + let (config, metadata) = + super::ios::get_config(&app, tauri_config_, None, &Default::default()); map.insert("apple", &config); super::ios::project::gen( &config, diff --git a/tooling/cli/src/mobile/ios/build.rs b/tooling/cli/src/mobile/ios/build.rs index 07a59ca22810..3a922e5ed68c 100644 --- a/tooling/cli/src/mobile/ios/build.rs +++ b/tooling/cli/src/mobile/ios/build.rs @@ -60,6 +60,9 @@ pub struct Options { /// Open Xcode #[clap(short, long)] pub open: bool, + /// Skip prompting for values + #[clap(long, env = "CI")] + pub ci: bool, } impl From for BuildOptions { @@ -72,7 +75,7 @@ impl From for BuildOptions { bundles: None, config: options.config, args: Vec::new(), - ci: false, + ci: options.ci, } } } @@ -96,9 +99,15 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { let tauri_config_ = tauri_config_guard.as_ref().unwrap(); let interface = AppInterface::new(tauri_config_, build_options.target.clone())?; + interface.build_options(&mut Vec::new(), &mut build_options.features, true); let app = get_app(tauri_config_, &interface); - let (config, _metadata) = get_config(&app, tauri_config_, &Default::default()); + let (config, _metadata) = get_config( + &app, + tauri_config_, + build_options.features.as_ref(), + &Default::default(), + ); (interface, app, config) }; @@ -143,7 +152,7 @@ pub fn command(options: Options, noise_level: NoiseLevel) -> Result<()> { fn run_build( interface: AppInterface, - mut options: Options, + options: Options, mut build_options: BuildOptions, tauri_config: ConfigHandle, config: &AppleConfig, @@ -178,11 +187,6 @@ fn run_build( cli_options, )?; - options - .features - .get_or_insert(Vec::new()) - .push("custom-protocol".into()); - let mut out_files = Vec::new(); call_for_targets_with_fallback( diff --git a/tooling/cli/src/mobile/ios/dev.rs b/tooling/cli/src/mobile/ios/dev.rs index 2608fca35d6b..62f40a87a8de 100644 --- a/tooling/cli/src/mobile/ios/dev.rs +++ b/tooling/cli/src/mobile/ios/dev.rs @@ -128,7 +128,12 @@ fn run_command(options: Options, noise_level: NoiseLevel) -> Result<()> { let interface = AppInterface::new(tauri_config_, Some(target_triple))?; let app = get_app(tauri_config_, &interface); - let (config, _metadata) = get_config(&app, tauri_config_, &Default::default()); + let (config, _metadata) = get_config( + &app, + tauri_config_, + dev_options.features.as_ref(), + &Default::default(), + ); (interface, app, config) }; diff --git a/tooling/cli/src/mobile/ios/mod.rs b/tooling/cli/src/mobile/ios/mod.rs index 055ec0513717..358d21a782b4 100644 --- a/tooling/cli/src/mobile/ios/mod.rs +++ b/tooling/cli/src/mobile/ios/mod.rs @@ -63,7 +63,7 @@ pub struct Cli { #[clap(about = "Initialize iOS target in the project")] pub struct InitOptions { /// Skip prompting for values - #[clap(long)] + #[clap(long, env = "CI")] ci: bool, /// Reinstall dependencies #[clap(short, long)] @@ -105,9 +105,16 @@ pub fn command(cli: Cli, verbosity: u8) -> Result<()> { pub fn get_config( app: &App, config: &TauriConfig, + features: Option<&Vec>, cli_options: &CliOptions, ) -> (AppleConfig, AppleMetadata) { - let ios_options = cli_options.clone(); + let mut ios_options = cli_options.clone(); + if let Some(features) = features { + ios_options + .features + .get_or_insert(Vec::new()) + .extend_from_slice(features); + } let raw = RawAppleConfig { development_team: std::env::var(APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME) diff --git a/tooling/cli/src/mobile/ios/open.rs b/tooling/cli/src/mobile/ios/open.rs index 3a9fe676b7cf..09a69681d3aa 100644 --- a/tooling/cli/src/mobile/ios/open.rs +++ b/tooling/cli/src/mobile/ios/open.rs @@ -20,6 +20,7 @@ pub fn command() -> Result<()> { get_config( &get_app(tauri_config_, &AppInterface::new(tauri_config_, None)?), tauri_config_, + None, &Default::default(), ) }; diff --git a/tooling/cli/src/mobile/ios/xcode_script.rs b/tooling/cli/src/mobile/ios/xcode_script.rs index da8941854646..d9e9b68defc6 100644 --- a/tooling/cli/src/mobile/ios/xcode_script.rs +++ b/tooling/cli/src/mobile/ios/xcode_script.rs @@ -77,6 +77,7 @@ pub fn command(options: Options) -> Result<()> { let (config, metadata) = get_config( &get_app(tauri_config_, &AppInterface::new(tauri_config_, None)?), tauri_config_, + None, &cli_options, ); (config, metadata, cli_options) diff --git a/tooling/cli/src/plugin/android.rs b/tooling/cli/src/plugin/android.rs index 08994f67340c..7b2ee45d4c75 100644 --- a/tooling/cli/src/plugin/android.rs +++ b/tooling/cli/src/plugin/android.rs @@ -2,7 +2,10 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::{helpers::template, Result}; +use crate::{ + helpers::{prompts::input, template}, + Result, +}; use clap::{Parser, Subcommand}; use handlebars::Handlebars; @@ -56,7 +59,7 @@ pub fn command(cli: Cli) -> Result<()> { return Err(anyhow::anyhow!("android folder already exists")); } - let plugin_id = super::init::request_input( + let plugin_id = input( "What should be the Android Package ID for your plugin?", Some(format!("com.plugin.{}", plugin_name)), false, diff --git a/tooling/cli/src/plugin/init.rs b/tooling/cli/src/plugin/init.rs index fe484274a4e7..7f631c0abeea 100644 --- a/tooling/cli/src/plugin/init.rs +++ b/tooling/cli/src/plugin/init.rs @@ -2,6 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use crate::helpers::prompts::input; use crate::Result; use crate::{ helpers::{resolve_tauri_path, template}, @@ -9,7 +10,6 @@ use crate::{ }; use anyhow::Context; use clap::Parser; -use dialoguer::Input; use handlebars::{to_json, Handlebars}; use heck::{ToKebabCase, ToPascalCase, ToSnakeCase}; use include_dir::{include_dir, Dir}; @@ -18,10 +18,8 @@ use std::{ collections::BTreeMap, env::current_dir, ffi::OsStr, - fmt::Display, fs::{create_dir_all, remove_dir_all, File, OpenOptions}, path::{Component, Path, PathBuf}, - str::FromStr, }; pub const TEMPLATE_DIR: Dir<'_> = include_dir!("templates/plugin"); @@ -145,7 +143,7 @@ pub fn command(mut options: Options) -> Result<()> { } let plugin_id = if options.android || options.mobile { - let plugin_id = request_input( + let plugin_id = input( "What should be the Android Package ID for your plugin?", Some(format!("com.plugin.{}", plugin_name)), false, @@ -218,6 +216,10 @@ pub fn command(mut options: Options) -> Result<()> { ) .with_context(|| "failed to render plugin Android template")?; } + + std::fs::create_dir(template_target_path.join("permissions")) + .with_context(|| "failed to create `permissions` directory")?; + Ok(()) } @@ -278,29 +280,3 @@ pub fn generate_android_out_file( Ok(None) } } - -pub fn request_input( - prompt: &str, - initial: Option, - skip: bool, - allow_empty: bool, -) -> Result> -where - T: Clone + FromStr + Display + ToString, - T::Err: Display + std::fmt::Debug, -{ - if skip { - Ok(initial) - } else { - let theme = dialoguer::theme::ColorfulTheme::default(); - let mut builder = Input::with_theme(&theme) - .with_prompt(prompt) - .allow_empty(allow_empty); - - if let Some(v) = initial { - builder = builder.with_initial_text(v.to_string()); - } - - builder.interact_text().map(Some).map_err(Into::into) - } -} diff --git a/tooling/cli/src/signer/generate.rs b/tooling/cli/src/signer/generate.rs index 8bc3e9bcf9b4..990ddc41cf8a 100644 --- a/tooling/cli/src/signer/generate.rs +++ b/tooling/cli/src/signer/generate.rs @@ -23,13 +23,11 @@ pub struct Options { #[clap(short, long)] force: bool, /// Skip prompting for values - #[clap(long)] + #[clap(long, env = "CI")] ci: bool, } pub fn command(mut options: Options) -> Result<()> { - options.ci = options.ci || std::env::var("CI").is_ok(); - if options.ci && options.password.is_none() { log::warn!("Generating new private key without password. For security reasons, we recommend setting a password instead."); options.password.replace("".into()); diff --git a/tooling/cli/templates/app/src-tauri/Cargo.crate-manifest b/tooling/cli/templates/app/src-tauri/Cargo.crate-manifest index 730758096b12..0b8303f30969 100755 --- a/tooling/cli/templates/app/src-tauri/Cargo.crate-manifest +++ b/tooling/cli/templates/app/src-tauri/Cargo.crate-manifest @@ -21,8 +21,3 @@ tauri-build = {{ tauri_build_dep }} serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } tauri = {{ tauri_dep }} - -[features] -# this feature is used for production builds or when `devUrl` points to the filesystem -# DO NOT REMOVE!! -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/cli/templates/plugin/__example-api/tauri-app/src-tauri/Cargo.crate-manifest b/tooling/cli/templates/plugin/__example-api/tauri-app/src-tauri/Cargo.crate-manifest index 4bf22f3d1085..325d84cc9d6f 100644 --- a/tooling/cli/templates/plugin/__example-api/tauri-app/src-tauri/Cargo.crate-manifest +++ b/tooling/cli/templates/plugin/__example-api/tauri-app/src-tauri/Cargo.crate-manifest @@ -20,8 +20,3 @@ tauri-build = {{ tauri_build_dep }} [dependencies] tauri = {{ tauri_example_dep }} tauri-plugin-{{ plugin_name }} = { path = "../../../" } - -[features] -# this feature is used for production builds or when `devUrl` points to the filesystem -# DO NOT REMOVE!! -custom-protocol = [ "tauri/custom-protocol" ] diff --git a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/Cargo.crate-manifest b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/Cargo.crate-manifest index 4bf22f3d1085..325d84cc9d6f 100644 --- a/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/Cargo.crate-manifest +++ b/tooling/cli/templates/plugin/__example-basic/vanilla/src-tauri/Cargo.crate-manifest @@ -20,8 +20,3 @@ tauri-build = {{ tauri_build_dep }} [dependencies] tauri = {{ tauri_example_dep }} tauri-plugin-{{ plugin_name }} = { path = "../../../" } - -[features] -# this feature is used for production builds or when `devUrl` points to the filesystem -# DO NOT REMOVE!! -custom-protocol = [ "tauri/custom-protocol" ]