From 516c7d9f6312637519ab940a87d7c87a2e49f1a5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 10:39:59 +0800 Subject: [PATCH 01/14] chore(deps) Update Rust crate syn to v2.0.83 (#11473) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 118 ++++++++++++++++++++++++++--------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1c7a4c50c3bc..246b88e14e3a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -422,7 +422,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -507,7 +507,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -1265,7 +1265,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "syn_derive", ] @@ -1697,7 +1697,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2144,7 +2144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2154,7 +2154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2201,7 +2201,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2225,7 +2225,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2236,7 +2236,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2313,7 +2313,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2334,7 +2334,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2344,7 +2344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" dependencies = [ "derive_builder_core", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2357,7 +2357,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2468,7 +2468,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2491,7 +2491,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -2740,7 +2740,7 @@ checksum = "ba7795da175654fe16979af73f81f26a8ea27638d8d9823d317016888a63dc4c" dependencies = [ "num-traits", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -3018,7 +3018,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -3143,7 +3143,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -3417,7 +3417,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -3542,7 +3542,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -4150,7 +4150,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -4976,7 +4976,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5116,7 +5116,7 @@ dependencies = [ "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5131,7 +5131,7 @@ dependencies = [ "quote", "regex", "semver", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5362,7 +5362,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5424,7 +5424,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5755,7 +5755,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -5866,7 +5866,7 @@ checksum = "197b36739db0e80919e19a90785233eea5664697d4cd829bd49af34838ec43d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -6125,7 +6125,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -6184,7 +6184,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -6366,7 +6366,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -6425,7 +6425,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -6642,7 +6642,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "version_check", "yansi", ] @@ -6663,7 +6663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -7685,7 +7685,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -7711,7 +7711,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -7905,7 +7905,7 @@ checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -7916,7 +7916,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -7959,7 +7959,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -8010,7 +8010,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -8048,7 +8048,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -8440,7 +8440,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -8661,9 +8661,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.82" +version = "2.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83540f837a8afc019423a8edb95b52a8effe46957ee402287f4292fae35be021" +checksum = "01680f5d178a369f817f43f3d399650272873a8e7588a7872f7e90edc71d60a3" dependencies = [ "proc-macro2", "quote", @@ -8679,7 +8679,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -8803,7 +8803,7 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -9062,7 +9062,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.82", + "syn 2.0.83", "tauri-utils 2.0.2", "thiserror", "time", @@ -9136,7 +9136,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "tauri-codegen", "tauri-utils 2.0.2", ] @@ -9476,7 +9476,7 @@ checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -9603,7 +9603,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -9809,7 +9809,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -10380,7 +10380,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "wasm-bindgen-shared", ] @@ -10414,7 +10414,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10529,7 +10529,7 @@ checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -10664,7 +10664,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -10675,7 +10675,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -11051,7 +11051,7 @@ dependencies = [ "async-trait", "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-macro-support", @@ -11251,7 +11251,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] @@ -11271,7 +11271,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.82", + "syn 2.0.83", ] [[package]] From 8036c78e08715b1bc6b9fcb0c59a570eec98014f Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Thu, 24 Oct 2024 06:43:02 +0300 Subject: [PATCH 02/14] feat(core/path): add `PathResolver::home_dir` on Android (#11455) ref: https://github.com/tauri-apps/tauri/issues/10478#issuecomment-2383754176 --- .changes/android-home-dir.md | 5 +++++ .../android/src/main/java/app/tauri/PathPlugin.kt | 5 +++++ crates/tauri/src/path/android.rs | 11 +++++++++++ crates/tauri/src/path/mod.rs | 14 +++++--------- 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 .changes/android-home-dir.md diff --git a/.changes/android-home-dir.md b/.changes/android-home-dir.md new file mode 100644 index 000000000000..b2b5a5885cd0 --- /dev/null +++ b/.changes/android-home-dir.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch:feat" +--- + +Add `PathResolver::home_dir()` method on Android. diff --git a/crates/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt b/crates/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt index ec72d008ad0e..04ea644f71aa 100644 --- a/crates/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt +++ b/crates/tauri/mobile/android/src/main/java/app/tauri/PathPlugin.kt @@ -76,4 +76,9 @@ class PathPlugin(private val activity: Activity): Plugin(activity) { fun getCacheDir(invoke: Invoke) { resolvePath(invoke, activity.cacheDir.absolutePath) } + + @Command + fun getHomeDir(invoke: Invoke) { + resolvePath(invoke, Environment.getExternalStorageDirectory().absolutePath) + } } diff --git a/crates/tauri/src/path/android.rs b/crates/tauri/src/path/android.rs index c2f6be2f88fb..3015e44808e7 100644 --- a/crates/tauri/src/path/android.rs +++ b/crates/tauri/src/path/android.rs @@ -117,4 +117,15 @@ impl PathResolver { pub fn temp_dir(&self) -> Result { Ok(std::env::temp_dir()) } + + /// Returns the path to the user's home directory. + /// + /// ## Platform-specific + /// + /// - **Linux:** Resolves to `$HOME`. + /// - **macOS:** Resolves to `$HOME`. + /// - **Windows:** Resolves to `{FOLDERID_Profile}`. + pub fn home_dir(&self) -> Result { + self.call_resolve("getHomeDir") + } } diff --git a/crates/tauri/src/path/mod.rs b/crates/tauri/src/path/mod.rs index 7d786f844e0e..28854fb547ff 100644 --- a/crates/tauri/src/path/mod.rs +++ b/crates/tauri/src/path/mod.rs @@ -122,6 +122,8 @@ pub enum BaseDirectory { /// Resolves to [`BaseDirectory::Home`]`/Library/Logs/{bundle_identifier}` on macOS /// and [`BaseDirectory::Config`]`/{bundle_identifier}/logs` on linux and Windows. AppLog, + /// The Home directory. + Home, /// The Desktop directory. #[cfg(not(target_os = "android"))] @@ -132,9 +134,6 @@ pub enum BaseDirectory { /// The Font directory. #[cfg(not(target_os = "android"))] Font, - /// The Home directory. - #[cfg(not(target_os = "android"))] - Home, /// The Runtime directory. #[cfg(not(target_os = "android"))] Runtime, @@ -164,6 +163,7 @@ impl BaseDirectory { Self::AppLocalData => "$APPLOCALDATA", Self::AppCache => "$APPCACHE", Self::AppLog => "$APPLOG", + Self::Home => "$HOME", #[cfg(not(target_os = "android"))] Self::Desktop => "$DESKTOP", @@ -172,8 +172,6 @@ impl BaseDirectory { #[cfg(not(target_os = "android"))] Self::Font => "$FONT", #[cfg(not(target_os = "android"))] - Self::Home => "$HOME", - #[cfg(not(target_os = "android"))] Self::Runtime => "$RUNTIME", #[cfg(not(target_os = "android"))] Self::Template => "$TEMPLATE", @@ -201,6 +199,7 @@ impl BaseDirectory { "$APPLOCALDATA" => Self::AppLocalData, "$APPCACHE" => Self::AppCache, "$APPLOG" => Self::AppLog, + "$HOME" => Self::Home, #[cfg(not(target_os = "android"))] "$DESKTOP" => Self::Desktop, @@ -209,8 +208,6 @@ impl BaseDirectory { #[cfg(not(target_os = "android"))] "$FONT" => Self::Font, #[cfg(not(target_os = "android"))] - "$HOME" => Self::Home, - #[cfg(not(target_os = "android"))] "$RUNTIME" => Self::Runtime, #[cfg(not(target_os = "android"))] "$TEMPLATE" => Self::Template, @@ -302,6 +299,7 @@ fn resolve_path( BaseDirectory::AppLocalData => resolver.app_local_data_dir(), BaseDirectory::AppCache => resolver.app_cache_dir(), BaseDirectory::AppLog => resolver.app_log_dir(), + BaseDirectory::Home => resolver.home_dir(), #[cfg(not(target_os = "android"))] BaseDirectory::Desktop => resolver.desktop_dir(), #[cfg(not(target_os = "android"))] @@ -309,8 +307,6 @@ fn resolve_path( #[cfg(not(target_os = "android"))] BaseDirectory::Font => resolver.font_dir(), #[cfg(not(target_os = "android"))] - BaseDirectory::Home => resolver.home_dir(), - #[cfg(not(target_os = "android"))] BaseDirectory::Runtime => resolver.runtime_dir(), #[cfg(not(target_os = "android"))] BaseDirectory::Template => resolver.template_dir(), From 0014f9ae6906e289dfd209d8bcfed9ea6e44a72d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:15:04 +0800 Subject: [PATCH 03/14] chore(deps) Update dependency @types/node to v20.17.0 (#11470) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- packages/api/package.json | 2 +- pnpm-lock.yaml | 58 +++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/api/package.json b/packages/api/package.json index 1b6bdba78f27..6cc4702fd46f 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -48,7 +48,7 @@ "@rollup/plugin-terser": "0.4.4", "@rollup/plugin-typescript": "12.1.1", "@types/eslint": "^9.0.0", - "@types/node": "20.16.15", + "@types/node": "20.17.0", "eslint": "^9.4.0", "eslint-config-prettier": "9.1.0", "eslint-plugin-security": "3.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 50d41e033e59..2e1c4b2dab5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -39,7 +39,7 @@ importers: version: 1.1.14 '@sveltejs/vite-plugin-svelte': specifier: ^3.1.2 - version: 3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + version: 3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) '@unocss/extractor-svelte': specifier: ^0.61.0 version: 0.61.9 @@ -48,10 +48,10 @@ importers: version: 4.2.19 unocss: specifier: ^0.61.0 - version: 0.61.9(postcss@8.4.47)(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + version: 0.61.9(postcss@8.4.47)(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) vite: specifier: ^5.4.7 - version: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + version: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) examples/file-associations: {} @@ -72,8 +72,8 @@ importers: specifier: ^9.0.0 version: 9.6.1 '@types/node': - specifier: 20.16.15 - version: 20.16.15 + specifier: 20.17.0 + version: 20.17.0 eslint: specifier: ^9.4.0 version: 9.13.0(jiti@1.21.6) @@ -1062,8 +1062,8 @@ packages: '@types/node@20.16.1': resolution: {integrity: sha512-zJDo7wEadFtSyNz5QITDfRcrhqDvQI1xQNQ0VoizPjM/dVAODqqIUWbJPkvsxmTI0MYRGRikcdjMPhOssnPejQ==} - '@types/node@20.16.15': - resolution: {integrity: sha512-DV58qQz9dBMqVVn+qnKwGa51QzCD4YM/tQM16qLKxdf5tqz5W4QwtrMzjSTbabN1cFTSuyxVYBy+QWHjWW8X/g==} + '@types/node@20.17.0': + resolution: {integrity: sha512-a7zRo0f0eLo9K5X9Wp5cAqTUNGzuFLDG2R7C4HY2BhcMAsxgSPuRvAC1ZB6QkuUQXf0YZAgfOX2ZyrBa2n4nHQ==} '@typescript-eslint/eslint-plugin@8.11.0': resolution: {integrity: sha512-KhGn2LjW1PJT2A/GfDpiyOfS4a8xHQv2myUagTM5+zsormOmBlYsnQ6pobJ8XxJmh6hnHwa2Mbe3fPrDJoDhbA==} @@ -3086,26 +3086,26 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.24.0': optional: true - '@sveltejs/vite-plugin-svelte-inspector@2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)))(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6))': + '@sveltejs/vite-plugin-svelte-inspector@2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)))(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6))': dependencies: - '@sveltejs/vite-plugin-svelte': 3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + '@sveltejs/vite-plugin-svelte': 3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) debug: 4.3.6 svelte: 4.2.19 - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) transitivePeerDependencies: - supports-color - '@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6))': + '@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6))': dependencies: - '@sveltejs/vite-plugin-svelte-inspector': 2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)))(svelte@4.2.19)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + '@sveltejs/vite-plugin-svelte-inspector': 2.1.0(@sveltejs/vite-plugin-svelte@3.1.2(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)))(svelte@4.2.19)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) debug: 4.3.6 deepmerge: 4.3.1 kleur: 4.1.5 magic-string: 0.30.11 svelte: 4.2.19 svelte-hmr: 0.16.0(svelte@4.2.19) - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) - vitefu: 0.2.5(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) + vitefu: 0.2.5(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) transitivePeerDependencies: - supports-color @@ -3122,13 +3122,13 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 20.16.15 + '@types/node': 20.17.0 '@types/node@20.16.1': dependencies: undici-types: 6.19.8 - '@types/node@20.16.15': + '@types/node@20.17.0': dependencies: undici-types: 6.19.8 @@ -3213,13 +3213,13 @@ snapshots: '@typescript-eslint/types': 8.11.0 eslint-visitor-keys: 3.4.3 - '@unocss/astro@0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6))': + '@unocss/astro@0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6))': dependencies: '@unocss/core': 0.61.9 '@unocss/reset': 0.61.9 - '@unocss/vite': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + '@unocss/vite': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) optionalDependencies: - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) transitivePeerDependencies: - rollup - supports-color @@ -3358,7 +3358,7 @@ snapshots: dependencies: '@unocss/core': 0.61.9 - '@unocss/vite@0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6))': + '@unocss/vite@0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6))': dependencies: '@ampproject/remapping': 2.3.0 '@rollup/pluginutils': 5.1.0(rollup@4.24.0) @@ -3370,7 +3370,7 @@ snapshots: chokidar: 3.6.0 fast-glob: 3.3.2 magic-string: 0.30.11 - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) transitivePeerDependencies: - rollup - supports-color @@ -4430,9 +4430,9 @@ snapshots: pathe: 1.1.2 ufo: 1.5.4 - unocss@0.61.9(postcss@8.4.47)(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)): + unocss@0.61.9(postcss@8.4.47)(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)): dependencies: - '@unocss/astro': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + '@unocss/astro': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) '@unocss/cli': 0.61.9(rollup@4.24.0) '@unocss/core': 0.61.9 '@unocss/extractor-arbitrary-variants': 0.61.9 @@ -4451,9 +4451,9 @@ snapshots: '@unocss/transformer-compile-class': 0.61.9 '@unocss/transformer-directives': 0.61.9 '@unocss/transformer-variant-group': 0.61.9 - '@unocss/vite': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)) + '@unocss/vite': 0.61.9(rollup@4.24.0)(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)) optionalDependencies: - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) transitivePeerDependencies: - postcss - rollup @@ -4508,20 +4508,20 @@ snapshots: sass: 1.77.8 terser: 5.31.6 - vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6): + vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6): dependencies: esbuild: 0.21.5 postcss: 8.4.47 rollup: 4.22.4 optionalDependencies: - '@types/node': 20.16.15 + '@types/node': 20.17.0 fsevents: 2.3.3 sass: 1.77.8 terser: 5.31.6 - vitefu@0.2.5(vite@5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6)): + vitefu@0.2.5(vite@5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6)): optionalDependencies: - vite: 5.4.7(@types/node@20.16.15)(sass@1.77.8)(terser@5.31.6) + vite: 5.4.7(@types/node@20.17.0)(sass@1.77.8)(terser@5.31.6) vitest@2.1.1(@types/node@20.16.1)(sass@1.77.8)(terser@5.31.6): dependencies: From 888277ec405eff0c52b86db790c931b5dff87b71 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 13:23:24 +0800 Subject: [PATCH 04/14] chore(deps) Update Rust crate syn to v2.0.85 (#11472) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 118 ++++++++++++++++++++++++++--------------------------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 246b88e14e3a..07a50590efe6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -422,7 +422,7 @@ checksum = "0ae92a5119aa49cdbcf6b9f893fe4e1d98b04ccbf82ee0584ad948a44a734dea" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -507,7 +507,7 @@ checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -1265,7 +1265,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "syn_derive", ] @@ -1697,7 +1697,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2144,7 +2144,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13b588ba4ac1a99f7f2964d24b3d896ddc6bf847ee3855dbd4366f058cfcd331" dependencies = [ "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2154,7 +2154,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2201,7 +2201,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2225,7 +2225,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2236,7 +2236,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2313,7 +2313,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2334,7 +2334,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2344,7 +2344,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" dependencies = [ "derive_builder_core", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2357,7 +2357,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2468,7 +2468,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2491,7 +2491,7 @@ checksum = "f2b99bf03862d7f545ebc28ddd33a665b50865f4dfd84031a393823879bd4c54" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -2740,7 +2740,7 @@ checksum = "ba7795da175654fe16979af73f81f26a8ea27638d8d9823d317016888a63dc4c" dependencies = [ "num-traits", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -3018,7 +3018,7 @@ checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -3143,7 +3143,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -3417,7 +3417,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -3542,7 +3542,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -4150,7 +4150,7 @@ checksum = "c34819042dc3d3971c46c2190835914dfbe0c3c13f61449b2997f4e9722dfa60" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -4976,7 +4976,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5116,7 +5116,7 @@ dependencies = [ "napi-derive-backend", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5131,7 +5131,7 @@ dependencies = [ "quote", "regex", "semver", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5362,7 +5362,7 @@ checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5424,7 +5424,7 @@ dependencies = [ "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5755,7 +5755,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -5866,7 +5866,7 @@ checksum = "197b36739db0e80919e19a90785233eea5664697d4cd829bd49af34838ec43d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -6125,7 +6125,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -6184,7 +6184,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -6366,7 +6366,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -6425,7 +6425,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -6642,7 +6642,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "version_check", "yansi", ] @@ -6663,7 +6663,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8021cf59c8ec9c432cfc2526ac6b8aa508ecaf29cd415f271b8406c1b851c3fd" dependencies = [ "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -7685,7 +7685,7 @@ dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -7711,7 +7711,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -7905,7 +7905,7 @@ checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -7916,7 +7916,7 @@ checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -7959,7 +7959,7 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -8010,7 +8010,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -8048,7 +8048,7 @@ checksum = "82fe9db325bcef1fbcde82e078a5cc4efdf787e96b3b9cf45b50b529f2083d67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -8440,7 +8440,7 @@ dependencies = [ "Inflector", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -8661,9 +8661,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.83" +version = "2.0.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01680f5d178a369f817f43f3d399650272873a8e7588a7872f7e90edc71d60a3" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" dependencies = [ "proc-macro2", "quote", @@ -8679,7 +8679,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -8803,7 +8803,7 @@ checksum = "f4e16beb8b2ac17db28eab8bca40e62dbfbb34c0fcdc6d9826b11b7b5d047dfd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -9062,7 +9062,7 @@ dependencies = [ "serde", "serde_json", "sha2", - "syn 2.0.83", + "syn 2.0.85", "tauri-utils 2.0.2", "thiserror", "time", @@ -9136,7 +9136,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "tauri-codegen", "tauri-utils 2.0.2", ] @@ -9476,7 +9476,7 @@ checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -9603,7 +9603,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -9809,7 +9809,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -10380,7 +10380,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "wasm-bindgen-shared", ] @@ -10414,7 +10414,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -10529,7 +10529,7 @@ checksum = "1d228f15bba3b9d56dde8bddbee66fa24545bd17b48d5128ccf4a8742b18e431" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -10664,7 +10664,7 @@ checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -10675,7 +10675,7 @@ checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -11051,7 +11051,7 @@ dependencies = [ "async-trait", "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", "wasm-bindgen", "wasm-bindgen-futures", "wasm-bindgen-macro-support", @@ -11251,7 +11251,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] @@ -11271,7 +11271,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.83", + "syn 2.0.85", ] [[package]] From a8105eccb2122f003b4a36bbfb747998f53c5f10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E8=89=AF=E4=BB=94?= <32487868+cijiugechu@users.noreply.github.com> Date: Thu, 24 Oct 2024 21:02:49 +0800 Subject: [PATCH 05/14] docs: fix wrongly rendered links on `docs.rs` (#11483) --- crates/tauri/src/path/desktop.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/tauri/src/path/desktop.rs b/crates/tauri/src/path/desktop.rs index ac7dd149f8e1..32463f993126 100644 --- a/crates/tauri/src/path/desktop.rs +++ b/crates/tauri/src/path/desktop.rs @@ -194,7 +194,7 @@ impl PathResolver { /// Returns the path to the suggested directory for your app's config files. /// - /// Resolves to [`config_dir`](self.config_dir)`/${bundle_identifier}`. + /// Resolves to [`config_dir`](Self::config_dir)`/${bundle_identifier}`. pub fn app_config_dir(&self) -> Result { dirs::config_dir() .ok_or(Error::UnknownPath) @@ -203,7 +203,7 @@ impl PathResolver { /// Returns the path to the suggested directory for your app's data files. /// - /// Resolves to [`data_dir`](self.data_dir)`/${bundle_identifier}`. + /// Resolves to [`data_dir`](Self::data_dir)`/${bundle_identifier}`. pub fn app_data_dir(&self) -> Result { dirs::data_dir() .ok_or(Error::UnknownPath) @@ -212,7 +212,7 @@ impl PathResolver { /// Returns the path to the suggested directory for your app's local data files. /// - /// Resolves to [`local_data_dir`](self.local_data_dir)`/${bundle_identifier}`. + /// Resolves to [`local_data_dir`](Self::local_data_dir)`/${bundle_identifier}`. pub fn app_local_data_dir(&self) -> Result { dirs::data_local_dir() .ok_or(Error::UnknownPath) @@ -221,7 +221,7 @@ impl PathResolver { /// Returns the path to the suggested directory for your app's cache files. /// - /// Resolves to [`cache_dir`](self.cache_dir)`/${bundle_identifier}`. + /// Resolves to [`cache_dir`](Self::cache_dir)`/${bundle_identifier}`. pub fn app_cache_dir(&self) -> Result { dirs::cache_dir() .ok_or(Error::UnknownPath) @@ -232,9 +232,9 @@ impl PathResolver { /// /// ## Platform-specific /// - /// - **Linux:** Resolves to [`data_local_dir`](self.data_local_dir)`/${bundle_identifier}/logs`. - /// - **macOS:** Resolves to [`home_dir`](self.home_dir)`/Library/Logs/${bundle_identifier}` - /// - **Windows:** Resolves to [`data_local_dir`](self.data_local_dir)`/${bundle_identifier}/logs`. + /// - **Linux:** Resolves to [`local_data_dir`](Self::local_data_dir)`/${bundle_identifier}/logs`. + /// - **macOS:** Resolves to [`home_dir`](Self::home_dir)`/Library/Logs/${bundle_identifier}` + /// - **Windows:** Resolves to [`local_data_dir`](Self::local_data_dir)`/${bundle_identifier}/logs`. pub fn app_log_dir(&self) -> Result { #[cfg(target_os = "macos")] let path = dirs::home_dir() From ac22950f39eb8bc0556823472c68bf250d3bd684 Mon Sep 17 00:00:00 2001 From: Vincent Esche <138017+regexident@users.noreply.github.com> Date: Sun, 27 Oct 2024 21:55:23 +0100 Subject: [PATCH 06/14] fix(cli): Fix mixup of `TAURI_APP_PATH` and `TAURI_FRONTEND_PATH` (#11492) * Fix mixup of `env_tauri_app_path()` and `env_tauri_frontend_path()` in tauri's path resolutions * Rename functions in `app_paths` to match their corresponding, publicly exposed env var keys * Rename `app_dir`/`app_path` variables that deal with the frontend app's directory to `frontend_dir * Rename `APP_DIR` to `FRONTEND_DIR` * Improve comment on meaning of tauri path env vars --- crates/tauri-cli/src/acl/permission/ls.rs | 3 +- crates/tauri-cli/src/add.rs | 6 ++-- crates/tauri-cli/src/dev.rs | 4 +-- crates/tauri-cli/src/helpers/app_paths.rs | 29 ++++++++++--------- crates/tauri-cli/src/helpers/mod.rs | 4 +-- crates/tauri-cli/src/helpers/npm.rs | 26 +++++++++++------ crates/tauri-cli/src/info/app.rs | 6 ++-- crates/tauri-cli/src/info/mod.rs | 24 ++++++++------- crates/tauri-cli/src/info/packages_nodejs.rs | 16 +++++----- crates/tauri-cli/src/info/packages_rust.rs | 4 +-- crates/tauri-cli/src/info/plugins.rs | 14 +++++---- crates/tauri-cli/src/interface/rust.rs | 23 ++++++++++----- .../src/migrate/migrations/v1/frontend.rs | 12 ++++---- .../src/migrate/migrations/v1/mod.rs | 6 ++-- .../tauri-cli/src/migrate/migrations/v2_rc.rs | 14 ++++----- 15 files changed, 107 insertions(+), 84 deletions(-) diff --git a/crates/tauri-cli/src/acl/permission/ls.rs b/crates/tauri-cli/src/acl/permission/ls.rs index 521caf70ebca..69611e3f9b62 100644 --- a/crates/tauri-cli/src/acl/permission/ls.rs +++ b/crates/tauri-cli/src/acl/permission/ls.rs @@ -23,8 +23,7 @@ pub struct Options { pub fn command(options: Options) -> Result<()> { crate::helpers::app_paths::resolve(); - let tauri_dir = tauri_dir(); - let acl_manifests_path = tauri_dir + let acl_manifests_path = tauri_dir() .join("gen") .join("schemas") .join("acl-manifests.json"); diff --git a/crates/tauri-cli/src/add.rs b/crates/tauri-cli/src/add.rs index d961e33a7520..ceb73533326e 100644 --- a/crates/tauri-cli/src/add.rs +++ b/crates/tauri-cli/src/add.rs @@ -9,7 +9,7 @@ use regex::Regex; use crate::{ acl, helpers::{ - app_paths::{resolve_app_dir, tauri_dir}, + app_paths::{resolve_frontend_dir, tauri_dir}, cargo, npm::PackageManager, }, @@ -56,7 +56,7 @@ pub fn run(options: Options) -> Result<()> { let mut plugins = crate::helpers::plugins::known_plugins(); let metadata = plugins.remove(plugin).unwrap_or_default(); - let app_dir = resolve_app_dir(); + let frontend_dir = resolve_frontend_dir(); let tauri_dir = tauri_dir(); let target_str = metadata @@ -81,7 +81,7 @@ pub fn run(options: Options) -> Result<()> { })?; if !metadata.rust_only { - if let Some(manager) = app_dir + if let Some(manager) = frontend_dir .map(PackageManager::from_project) .and_then(|managers| managers.into_iter().next()) { diff --git a/crates/tauri-cli/src/dev.rs b/crates/tauri-cli/src/dev.rs index a026d572f4b0..fdeaabe9cea0 100644 --- a/crates/tauri-cli/src/dev.rs +++ b/crates/tauri-cli/src/dev.rs @@ -4,7 +4,7 @@ use crate::{ helpers::{ - app_paths::{app_dir, tauri_dir}, + app_paths::{frontend_dir, tauri_dir}, command_env, config::{ get as get_config, reload as reload_config, BeforeDevCommand, ConfigHandle, FrontendDist, @@ -140,7 +140,7 @@ pub fn setup(interface: &AppInterface, options: &mut Options, config: ConfigHand (Some(script), cwd.map(Into::into), wait) } }; - let cwd = script_cwd.unwrap_or_else(|| app_dir().clone()); + let cwd = script_cwd.unwrap_or_else(|| frontend_dir().clone()); if let Some(before_dev) = script { log::info!(action = "Running"; "BeforeDevCommand (`{}`)", before_dev); let mut env = command_env(true); diff --git a/crates/tauri-cli/src/helpers/app_paths.rs b/crates/tauri-cli/src/helpers/app_paths.rs index 8ece080caf81..6c5b5da5aac0 100644 --- a/crates/tauri-cli/src/helpers/app_paths.rs +++ b/crates/tauri-cli/src/helpers/app_paths.rs @@ -18,12 +18,12 @@ use tauri_utils::{ }; const TAURI_GITIGNORE: &[u8] = include_bytes!("../../tauri.gitignore"); -// path to the Tauri app (Rust crate) directory, usually /src-tauri +// path to the Tauri app (Rust crate) directory, usually `/src-tauri/` const ENV_TAURI_APP_PATH: &str = "TAURI_APP_PATH"; -// path to the frontend app directory +// path to the frontend app directory, usually `/` const ENV_TAURI_FRONTEND_PATH: &str = "TAURI_FRONTEND_PATH"; -static APP_DIR: OnceLock = OnceLock::new(); +static FRONTEND_DIR: OnceLock = OnceLock::new(); static TAURI_DIR: OnceLock = OnceLock::new(); pub fn walk_builder(path: &Path) -> WalkBuilder { @@ -90,7 +90,7 @@ fn env_tauri_frontend_path() -> Option { } pub fn resolve_tauri_dir() -> Option { - let src_dir = env_tauri_frontend_path().or_else(|| current_dir().ok())?; + let src_dir = env_tauri_app_path().or_else(|| current_dir().ok())?; if src_dir.join(ConfigFormat::Json.into_file_name()).exists() || src_dir.join(ConfigFormat::Json5.into_file_name()).exists() @@ -113,7 +113,7 @@ pub fn resolve_tauri_dir() -> Option { pub fn resolve() { TAURI_DIR.set(resolve_tauri_dir().unwrap_or_else(|| { - let env_var_name = env_tauri_frontend_path().is_some().then(|| format!("`{ENV_TAURI_FRONTEND_PATH}`")); + let env_var_name = env_tauri_app_path().is_some().then(|| format!("`{ENV_TAURI_APP_PATH}`")); panic!("Couldn't recognize the {} folder as a Tauri project. It must contain a `{}`, `{}` or `{}` file in any subfolder.", env_var_name.as_deref().unwrap_or("current"), ConfigFormat::Json.into_file_name(), @@ -121,8 +121,8 @@ pub fn resolve() { ConfigFormat::Toml.into_file_name() ) })).expect("tauri dir already resolved"); - APP_DIR - .set(resolve_app_dir().unwrap_or_else(|| tauri_dir().parent().unwrap().to_path_buf())) + FRONTEND_DIR + .set(resolve_frontend_dir().unwrap_or_else(|| tauri_dir().parent().unwrap().to_path_buf())) .expect("app dir already resolved"); } @@ -132,14 +132,15 @@ pub fn tauri_dir() -> &'static PathBuf { .expect("app paths not initialized, this is a Tauri CLI bug") } -pub fn resolve_app_dir() -> Option { - let app_dir = env_tauri_app_path().unwrap_or_else(|| current_dir().expect("failed to read cwd")); +pub fn resolve_frontend_dir() -> Option { + let frontend_dir = + env_tauri_frontend_path().unwrap_or_else(|| current_dir().expect("failed to read cwd")); - if app_dir.join("package.json").exists() { - return Some(app_dir); + if frontend_dir.join("package.json").exists() { + return Some(frontend_dir); } - lookup(&app_dir, |path| { + lookup(&frontend_dir, |path| { if let Some(file_name) = path.file_name() { file_name == OsStr::new("package.json") } else { @@ -149,8 +150,8 @@ pub fn resolve_app_dir() -> Option { .map(|p| p.parent().unwrap().to_path_buf()) } -pub fn app_dir() -> &'static PathBuf { - APP_DIR +pub fn frontend_dir() -> &'static PathBuf { + FRONTEND_DIR .get() .expect("app paths not initialized, this is a Tauri CLI bug") } diff --git a/crates/tauri-cli/src/helpers/mod.rs b/crates/tauri-cli/src/helpers/mod.rs index 24d3e6a07732..5eaa06475364 100644 --- a/crates/tauri-cli/src/helpers/mod.rs +++ b/crates/tauri-cli/src/helpers/mod.rs @@ -31,7 +31,7 @@ use crate::{ CommandExt, }; -use self::app_paths::app_dir; +use self::app_paths::frontend_dir; pub fn command_env(debug: bool) -> HashMap<&'static str, String> { let mut map = HashMap::new(); @@ -80,7 +80,7 @@ pub fn run_hook( HookCommand::Script(s) => (Some(s), None), HookCommand::ScriptWithOptions { script, cwd } => (Some(script), cwd.map(Into::into)), }; - let cwd = script_cwd.unwrap_or_else(|| app_dir().clone()); + let cwd = script_cwd.unwrap_or_else(|| frontend_dir().clone()); if let Some(script) = script { log::info!(action = "Running"; "{} `{}`", name, script); diff --git a/crates/tauri-cli/src/helpers/npm.rs b/crates/tauri-cli/src/helpers/npm.rs index f1f9d8db014a..8e6134bb1bf9 100644 --- a/crates/tauri-cli/src/helpers/npm.rs +++ b/crates/tauri-cli/src/helpers/npm.rs @@ -70,7 +70,11 @@ impl PackageManager { } } - pub fn install>(&self, dependencies: &[String], app_dir: P) -> crate::Result<()> { + pub fn install>( + &self, + dependencies: &[String], + frontend_dir: P, + ) -> crate::Result<()> { let dependencies_str = if dependencies.len() > 1 { "dependencies" } else { @@ -89,7 +93,7 @@ impl PackageManager { .cross_command() .arg("add") .args(dependencies) - .current_dir(app_dir) + .current_dir(frontend_dir) .status() .with_context(|| format!("failed to run {self}"))?; @@ -100,7 +104,11 @@ impl PackageManager { Ok(()) } - pub fn remove>(&self, dependencies: &[String], app_dir: P) -> crate::Result<()> { + pub fn remove>( + &self, + dependencies: &[String], + frontend_dir: P, + ) -> crate::Result<()> { let dependencies_str = if dependencies.len() > 1 { "dependencies" } else { @@ -123,7 +131,7 @@ impl PackageManager { "remove" }) .args(dependencies) - .current_dir(app_dir) + .current_dir(frontend_dir) .status() .with_context(|| format!("failed to run {self}"))?; @@ -137,7 +145,7 @@ impl PackageManager { pub fn current_package_version>( &self, name: &str, - app_dir: P, + frontend_dir: P, ) -> crate::Result> { let (output, regex) = match self { PackageManager::Yarn => ( @@ -145,7 +153,7 @@ impl PackageManager { .args(["list", "--pattern"]) .arg(name) .args(["--depth", "0"]) - .current_dir(app_dir) + .current_dir(frontend_dir) .output()?, None, ), @@ -154,7 +162,7 @@ impl PackageManager { .arg("info") .arg(name) .arg("--json") - .current_dir(app_dir) + .current_dir(frontend_dir) .output()?, Some(regex::Regex::new("\"Version\":\"([\\da-zA-Z\\-\\.]+)\"").unwrap()), ), @@ -163,7 +171,7 @@ impl PackageManager { .arg("list") .arg(name) .args(["--parseable", "--depth", "0"]) - .current_dir(app_dir) + .current_dir(frontend_dir) .output()?, None, ), @@ -173,7 +181,7 @@ impl PackageManager { .arg("list") .arg(name) .args(["version", "--depth", "0"]) - .current_dir(app_dir) + .current_dir(frontend_dir) .output()?, None, ), diff --git a/crates/tauri-cli/src/info/app.rs b/crates/tauri-cli/src/info/app.rs index ab3646a9549a..6987ff08b374 100644 --- a/crates/tauri-cli/src/info/app.rs +++ b/crates/tauri-cli/src/info/app.rs @@ -10,7 +10,7 @@ use std::{ }; use tauri_utils::platform::Target; -pub fn items(app_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec { +pub fn items(frontend_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec { let mut items = Vec::new(); if tauri_dir.is_some() { if let Ok(config) = crate::helpers::config::get(Target::current(), None) { @@ -41,8 +41,8 @@ pub fn items(app_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec
Result<()> { let Options { interactive } = options; - let app_dir = crate::helpers::app_paths::resolve_app_dir(); - let tauri_dir = crate::helpers::app_paths::resolve_tauri_dir(); + let frontend_dir = resolve_frontend_dir(); + let tauri_dir = resolve_tauri_dir(); if tauri_dir.is_some() { // safe to initialize crate::helpers::app_paths::resolve(); } - let package_manager = app_dir + let package_manager = frontend_dir .as_ref() .map(packages_nodejs::package_manager) .unwrap_or(crate::helpers::npm::PackageManager::Npm); @@ -288,11 +291,12 @@ pub fn command(options: Options) -> Result<()> { interactive, items: Vec::new(), }; - packages - .items - .extend(packages_rust::items(app_dir.as_ref(), tauri_dir.as_deref())); + packages.items.extend(packages_rust::items( + frontend_dir.as_ref(), + tauri_dir.as_deref(), + )); packages.items.extend(packages_nodejs::items( - app_dir.as_ref(), + frontend_dir.as_ref(), package_manager, &metadata, )); @@ -300,7 +304,7 @@ pub fn command(options: Options) -> Result<()> { let mut plugins = Section { label: "Plugins", interactive, - items: plugins::items(app_dir.as_ref(), tauri_dir.as_deref(), package_manager), + items: plugins::items(frontend_dir.as_ref(), tauri_dir.as_deref(), package_manager), }; let mut app = Section { @@ -310,7 +314,7 @@ pub fn command(options: Options) -> Result<()> { }; app .items - .extend(app::items(app_dir.as_ref(), tauri_dir.as_deref())); + .extend(app::items(frontend_dir.as_ref(), tauri_dir.as_deref())); environment.display(); packages.display(); diff --git a/crates/tauri-cli/src/info/packages_nodejs.rs b/crates/tauri-cli/src/info/packages_nodejs.rs index db4c9dad4f86..f484ffd20e7a 100644 --- a/crates/tauri-cli/src/info/packages_nodejs.rs +++ b/crates/tauri-cli/src/info/packages_nodejs.rs @@ -76,8 +76,8 @@ pub fn npm_latest_version(pm: &PackageManager, name: &str) -> crate::Result PackageManager { - let found = PackageManager::from_project(app_dir); +pub fn package_manager(frontend_dir: &PathBuf) -> PackageManager { + let found = PackageManager::from_project(frontend_dir); if found.is_empty() { println!( @@ -110,18 +110,18 @@ pub fn package_manager(app_dir: &PathBuf) -> PackageManager { } pub fn items( - app_dir: Option<&PathBuf>, + frontend_dir: Option<&PathBuf>, package_manager: PackageManager, metadata: &VersionMetadata, ) -> Vec { let mut items = Vec::new(); - if let Some(app_dir) = app_dir { + if let Some(frontend_dir) = frontend_dir { for (package, version) in [ ("@tauri-apps/api", None), ("@tauri-apps/cli", Some(metadata.js_cli.version.clone())), ] { - let app_dir = app_dir.clone(); - let item = nodejs_section_item(package.into(), version, app_dir, package_manager); + let frontend_dir = frontend_dir.clone(); + let item = nodejs_section_item(package.into(), version, frontend_dir, package_manager); items.push(item); } } @@ -132,13 +132,13 @@ pub fn items( pub fn nodejs_section_item( package: String, version: Option, - app_dir: PathBuf, + frontend_dir: PathBuf, package_manager: PackageManager, ) -> SectionItem { SectionItem::new().action(move || { let version = version.clone().unwrap_or_else(|| { package_manager - .current_package_version(&package, &app_dir) + .current_package_version(&package, &frontend_dir) .unwrap_or_default() .unwrap_or_default() }); diff --git a/crates/tauri-cli/src/info/packages_rust.rs b/crates/tauri-cli/src/info/packages_rust.rs index 2778335babdc..0f3ca19e6907 100644 --- a/crates/tauri-cli/src/info/packages_rust.rs +++ b/crates/tauri-cli/src/info/packages_rust.rs @@ -13,10 +13,10 @@ use colored::Colorize; use std::fs::read_to_string; use std::path::{Path, PathBuf}; -pub fn items(app_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec { +pub fn items(frontend_dir: Option<&PathBuf>, tauri_dir: Option<&Path>) -> Vec { let mut items = Vec::new(); - if tauri_dir.is_some() || app_dir.is_some() { + if tauri_dir.is_some() || frontend_dir.is_some() { if let Some(tauri_dir) = tauri_dir { let manifest: Option = if let Ok(manifest_contents) = read_to_string(tauri_dir.join("Cargo.toml")) { diff --git a/crates/tauri-cli/src/info/plugins.rs b/crates/tauri-cli/src/info/plugins.rs index d4c1d785c98d..cc7cd7d0a3c6 100644 --- a/crates/tauri-cli/src/info/plugins.rs +++ b/crates/tauri-cli/src/info/plugins.rs @@ -19,13 +19,13 @@ use crate::{ use super::{packages_nodejs, packages_rust, SectionItem}; pub fn items( - app_dir: Option<&PathBuf>, + frontend_dir: Option<&PathBuf>, tauri_dir: Option<&Path>, package_manager: PackageManager, ) -> Vec { let mut items = Vec::new(); - if tauri_dir.is_some() || app_dir.is_some() { + if tauri_dir.is_some() || frontend_dir.is_some() { if let Some(tauri_dir) = tauri_dir { let manifest: Option = if let Ok(manifest_contents) = fs::read_to_string(tauri_dir.join("Cargo.toml")) { @@ -48,14 +48,18 @@ pub fn items( let item = packages_rust::rust_section_item(&dep, crate_version); items.push(item); - let Some(app_dir) = app_dir else { + let Some(frontend_dir) = frontend_dir else { continue; }; let package = format!("@tauri-apps/plugin-{p}"); - let item = - packages_nodejs::nodejs_section_item(package, None, app_dir.clone(), package_manager); + let item = packages_nodejs::nodejs_section_item( + package, + None, + frontend_dir.clone(), + package_manager, + ); items.push(item); } } diff --git a/crates/tauri-cli/src/interface/rust.rs b/crates/tauri-cli/src/interface/rust.rs index 9abbd6c412d9..08008171427b 100644 --- a/crates/tauri-cli/src/interface/rust.rs +++ b/crates/tauri-cli/src/interface/rust.rs @@ -29,7 +29,7 @@ use tauri_utils::config::{parse::is_configuration_file, DeepLinkProtocol, Update use super::{AppSettings, DevProcess, ExitReason, Interface}; use crate::{ helpers::{ - app_paths::{app_dir, tauri_dir}, + app_paths::{frontend_dir, tauri_dir}, config::{nsis_settings, reload as reload_config, wix_settings, BundleResources, Config}, }, ConfigValue, @@ -518,7 +518,7 @@ impl Rust { let process = Arc::new(Mutex::new(child)); let (tx, rx) = sync_channel(1); - let app_path = app_dir(); + let frontend_path = frontend_dir(); let watch_folders = get_watch_folders()?; @@ -572,7 +572,11 @@ impl Rust { log::info!( "File {} changed. Rebuilding application...", - display_path(event_path.strip_prefix(app_path).unwrap_or(&event_path)) + display_path( + event_path + .strip_prefix(frontend_path) + .unwrap_or(&event_path) + ) ); let mut p = process.lock().unwrap(); @@ -906,7 +910,9 @@ impl AppSettings for RustAppSettings { } } - let mut binaries_paths = std::fs::read_dir(tauri_dir().join("src/bin")) + let tauri_dir = tauri_dir(); + + let mut binaries_paths = std::fs::read_dir(tauri_dir.join("src/bin")) .map(|dir| { dir .into_iter() @@ -929,11 +935,11 @@ impl AppSettings for RustAppSettings { if !binaries_paths .iter() .any(|(_name, path)| path == Path::new("src/main.rs")) - && tauri_dir().join("src/main.rs").exists() + && tauri_dir.join("src/main.rs").exists() { binaries_paths.push(( self.cargo_package_settings.name.clone(), - tauri_dir().join("src/main.rs"), + tauri_dir.join("src/main.rs"), )); } @@ -998,8 +1004,9 @@ impl AppSettings for RustAppSettings { impl RustAppSettings { pub fn new(config: &Config, manifest: Manifest, target: Option) -> crate::Result { + let tauri_dir = tauri_dir(); let cargo_settings = - CargoSettings::load(tauri_dir()).with_context(|| "failed to load cargo settings")?; + CargoSettings::load(tauri_dir).with_context(|| "failed to load cargo settings")?; let cargo_package_settings = match &cargo_settings.package { Some(package_info) => package_info.clone(), None => { @@ -1073,7 +1080,7 @@ impl RustAppSettings { default_run: cargo_package_settings.default_run.clone(), }; - let cargo_config = CargoConfig::load(tauri_dir())?; + let cargo_config = CargoConfig::load(tauri_dir)?; let target_triple = target.unwrap_or_else(|| { cargo_config diff --git a/crates/tauri-cli/src/migrate/migrations/v1/frontend.rs b/crates/tauri-cli/src/migrate/migrations/v1/frontend.rs index b1399f962dea..83f906a905cc 100644 --- a/crates/tauri-cli/src/migrate/migrations/v1/frontend.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/frontend.rs @@ -68,7 +68,7 @@ const MODULES_MAP: phf::Map<&str, &str> = phf::phf_map! { const JS_EXTENSIONS: &[&str] = &["js", "mjs", "jsx", "ts", "mts", "tsx", "svelte", "vue"]; /// Returns a list of migrated plugins -pub fn migrate(app_dir: &Path) -> Result> { +pub fn migrate(frontend_dir: &Path) -> Result> { let mut new_npm_packages = Vec::new(); let mut new_plugins = Vec::new(); let mut npm_packages_to_remove = Vec::new(); @@ -84,14 +84,14 @@ pub fn migrate(app_dir: &Path) -> Result> { ) }; - let pm = PackageManager::from_project(app_dir) + let pm = PackageManager::from_project(frontend_dir) .into_iter() .next() .unwrap_or(PackageManager::Npm); for pkg in ["@tauri-apps/cli", "@tauri-apps/api"] { let version = pm - .current_package_version(pkg, app_dir) + .current_package_version(pkg, frontend_dir) .unwrap_or_default() .unwrap_or_default(); if version.starts_with('1') { @@ -99,7 +99,7 @@ pub fn migrate(app_dir: &Path) -> Result> { } } - for entry in walk_builder(app_dir).build().flatten() { + for entry in walk_builder(frontend_dir).build().flatten() { if entry.file_type().map(|t| t.is_file()).unwrap_or_default() { let path = entry.path(); let ext = path.extension().unwrap_or_default(); @@ -122,14 +122,14 @@ pub fn migrate(app_dir: &Path) -> Result> { if !npm_packages_to_remove.is_empty() { npm_packages_to_remove.sort(); npm_packages_to_remove.dedup(); - pm.remove(&npm_packages_to_remove, app_dir) + pm.remove(&npm_packages_to_remove, frontend_dir) .context("Error removing npm packages")?; } if !new_npm_packages.is_empty() { new_npm_packages.sort(); new_npm_packages.dedup(); - pm.install(&new_npm_packages, app_dir) + pm.install(&new_npm_packages, frontend_dir) .context("Error installing new npm packages")?; } diff --git a/crates/tauri-cli/src/migrate/migrations/v1/mod.rs b/crates/tauri-cli/src/migrate/migrations/v1/mod.rs index 26a7b7b20507..8be16e3e2b37 100644 --- a/crates/tauri-cli/src/migrate/migrations/v1/mod.rs +++ b/crates/tauri-cli/src/migrate/migrations/v1/mod.rs @@ -3,7 +3,7 @@ // SPDX-License-Identifier: MIT use crate::{ - helpers::app_paths::{app_dir, tauri_dir}, + helpers::app_paths::{frontend_dir, tauri_dir}, Result, }; @@ -15,11 +15,11 @@ mod manifest; pub fn run() -> Result<()> { let tauri_dir = tauri_dir(); - let app_dir = app_dir(); + let frontend_dir = frontend_dir(); let mut migrated = config::migrate(tauri_dir).context("Could not migrate config")?; manifest::migrate(tauri_dir).context("Could not migrate manifest")?; - let plugins = frontend::migrate(app_dir)?; + let plugins = frontend::migrate(frontend_dir)?; migrated.plugins.extend(plugins); diff --git a/crates/tauri-cli/src/migrate/migrations/v2_rc.rs b/crates/tauri-cli/src/migrate/migrations/v2_rc.rs index b90810d3a9f5..50ce8a37b10e 100644 --- a/crates/tauri-cli/src/migrate/migrations/v2_rc.rs +++ b/crates/tauri-cli/src/migrate/migrations/v2_rc.rs @@ -4,7 +4,7 @@ use crate::{ helpers::{ - app_paths::{app_dir, tauri_dir}, + app_paths::{frontend_dir, tauri_dir}, npm::PackageManager, }, interface::rust::manifest::{read_manifest, serialize_manifest}, @@ -17,7 +17,7 @@ use anyhow::Context; use toml_edit::{DocumentMut, Item, Table, TableLike, Value}; pub fn run() -> Result<()> { - let app_dir = app_dir(); + let frontend_dir = frontend_dir(); let tauri_dir = tauri_dir(); let manifest_path = tauri_dir.join("Cargo.toml"); @@ -26,7 +26,7 @@ pub fn run() -> Result<()> { migrate_permissions(tauri_dir)?; - migrate_npm_dependencies(app_dir)?; + migrate_npm_dependencies(frontend_dir)?; std::fs::write(&manifest_path, serialize_manifest(&manifest)) .context("failed to rewrite Cargo manifest")?; @@ -34,8 +34,8 @@ pub fn run() -> Result<()> { Ok(()) } -fn migrate_npm_dependencies(app_dir: &Path) -> Result<()> { - let pm = PackageManager::from_project(app_dir) +fn migrate_npm_dependencies(frontend_dir: &Path) -> Result<()> { + let pm = PackageManager::from_project(frontend_dir) .into_iter() .next() .unwrap_or(PackageManager::Npm); @@ -71,7 +71,7 @@ fn migrate_npm_dependencies(app_dir: &Path) -> Result<()> { "@tauri-apps/plugin-window-state", ] { let version = pm - .current_package_version(pkg, app_dir) + .current_package_version(pkg, frontend_dir) .unwrap_or_default() .unwrap_or_default(); if version.starts_with('1') { @@ -80,7 +80,7 @@ fn migrate_npm_dependencies(app_dir: &Path) -> Result<()> { } if !install_deps.is_empty() { - pm.install(&install_deps, app_dir)?; + pm.install(&install_deps, frontend_dir)?; } Ok(()) From 1065f632f204cc67263cf8a62eef29d0e0ac31e0 Mon Sep 17 00:00:00 2001 From: Alex Adewole Date: Mon, 28 Oct 2024 02:21:42 -0700 Subject: [PATCH 07/14] feat(cli): remove UNC path prefix in `TAURI_APP_PATH` and `TAURI_FRONTEND_PATH` (#11514) --- crates/tauri-cli/src/helpers/app_paths.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/tauri-cli/src/helpers/app_paths.rs b/crates/tauri-cli/src/helpers/app_paths.rs index 6c5b5da5aac0..b20b991ef368 100644 --- a/crates/tauri-cli/src/helpers/app_paths.rs +++ b/crates/tauri-cli/src/helpers/app_paths.rs @@ -79,6 +79,7 @@ fn env_tauri_app_path() -> Option { .ok()? .canonicalize() .ok() + .map(|p| dunce::simplified(&p).to_path_buf()) } fn env_tauri_frontend_path() -> Option { @@ -87,6 +88,7 @@ fn env_tauri_frontend_path() -> Option { .ok()? .canonicalize() .ok() + .map(|p| dunce::simplified(&p).to_path_buf()) } pub fn resolve_tauri_dir() -> Option { From c43d5df15828ecffa606482ea2b60350c488c981 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 28 Oct 2024 08:05:24 -0300 Subject: [PATCH 08/14] feat(cli): associate newly created capability with the main window (#11512) without this change the capability is not applied to any context and it might be hard for users to figure out why --- .changes/permission-add-default-windows.md | 6 ++++++ .github/workflows/publish-cli-js.yml | 1 - crates/tauri-cli/src/acl/permission/add.rs | 3 ++- crates/tauri-cli/src/mobile/ios/mod.rs | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 .changes/permission-add-default-windows.md diff --git a/.changes/permission-add-default-windows.md b/.changes/permission-add-default-windows.md new file mode 100644 index 000000000000..3540e83e44e9 --- /dev/null +++ b/.changes/permission-add-default-windows.md @@ -0,0 +1,6 @@ +--- +"@tauri-apps/cli": patch:enhance +"tauri-cli": patch:enhance +--- + +Associate a newly created capability file with the `main` window on the `tauri add` and `tauri permission add` commands. diff --git a/.github/workflows/publish-cli-js.yml b/.github/workflows/publish-cli-js.yml index 946198989a95..d12a8c490090 100644 --- a/.github/workflows/publish-cli-js.yml +++ b/.github/workflows/publish-cli-js.yml @@ -108,7 +108,6 @@ jobs: - uses: Swatinem/rust-cache@v1 with: key: ${{ matrix.settings.target }} - working-directory: 'crates/tauri-cli/' if: ${{ matrix.settings.docker }} - name: Setup toolchain run: ${{ matrix.settings.setup }} diff --git a/crates/tauri-cli/src/acl/permission/add.rs b/crates/tauri-cli/src/acl/permission/add.rs index 25cbe3bfe703..9ace7dcd9716 100644 --- a/crates/tauri-cli/src/acl/permission/add.rs +++ b/crates/tauri-cli/src/acl/permission/add.rs @@ -187,7 +187,8 @@ pub fn command(options: Options) -> Result<()> { capabilities.push(( TomlOrJson::Json(serde_json::json!({ "identifier": identifier, - "platforms": expected_platforms + "platforms": expected_platforms, + "windows": ["main"] })), capability_path, )); diff --git a/crates/tauri-cli/src/mobile/ios/mod.rs b/crates/tauri-cli/src/mobile/ios/mod.rs index a7236e5f9d5c..1e0e63a56ed4 100644 --- a/crates/tauri-cli/src/mobile/ios/mod.rs +++ b/crates/tauri-cli/src/mobile/ios/mod.rs @@ -132,7 +132,7 @@ pub fn get_config( log::warn!("No code signing certificates found. You must add one and set the certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. To list the available certificates, run `tauri info`."); None } - 1 =>None, + 1 => None, _ => { log::warn!("You must set the code signing certificate development team ID on the `bundle > iOS > developmentTeam` config value or the `{APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME}` environment variable. Available certificates: {}", teams.iter().map(|t| format!("{} (ID: {})", t.name, t.id)).collect::>().join(", ")); None From d25dd9e31d60de7716d70889a5839d75f4449e14 Mon Sep 17 00:00:00 2001 From: Andrii Bodnar Date: Tue, 29 Oct 2024 23:33:42 +0200 Subject: [PATCH 09/14] docs: fix capability configuration examples (#11537) --- crates/tauri-utils/src/acl/capability.rs | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/crates/tauri-utils/src/acl/capability.rs b/crates/tauri-utils/src/acl/capability.rs index b46464637279..a158ea7d3df7 100644 --- a/crates/tauri-utils/src/acl/capability.rs +++ b/crates/tauri-utils/src/acl/capability.rs @@ -93,15 +93,15 @@ impl<'de> Deserialize<'de> for PermissionEntry { /// "windows": [ /// "main" /// ], -/// "permissions": [ -/// "core:default", -/// "dialog:open", -/// { -/// "identifier": "fs:allow-write-text-file", -/// "allow": [{ "path": "$HOME/test.txt" }] -/// }, -/// ], -/// "platforms": ["macOS","windows"] +/// "permissions": [ +/// "core:default", +/// "dialog:open", +/// { +/// "identifier": "fs:allow-write-text-file", +/// "allow": [{ "path": "$HOME/test.txt" }] +/// }, +/// ], +/// "platforms": ["macOS","windows"] /// } /// ``` #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] @@ -175,13 +175,14 @@ pub struct Capability { /// /// ```json /// [ - /// "core:default", - /// "shell:allow-open", - /// "dialog:open", - /// { - /// "identifier": "fs:allow-write-text-file", - /// "allow": [{ "path": "$HOME/test.txt" }] - /// } + /// "core:default", + /// "shell:allow-open", + /// "dialog:open", + /// { + /// "identifier": "fs:allow-write-text-file", + /// "allow": [{ "path": "$HOME/test.txt" }] + /// } + /// ] /// ``` #[cfg_attr(feature = "schema", schemars(schema_with = "unique_permission"))] pub permissions: Vec, From 9f472591cca6e6b262cc6d5c2e0803440c264807 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 12:00:51 +0800 Subject: [PATCH 10/14] chore(deps) Update Rust crate serde to v1.0.214 (#11540) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07a50590efe6..fa877b2a98e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7835,9 +7835,9 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" -version = "1.0.213" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +checksum = "f55c3193aca71c12ad7890f1785d2b73e1b9f63a0bbc353c08ef26fe03fc56b5" dependencies = [ "serde_derive", ] @@ -7899,9 +7899,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.213" +version = "1.0.214" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +checksum = "de523f781f095e28fa605cdce0f8307e451cc0fd14e2eb4cd2e98a355b147766" dependencies = [ "proc-macro2", "quote", From 12ffc19ce08eeafdedc65207f312432aa2cf9c84 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Oct 2024 12:19:31 +0800 Subject: [PATCH 11/14] chore(deps) Update Rust crate regex to v1.11.1 (#11542) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa877b2a98e2..bf60de3db43b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7056,9 +7056,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", From 129414faa4e027c9035d56614682cacc0335a6a0 Mon Sep 17 00:00:00 2001 From: Amr Bashir Date: Mon, 4 Nov 2024 13:58:47 +0200 Subject: [PATCH 12/14] fix: fix webview not focused by default (#11569) * fix: fix webview not focused by default closes #10746 * fix compile * typo * fix compile again * clippy --- .changes/webview-focus-apis.md | 5 +++ .changes/webview-window-focused.md | 7 ++++ crates/tauri-cli/config.schema.json | 4 +- crates/tauri-runtime-wry/src/lib.rs | 3 +- crates/tauri-runtime/src/webview.rs | 18 ++++++-- .../schemas/capability.schema.json | 4 +- .../schemas/config.schema.json | 4 +- crates/tauri/src/webview/mod.rs | 7 ++++ crates/tauri/src/webview/plugin.rs | 42 ++++++++++++++----- crates/tauri/src/webview/webview_window.rs | 4 +- crates/tauri/src/window/mod.rs | 2 +- packages/api/src/webview.ts | 6 +++ 12 files changed, 82 insertions(+), 24 deletions(-) create mode 100644 .changes/webview-focus-apis.md create mode 100644 .changes/webview-window-focused.md diff --git a/.changes/webview-focus-apis.md b/.changes/webview-focus-apis.md new file mode 100644 index 000000000000..2d478fede8cd --- /dev/null +++ b/.changes/webview-focus-apis.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch:feat" +--- + +Add `WebviewBuilder::focused` method to choose whether to focus webview or not on creation. diff --git a/.changes/webview-window-focused.md b/.changes/webview-window-focused.md new file mode 100644 index 000000000000..b95b4cf42a74 --- /dev/null +++ b/.changes/webview-window-focused.md @@ -0,0 +1,7 @@ +--- +"tauri": "patch:bug" +"tauri-runtime": "patch:bug" +"tauri-runtime-wry": "patch:bug" +--- + +Fix webview not focused by default. diff --git a/crates/tauri-cli/config.schema.json b/crates/tauri-cli/config.schema.json index a05ba79935ed..047c4a7393e0 100644 --- a/crates/tauri-cli/config.schema.json +++ b/crates/tauri-cli/config.schema.json @@ -1104,7 +1104,7 @@ ] }, "Capability": { - "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", + "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", "type": "object", "required": [ "identifier", @@ -1151,7 +1151,7 @@ } }, "permissions": { - "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ```", + "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ]\n ```", "type": "array", "items": { "$ref": "#/definitions/PermissionEntry" diff --git a/crates/tauri-runtime-wry/src/lib.rs b/crates/tauri-runtime-wry/src/lib.rs index 4dd17d494910..0e2f23386f46 100644 --- a/crates/tauri-runtime-wry/src/lib.rs +++ b/crates/tauri-runtime-wry/src/lib.rs @@ -789,6 +789,7 @@ impl WindowBuilder for WindowBuilderWrapper { window = window .title(config.title.to_string()) .inner_size(config.width, config.height) + .focused(config.focus) .visible(config.visible) .resizable(config.resizable) .fullscreen(config.fullscreen) @@ -4017,7 +4018,7 @@ fn create_webview( let mut webview_builder = WebViewBuilder::with_web_context(&mut web_context.inner) .with_id(&label) - .with_focused(window.is_focused()) + .with_focused(webview_attributes.focus) .with_url(&url) .with_transparent(webview_attributes.transparent) .with_accept_first_mouse(webview_attributes.accept_first_mouse) diff --git a/crates/tauri-runtime/src/webview.rs b/crates/tauri-runtime/src/webview.rs index 4c4c83e3ea8a..651aaec5eac3 100644 --- a/crates/tauri-runtime/src/webview.rs +++ b/crates/tauri-runtime/src/webview.rs @@ -204,6 +204,7 @@ pub struct WebviewAttributes { pub window_effects: Option, pub incognito: bool, pub transparent: bool, + pub focus: bool, pub bounds: Option, pub auto_resize: bool, pub proxy_url: Option, @@ -213,8 +214,11 @@ pub struct WebviewAttributes { impl From<&WindowConfig> for WebviewAttributes { fn from(config: &WindowConfig) -> Self { - let mut builder = Self::new(config.url.clone()); - builder = builder.incognito(config.incognito); + let mut builder = Self::new(config.url.clone()) + .incognito(config.incognito) + .focused(config.focus) + .zoom_hotkeys_enabled(config.zoom_hotkeys_enabled) + .browser_extensions_enabled(config.browser_extensions_enabled); #[cfg(any(not(target_os = "macos"), feature = "macos-private-api"))] { builder = builder.transparent(config.transparent); @@ -235,8 +239,6 @@ impl From<&WindowConfig> for WebviewAttributes { if let Some(url) = &config.proxy_url { builder = builder.proxy_url(url.to_owned()); } - builder = builder.zoom_hotkeys_enabled(config.zoom_hotkeys_enabled); - builder = builder.browser_extensions_enabled(config.browser_extensions_enabled); builder } } @@ -256,6 +258,7 @@ impl WebviewAttributes { window_effects: None, incognito: false, transparent: false, + focus: true, bounds: None, auto_resize: false, proxy_url: None, @@ -338,6 +341,13 @@ impl WebviewAttributes { self } + /// Whether the webview should be focused or not. + #[must_use] + pub fn focused(mut self, focus: bool) -> Self { + self.focus = focus; + self + } + /// Sets the webview to automatically grow and shrink its size and position when the parent window resizes. #[must_use] pub fn auto_resize(mut self) -> Self { diff --git a/crates/tauri-schema-generator/schemas/capability.schema.json b/crates/tauri-schema-generator/schemas/capability.schema.json index 80df9a6893f8..0c9462c500aa 100644 --- a/crates/tauri-schema-generator/schemas/capability.schema.json +++ b/crates/tauri-schema-generator/schemas/capability.schema.json @@ -1,7 +1,7 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "title": "Capability", - "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", + "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", "type": "object", "required": [ "identifier", @@ -48,7 +48,7 @@ } }, "permissions": { - "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ```", + "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ]\n ```", "type": "array", "items": { "$ref": "#/definitions/PermissionEntry" diff --git a/crates/tauri-schema-generator/schemas/config.schema.json b/crates/tauri-schema-generator/schemas/config.schema.json index a05ba79935ed..047c4a7393e0 100644 --- a/crates/tauri-schema-generator/schemas/config.schema.json +++ b/crates/tauri-schema-generator/schemas/config.schema.json @@ -1104,7 +1104,7 @@ ] }, "Capability": { - "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", + "description": "A grouping and boundary mechanism developers can use to isolate access to the IPC layer.\n\n It controls application windows fine grained access to the Tauri core, application, or plugin commands.\n If a window is not matching any capability then it has no access to the IPC layer at all.\n\n This can be done to create groups of windows, based on their required system access, which can reduce\n impact of frontend vulnerabilities in less privileged windows.\n Windows can be added to a capability by exact name (e.g. `main-window`) or glob patterns like `*` or `admin-*`.\n A Window can have none, one, or multiple associated capabilities.\n\n ## Example\n\n ```json\n {\n \"identifier\": \"main-user-files-write\",\n \"description\": \"This capability allows the `main` window on macOS and Windows access to `filesystem` write related commands and `dialog` commands to enable programatic access to files selected by the user.\",\n \"windows\": [\n \"main\"\n ],\n \"permissions\": [\n \"core:default\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n },\n ],\n \"platforms\": [\"macOS\",\"windows\"]\n }\n ```", "type": "object", "required": [ "identifier", @@ -1151,7 +1151,7 @@ } }, "permissions": { - "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ```", + "description": "List of permissions attached to this capability.\n\n Must include the plugin name as prefix in the form of `${plugin-name}:${permission-name}`.\n For commands directly implemented in the application itself only `${permission-name}`\n is required.\n\n ## Example\n\n ```json\n [\n \"core:default\",\n \"shell:allow-open\",\n \"dialog:open\",\n {\n \"identifier\": \"fs:allow-write-text-file\",\n \"allow\": [{ \"path\": \"$HOME/test.txt\" }]\n }\n ]\n ```", "type": "array", "items": { "$ref": "#/definitions/PermissionEntry" diff --git a/crates/tauri/src/webview/mod.rs b/crates/tauri/src/webview/mod.rs index e0df92ecea08..06fa0eda0909 100644 --- a/crates/tauri/src/webview/mod.rs +++ b/crates/tauri/src/webview/mod.rs @@ -754,6 +754,13 @@ fn main() { self } + /// Whether the webview should be focused or not. + #[must_use] + pub fn focused(mut self, focus: bool) -> Self { + self.webview_attributes.focus = focus; + self + } + /// Sets the webview to automatically grow and shrink its size and position when the parent window resizes. #[must_use] pub fn auto_resize(mut self) -> Self { diff --git a/crates/tauri/src/webview/plugin.rs b/crates/tauri/src/webview/plugin.rs index ca8fd24eea6d..0856e254e65f 100644 --- a/crates/tauri/src/webview/plugin.rs +++ b/crates/tauri/src/webview/plugin.rs @@ -22,6 +22,10 @@ mod desktop_commands { WebviewWindowBuilder, }; + fn default_true() -> bool { + true + } + #[derive(Debug, PartialEq, Clone, Deserialize)] #[serde(rename_all = "camelCase")] pub struct WebviewConfig { @@ -35,6 +39,8 @@ mod desktop_commands { height: f64, #[serde(default)] transparent: bool, + #[serde(default = "default_true")] + focus: bool, #[serde(default)] accept_first_mouse: bool, window_effects: Option, @@ -44,6 +50,23 @@ mod desktop_commands { zoom_hotkeys_enabled: bool, } + #[cfg(feature = "unstable")] + impl crate::webview::WebviewBuilder { + fn from_webview_config(label: String, config: WebviewConfig) -> Self { + let mut builder = Self::new(label, config.url); + builder.webview_attributes.user_agent = config.user_agent; + builder.webview_attributes.drag_drop_handler_enabled = + config.drag_drop_enabled.unwrap_or(true); + builder.webview_attributes.transparent = config.transparent; + builder.webview_attributes.focus = config.focus; + builder.webview_attributes.accept_first_mouse = config.accept_first_mouse; + builder.webview_attributes.window_effects = config.window_effects; + builder.webview_attributes.incognito = config.incognito; + builder.webview_attributes.zoom_hotkeys_enabled = config.zoom_hotkeys_enabled; + builder + } + } + #[derive(Serialize)] pub struct WebviewRef { window_label: String, @@ -89,21 +112,18 @@ mod desktop_commands { .manager() .get_window(&window_label) .ok_or(crate::Error::WindowNotFound)?; - let mut builder = crate::webview::WebviewBuilder::new(label, options.url); - builder.webview_attributes.user_agent = options.user_agent; - builder.webview_attributes.drag_drop_handler_enabled = - options.drag_drop_enabled.unwrap_or(true); - builder.webview_attributes.transparent = options.transparent; - builder.webview_attributes.accept_first_mouse = options.accept_first_mouse; - builder.webview_attributes.window_effects = options.window_effects; - builder.webview_attributes.incognito = options.incognito; - builder.webview_attributes.zoom_hotkeys_enabled = options.zoom_hotkeys_enabled; + let x = options.x; + let y = options.y; + let width = options.width; + let height = options.height; + + let builder = crate::webview::WebviewBuilder::from_webview_config(label, options); window.add_child( builder, - tauri_runtime::dpi::LogicalPosition::new(options.x, options.y), - tauri_runtime::dpi::LogicalSize::new(options.width, options.height), + tauri_runtime::dpi::LogicalPosition::new(x, y), + tauri_runtime::dpi::LogicalSize::new(width, height), )?; Ok(()) diff --git a/crates/tauri/src/webview/webview_window.rs b/crates/tauri/src/webview/webview_window.rs index ee1878e72252..853d5406452d 100644 --- a/crates/tauri/src/webview/webview_window.rs +++ b/crates/tauri/src/webview/webview_window.rs @@ -476,10 +476,11 @@ impl<'a, R: Runtime, M: Manager> WebviewWindowBuilder<'a, R, M> { #[must_use] #[deprecated( since = "1.2.0", - note = "The window is automatically focused by default. This function Will be removed in 2.0.0. Use `focused` instead." + note = "The window is automatically focused by default. This function Will be removed in 3.0.0. Use `focused` instead." )] pub fn focus(mut self) -> Self { self.window_builder = self.window_builder.focused(true); + self.webview_builder = self.webview_builder.focused(true); self } @@ -487,6 +488,7 @@ impl<'a, R: Runtime, M: Manager> WebviewWindowBuilder<'a, R, M> { #[must_use] pub fn focused(mut self, focused: bool) -> Self { self.window_builder = self.window_builder.focused(focused); + self.webview_builder = self.webview_builder.focused(focused); self } diff --git a/crates/tauri/src/window/mod.rs b/crates/tauri/src/window/mod.rs index ab0e8cc7fe10..9b8e02b8ef7a 100644 --- a/crates/tauri/src/window/mod.rs +++ b/crates/tauri/src/window/mod.rs @@ -531,7 +531,7 @@ impl<'a, R: Runtime, M: Manager> WindowBuilder<'a, R, M> { #[must_use] #[deprecated( since = "1.2.0", - note = "The window is automatically focused by default. This function Will be removed in 2.0.0. Use `focused` instead." + note = "The window is automatically focused by default. This function Will be removed in 3.0.0. Use `focused` instead." )] pub fn focus(mut self) -> Self { self.window_builder = self.window_builder.focused(true); diff --git a/packages/api/src/webview.ts b/packages/api/src/webview.ts index 5b16f058b48e..e04252a95018 100644 --- a/packages/api/src/webview.ts +++ b/packages/api/src/webview.ts @@ -684,6 +684,12 @@ interface WebviewOptions { * WARNING: Using private APIs on `macOS` prevents your application from being accepted to the `App Store`. */ transparent?: boolean + /** + * Whether the webview should have focus or not + * + * @since 2.1.0 + */ + focus?: boolean /** * Whether the drag and drop is enabled or not on the webview. By default it is enabled. * From c33bbf45740274b6918ea6c647f366fb6008e459 Mon Sep 17 00:00:00 2001 From: Kornel Date: Mon, 4 Nov 2024 12:30:43 +0000 Subject: [PATCH 13/14] enhance: include the path in ACL I/O errors (#11575) --- .changes/utils-acl-path-errors.md | 6 ++++++ crates/tauri-utils/src/acl/build.rs | 14 ++++++++------ crates/tauri-utils/src/acl/capability.rs | 3 ++- crates/tauri-utils/src/acl/mod.rs | 18 +++++++++--------- crates/tauri-utils/src/acl/schema.rs | 4 ++-- 5 files changed, 27 insertions(+), 18 deletions(-) create mode 100644 .changes/utils-acl-path-errors.md diff --git a/.changes/utils-acl-path-errors.md b/.changes/utils-acl-path-errors.md new file mode 100644 index 000000000000..95fcf0fe3be1 --- /dev/null +++ b/.changes/utils-acl-path-errors.md @@ -0,0 +1,6 @@ +--- +"tauri": minor:enhance +"tauri-utils": minor:enhance +--- + +Include the path in ACL I/O errors. \ No newline at end of file diff --git a/crates/tauri-utils/src/acl/build.rs b/crates/tauri-utils/src/acl/build.rs index d2425b50ad46..d32eb0232846 100644 --- a/crates/tauri-utils/src/acl/build.rs +++ b/crates/tauri-utils/src/acl/build.rs @@ -44,8 +44,8 @@ const CORE_PLUGIN_PERMISSIONS_TOKEN: &str = "__CORE_PLUGIN__"; fn parse_permissions(paths: Vec) -> Result, Error> { let mut permissions = Vec::new(); for path in paths { - let permission_file = fs::read_to_string(&path).map_err(Error::ReadFile)?; let ext = path.extension().unwrap().to_string_lossy().to_string(); + let permission_file = fs::read_to_string(&path).map_err(|e| Error::ReadFile(e, path))?; let permission: PermissionFile = match ext.as_str() { "toml" => toml::from_str(&permission_file)?, "json" => serde_json::from_str(&permission_file)?, @@ -81,7 +81,8 @@ pub fn define_permissions bool>( let pkg_name_valid_path = pkg_name.replace(':', "-"); let permission_files_path = out_dir.join(format!("{}-permission-files", pkg_name_valid_path)); let permission_files_json = serde_json::to_string(&permission_files)?; - fs::write(&permission_files_path, permission_files_json).map_err(Error::WriteFile)?; + fs::write(&permission_files_path, permission_files_json) + .map_err(|e| Error::WriteFile(e, permission_files_path.clone()))?; if let Some(plugin_name) = pkg_name.strip_prefix("tauri:") { println!( @@ -115,7 +116,8 @@ pub fn read_permissions() -> Result>, Error> }) { let permissions_path = PathBuf::from(value); - let permissions_str = fs::read_to_string(&permissions_path).map_err(Error::ReadFile)?; + let permissions_str = + fs::read_to_string(&permissions_path).map_err(|e| Error::ReadFile(e, permissions_path))?; let permissions: Vec = serde_json::from_str(&permissions_str)?; let permissions = parse_permissions(permissions)?; @@ -139,7 +141,7 @@ pub fn define_global_scope_schema( out_dir: &Path, ) -> Result<(), Error> { let path = out_dir.join("global-scope.json"); - fs::write(&path, serde_json::to_vec(&schema)?).map_err(Error::WriteFile)?; + fs::write(&path, serde_json::to_vec(&schema)?).map_err(|e| Error::WriteFile(e, path.clone()))?; if let Some(plugin_name) = pkg_name.strip_prefix("tauri:") { println!( @@ -170,7 +172,7 @@ pub fn read_global_scope_schemas() -> Result, }) { let path = PathBuf::from(value); - let json = fs::read_to_string(&path).map_err(Error::ReadFile)?; + let json = fs::read_to_string(&path).map_err(|e| Error::ReadFile(e, path))?; let schema: serde_json::Value = serde_json::from_str(&json)?; let plugin_crate_name = plugin_crate_name_var.to_lowercase().replace('_', "-"); @@ -368,7 +370,7 @@ pub fn generate_docs( format!("{default_permission}\n{PERMISSION_TABLE_HEADER}\n{permission_table}\n"); let reference_path = out_dir.join(PERMISSION_DOCS_FILE_NAME); - write_if_changed(reference_path, docs).map_err(Error::WriteFile)?; + write_if_changed(&reference_path, docs).map_err(|e| Error::WriteFile(e, reference_path))?; Ok(()) } diff --git a/crates/tauri-utils/src/acl/capability.rs b/crates/tauri-utils/src/acl/capability.rs index a158ea7d3df7..9ac56f3ed83c 100644 --- a/crates/tauri-utils/src/acl/capability.rs +++ b/crates/tauri-utils/src/acl/capability.rs @@ -261,7 +261,8 @@ impl CapabilityFile { /// Load the given capability file. pub fn load>(path: P) -> Result { let path = path.as_ref(); - let capability_file = std::fs::read_to_string(path).map_err(super::Error::ReadFile)?; + let capability_file = + std::fs::read_to_string(path).map_err(|e| super::Error::ReadFile(e, path.into()))?; let ext = path.extension().unwrap().to_string_lossy().to_string(); let file: Self = match ext.as_str() { "toml" => toml::from_str(&capability_file)?, diff --git a/crates/tauri-utils/src/acl/mod.rs b/crates/tauri-utils/src/acl/mod.rs index 3a48b377d763..40e475fde51c 100644 --- a/crates/tauri-utils/src/acl/mod.rs +++ b/crates/tauri-utils/src/acl/mod.rs @@ -22,7 +22,7 @@ //! [Struct Update Syntax]: https://doc.rust-lang.org/book/ch05-01-defining-structs.html#creating-instances-from-other-instances-with-struct-update-syntax use serde::{Deserialize, Serialize}; -use std::{num::NonZeroU64, str::FromStr, sync::Arc}; +use std::{num::NonZeroU64, path::PathBuf, str::FromStr, sync::Arc}; use thiserror::Error; use url::Url; @@ -71,20 +71,20 @@ pub enum Error { LinksName, /// IO error while reading a file - #[error("failed to read file: {0}")] - ReadFile(std::io::Error), + #[error("failed to read file '{}': {}", _1.display(), _0)] + ReadFile(std::io::Error, PathBuf), /// IO error while writing a file - #[error("failed to write file: {0}")] - WriteFile(std::io::Error), + #[error("failed to write file '{}': {}", _1.display(), _0)] + WriteFile(std::io::Error, PathBuf), /// IO error while creating a file - #[error("failed to create file: {0}")] - CreateFile(std::io::Error), + #[error("failed to create file '{}': {}", _1.display(), _0)] + CreateFile(std::io::Error, PathBuf), /// IO error while creating a dir - #[error("failed to create dir: {0}")] - CreateDir(std::io::Error), + #[error("failed to create dir '{}': {}", _1.display(), _0)] + CreateDir(std::io::Error, PathBuf), /// [`cargo_metadata`] was not able to complete successfully #[cfg(feature = "build")] diff --git a/crates/tauri-utils/src/acl/schema.rs b/crates/tauri-utils/src/acl/schema.rs index bdce02ea013a..24cc07de6412 100644 --- a/crates/tauri-utils/src/acl/schema.rs +++ b/crates/tauri-utils/src/acl/schema.rs @@ -336,10 +336,10 @@ pub fn generate_permissions_schema>( let schema_str = serde_json::to_string_pretty(&schema)?; let out_dir = out_dir.as_ref().join(PERMISSION_SCHEMAS_FOLDER_NAME); - fs::create_dir_all(&out_dir).map_err(Error::CreateDir)?; + fs::create_dir_all(&out_dir).map_err(|e| Error::CreateDir(e, out_dir.clone()))?; let schema_path = out_dir.join(PERMISSION_SCHEMA_FILE_NAME); - write_if_changed(&schema_path, schema_str).map_err(Error::WriteFile)?; + write_if_changed(&schema_path, schema_str).map_err(|e| Error::WriteFile(e, schema_path))?; Ok(()) } From f8994b214e89acc99ab5ce8dcca8485f43a62dbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikkel=20T=C3=B8nder?= <71938724+Mikkel-T@users.noreply.github.com> Date: Mon, 4 Nov 2024 13:31:18 +0100 Subject: [PATCH 14/14] fix(event): handle AnyLabel listeners in `emit_to` (#11581) closes #11561 --- .changes/event-anylabel-fix.md | 5 +++++ crates/tauri/src/manager/mod.rs | 26 +++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 .changes/event-anylabel-fix.md diff --git a/.changes/event-anylabel-fix.md b/.changes/event-anylabel-fix.md new file mode 100644 index 000000000000..cdf47c67c7c4 --- /dev/null +++ b/.changes/event-anylabel-fix.md @@ -0,0 +1,5 @@ +--- +"tauri": "patch:bug" +--- + +Fix listeners created with `EventTarget::AnyLabel` never receiving events. diff --git a/crates/tauri/src/manager/mod.rs b/crates/tauri/src/manager/mod.rs index 7353c3ae36f4..d272b241bfb9 100644 --- a/crates/tauri/src/manager/mod.rs +++ b/crates/tauri/src/manager/mod.rs @@ -597,7 +597,31 @@ impl AppManager { } => self.emit_filter(event, payload, |t| match t { EventTarget::Window { label } | EventTarget::Webview { label } - | EventTarget::WebviewWindow { label } => label == &target_label, + | EventTarget::WebviewWindow { label } + | EventTarget::AnyLabel { label } => label == &target_label, + _ => false, + }), + + EventTarget::Window { + label: target_label, + } => self.emit_filter(event, payload, |t| match t { + EventTarget::AnyLabel { label } | EventTarget::Window { label } => label == &target_label, + _ => false, + }), + + EventTarget::Webview { + label: target_label, + } => self.emit_filter(event, payload, |t| match t { + EventTarget::AnyLabel { label } | EventTarget::Webview { label } => label == &target_label, + _ => false, + }), + + EventTarget::WebviewWindow { + label: target_label, + } => self.emit_filter(event, payload, |t| match t { + EventTarget::AnyLabel { label } | EventTarget::WebviewWindow { label } => { + label == &target_label + } _ => false, }),