From d5d6d2abc17cd89c3a079d2ce01581193469dbc0 Mon Sep 17 00:00:00 2001 From: chip Date: Mon, 17 Jan 2022 10:46:14 -0300 Subject: [PATCH] Isolation Pattern (#43) Co-authored-by: Ngo Iok Ui (Wu Yu Wei) Co-authored-by: Lucas Fernandes Nogueira --- .changes/isolation-pattern.md | 7 + .changes/rust-1.57.md | 5 + Cargo.toml | 3 +- core/tauri-build/Cargo.toml | 3 +- core/tauri-build/src/codegen/context.rs | 3 + core/tauri-build/src/lib.rs | 3 + core/tauri-codegen/Cargo.toml | 4 +- core/tauri-codegen/src/context.rs | 122 +- core/tauri-codegen/src/embedded_assets.rs | 147 +- core/tauri-macros/Cargo.toml | 3 +- core/tauri-runtime-wry/Cargo.toml | 2 +- core/tauri-runtime/Cargo.toml | 2 +- core/tauri-runtime/src/http/response.rs | 12 +- core/tauri-runtime/src/lib.rs | 3 + core/tauri-runtime/src/menu.rs | 10 + core/tauri-runtime/src/webview.rs | 22 + core/tauri-runtime/src/window.rs | 1 + core/tauri-utils/Cargo.toml | 10 +- core/tauri-utils/src/assets.rs | 5 + core/tauri-utils/src/config.rs | 89 +- core/tauri-utils/src/html.rs | 200 +- core/tauri-utils/src/lib.rs | 6 + core/tauri-utils/src/pattern/isolation.js | 115 + core/tauri-utils/src/pattern/isolation.rs | 164 + core/tauri-utils/src/pattern/mod.rs | 7 + core/tauri/Cargo.toml | 14 +- core/tauri/scripts/bundle.js | 2 +- core/tauri/scripts/core.js | 237 +- core/tauri/scripts/freeze_prototype.js | 5 + core/tauri/scripts/init.js | 26 + core/tauri/scripts/ipc.js | 153 + core/tauri/scripts/isolation.js | 15 + core/tauri/scripts/pattern.js | 21 + core/tauri/src/api/dialog.rs | 4 + core/tauri/src/api/http.rs | 7 + core/tauri/src/api/notification.rs | 3 + core/tauri/src/api/path.rs | 3 +- core/tauri/src/api/process/command.rs | 4 + core/tauri/src/api/shell.rs | 1 - core/tauri/src/app.rs | 28 +- core/tauri/src/async_runtime.rs | 1 + core/tauri/src/endpoints/cli.rs | 2 +- core/tauri/src/endpoints/file_system.rs | 20 +- core/tauri/src/error.rs | 4 + core/tauri/src/hooks.rs | 21 +- core/tauri/src/lib.rs | 16 +- core/tauri/src/manager.rs | 428 +- core/tauri/src/pattern.rs | 94 + core/tauri/src/test/mock_runtime.rs | 16 +- core/tauri/src/test/mod.rs | 8 +- core/tauri/src/updater/core.rs | 11 +- core/tauri/src/window.rs | 28 +- core/tauri/tests/restart.rs | 2 +- core/tauri/tests/restart/Cargo.lock | 397 +- docs/guides/webdriver/example/setup.md | 2 +- examples/api/dist/assets/index.4b6f33f7.js | 39 + examples/api/dist/assets/index.ab727ab4.js | 25 - examples/api/dist/assets/vendor.32016365.js | 24 - examples/api/dist/assets/vendor.3a672f03.js | 9 + examples/api/dist/index.html | 4 +- examples/api/isolation-dist/index.html | 10 + examples/api/isolation-dist/index.js | 4 + examples/api/src-tauri/Cargo.lock | 189 +- examples/api/src-tauri/Cargo.toml | 6 +- examples/api/src-tauri/tauri.conf.json | 6 + examples/commands/src-tauri/Cargo.toml | 2 +- examples/helloworld/src-tauri/Cargo.toml | 2 +- examples/helloworld/src-tauri/tauri.conf.json | 3 - examples/isolation/dist/index.html | 84 + examples/isolation/dist/linked.js | 1 + examples/isolation/isolation-dist/index.html | 10 + examples/isolation/isolation-dist/index.js | 4 + examples/isolation/package.json | 10 + examples/isolation/src-tauri/.gitignore | 5 + .../isolation/src-tauri/.license_template | 1 + examples/isolation/src-tauri/Cargo.lock | 3448 +++++++++++++++++ examples/isolation/src-tauri/Cargo.toml | 21 + .../isolation/src-tauri/LICENSE_APACHE-2.0 | 1 + examples/isolation/src-tauri/LICENSE_MIT | 1 + examples/isolation/src-tauri/build.rs | 13 + examples/isolation/src-tauri/src/main.rs | 30 + examples/isolation/src-tauri/tauri.conf.json | 71 + examples/isolation/yarn.lock | 13 + examples/multiwindow/src-tauri/Cargo.toml | 2 +- examples/navigation/src-tauri/Cargo.toml | 2 +- examples/resources/src-tauri/Cargo.toml | 2 +- examples/sidecar/src-tauri/Cargo.toml | 2 +- examples/splashscreen/src-tauri/Cargo.toml | 2 +- examples/state/src-tauri/Cargo.toml | 2 +- examples/streaming/src-tauri/Cargo.toml | 2 +- examples/updater/src-tauri/Cargo.toml | 2 +- package.json | 3 + tooling/api/src/tauri.ts | 26 +- tooling/bench/Cargo.toml | 2 +- .../tests/cpu_intensive/src-tauri/Cargo.toml | 2 +- .../tests/files_transfer/src-tauri/Cargo.toml | 2 +- .../tests/helloworld/src-tauri/Cargo.toml | 2 +- tooling/bundler/Cargo.toml | 2 +- .../jest/fixtures/app/src-tauri/Cargo.toml | 2 +- tooling/cli.rs/Cargo.lock | 136 +- tooling/cli.rs/Cargo.toml | 4 +- tooling/cli.rs/schema.json | 75 +- tooling/cli.rs/src/helpers/manifest.rs | 130 +- .../app/src-tauri/Cargo.crate-manifest | 2 +- .../plugin/backend/Cargo.crate-manifest | 2 +- .../vanilla/src-tauri/Cargo.crate-manifest | 2 +- .../plugin/with-api/Cargo.crate-manifest | 2 +- .../svelte-app/src-tauri/Cargo.crate-manifest | 2 +- .../src/templates/dominator/_Cargo.toml | 2 +- tooling/webdriver/Cargo.toml | 2 +- 110 files changed, 6116 insertions(+), 857 deletions(-) create mode 100644 .changes/isolation-pattern.md create mode 100644 .changes/rust-1.57.md create mode 100644 core/tauri-utils/src/pattern/isolation.js create mode 100644 core/tauri-utils/src/pattern/isolation.rs create mode 100644 core/tauri-utils/src/pattern/mod.rs create mode 100644 core/tauri/scripts/freeze_prototype.js create mode 100644 core/tauri/scripts/init.js create mode 100644 core/tauri/scripts/ipc.js create mode 100644 core/tauri/scripts/isolation.js create mode 100644 core/tauri/scripts/pattern.js create mode 100644 core/tauri/src/pattern.rs create mode 100644 examples/api/dist/assets/index.4b6f33f7.js delete mode 100644 examples/api/dist/assets/index.ab727ab4.js delete mode 100644 examples/api/dist/assets/vendor.32016365.js create mode 100644 examples/api/dist/assets/vendor.3a672f03.js create mode 100644 examples/api/isolation-dist/index.html create mode 100644 examples/api/isolation-dist/index.js create mode 100644 examples/isolation/dist/index.html create mode 100644 examples/isolation/dist/linked.js create mode 100644 examples/isolation/isolation-dist/index.html create mode 100644 examples/isolation/isolation-dist/index.js create mode 100644 examples/isolation/package.json create mode 100644 examples/isolation/src-tauri/.gitignore create mode 120000 examples/isolation/src-tauri/.license_template create mode 100644 examples/isolation/src-tauri/Cargo.lock create mode 100644 examples/isolation/src-tauri/Cargo.toml create mode 120000 examples/isolation/src-tauri/LICENSE_APACHE-2.0 create mode 120000 examples/isolation/src-tauri/LICENSE_MIT create mode 100644 examples/isolation/src-tauri/build.rs create mode 100644 examples/isolation/src-tauri/src/main.rs create mode 100644 examples/isolation/src-tauri/tauri.conf.json create mode 100644 examples/isolation/yarn.lock diff --git a/.changes/isolation-pattern.md b/.changes/isolation-pattern.md new file mode 100644 index 000000000..12b4942ad --- /dev/null +++ b/.changes/isolation-pattern.md @@ -0,0 +1,7 @@ +--- +"tauri": patch +"tauri-utils": patch +"tauri-codegen": patch +--- + +Added the `isolation` pattern. diff --git a/.changes/rust-1.57.md b/.changes/rust-1.57.md new file mode 100644 index 000000000..24cb734f5 --- /dev/null +++ b/.changes/rust-1.57.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +The minimum Rust version is now 1.57. diff --git a/Cargo.toml b/Cargo.toml index 72c897a00..c95d732b2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,8 @@ exclude = [ "examples/api/src-tauri", "examples/updater/src-tauri", "examples/resources/src-tauri", - "examples/sidecar/src-tauri" + "examples/sidecar/src-tauri", + "examples/isolation/src-tauri" ] # default to small, optimized workspace release binaries diff --git a/core/tauri-build/Cargo.toml b/core/tauri-build/Cargo.toml index e337c8ca1..dc601babf 100644 --- a/core/tauri-build/Cargo.toml +++ b/core/tauri-build/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-build" description = "build time code to pair with https://crates.io/crates/tauri" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -29,3 +29,4 @@ winres = "0.1" [features] codegen = [ "tauri-codegen", "quote" ] +isolation = ["tauri-codegen/isolation", "tauri-utils/isolation"] diff --git a/core/tauri-build/src/codegen/context.rs b/core/tauri-build/src/codegen/context.rs index 54e86f4e6..dcf89708a 100644 --- a/core/tauri-build/src/codegen/context.rs +++ b/core/tauri-build/src/codegen/context.rs @@ -42,6 +42,7 @@ impl CodegenContext { /// This defaults to a file called `tauri.conf.json` inside of the current working directory of /// the package compiling; does not need to be set manually if that config file is in the same /// directory as your `Cargo.toml`. + #[must_use] pub fn config_path(mut self, config_path: impl Into) -> Self { self.config_path = config_path.into(); self @@ -58,6 +59,7 @@ impl CodegenContext { /// Defaults to `tauri-build-context.rs`. /// /// [`tauri::include_codegen_context!`]: https://docs.rs/tauri/0.12/tauri/macro.include_codegen_context.html + #[must_use] pub fn out_file(mut self, filename: PathBuf) -> Self { self.out_file = filename; self @@ -65,6 +67,7 @@ impl CodegenContext { /// Run the codegen in a `dev` context, meaning that Tauri is using a dev server or local file for development purposes, /// usually with the `tauri dev` CLI command. + #[must_use] pub fn dev(mut self) -> Self { self.dev = true; self diff --git a/core/tauri-build/src/lib.rs b/core/tauri-build/src/lib.rs index 9c4672f57..86b0bb473 100644 --- a/core/tauri-build/src/lib.rs +++ b/core/tauri-build/src/lib.rs @@ -43,6 +43,7 @@ impl WindowsAttributes { /// Sets the icon to use on the window. Currently only used on Windows. /// It must be in `ico` format. Defaults to `icons/icon.ico`. + #[must_use] pub fn window_icon_path>(mut self, window_icon_path: P) -> Self { self.window_icon_path = window_icon_path.as_ref().into(); self @@ -50,6 +51,7 @@ impl WindowsAttributes { /// Sets the sdk dir for windows. Currently only used on Windows. This must be a vaild UTF-8 /// path. Defaults to whatever the `winres` crate determines is best. + #[must_use] pub fn sdk_dir>(mut self, sdk_dir: P) -> Self { self.sdk_dir = Some(sdk_dir.as_ref().into()); self @@ -70,6 +72,7 @@ impl Attributes { } /// Sets the icon to use on the window. Currently only used on Windows. + #[must_use] pub fn windows_attributes(mut self, windows_attributes: WindowsAttributes) -> Self { self.windows_attributes = windows_attributes; self diff --git a/core/tauri-codegen/Cargo.toml b/core/tauri-codegen/Cargo.toml index dfd425610..78a242af1 100644 --- a/core/tauri-codegen/Cargo.toml +++ b/core/tauri-codegen/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri/tree/dev/core/tauri-codegen" description = "code generation meant to be consumed inside of `tauri` through `tauri-build` or `tauri-macros`" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -25,7 +25,9 @@ thiserror = "1" walkdir = "2" zstd = { version = "0.9", optional = true } regex = "1" +uuid = { version = "0.8", features = [ "v4" ] } [features] default = [ "compression" ] compression = [ "zstd", "tauri-utils/compression" ] +isolation = ["tauri-utils/isolation"] diff --git a/core/tauri-codegen/src/context.rs b/core/tauri-codegen/src/context.rs index fb3c2a666..f14698fb5 100644 --- a/core/tauri-codegen/src/context.rs +++ b/core/tauri-codegen/src/context.rs @@ -2,11 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use crate::embedded_assets::{AssetOptions, EmbeddedAssets, EmbeddedAssetsError}; +use std::ffi::OsStr; +use std::path::{Path, PathBuf}; + use proc_macro2::TokenStream; use quote::quote; -use std::path::{Path, PathBuf}; -use tauri_utils::config::{AppUrl, Config, WindowUrl}; +use sha2::{Digest, Sha256}; + +use tauri_utils::assets::AssetKey; +use tauri_utils::config::{AppUrl, Config, PatternKind, WindowUrl}; +use tauri_utils::html::{inject_nonce_token, parse as parse_html, NodeRef, PatternObject}; + +use crate::embedded_assets::{AssetOptions, CspHashes, EmbeddedAssets, EmbeddedAssetsError}; /// Necessary data needed by [`context_codegen`] to generate code for a Tauri application context. pub struct ContextData { @@ -16,6 +23,81 @@ pub struct ContextData { pub root: TokenStream, } +fn load_csp(document: &mut NodeRef, key: &AssetKey, csp_hashes: &mut CspHashes) { + #[cfg(target_os = "linux")] + ::tauri_utils::html::inject_csp_token(document); + inject_nonce_token(document); + if let Ok(inline_script_elements) = document.select("script:not(empty)") { + let mut scripts = Vec::new(); + for inline_script_el in inline_script_elements { + let script = inline_script_el.as_node().text_contents(); + let mut hasher = Sha256::new(); + hasher.update(&script); + let hash = hasher.finalize(); + scripts.push(format!("'sha256-{}'", base64::encode(&hash))); + } + csp_hashes + .inline_scripts + .entry(key.clone().into()) + .or_default() + .append(&mut scripts); + } +} + +fn map_core_assets( + options: &AssetOptions, +) -> impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError> { + #[allow(unused_variables)] + let pattern = PatternObject::from(&options.pattern); + let csp = options.csp; + move |key, path, input, csp_hashes| { + if path.extension() == Some(OsStr::new("html")) { + let mut document = parse_html(String::from_utf8_lossy(input).into_owned()); + + if csp { + load_csp(&mut document, key, csp_hashes); + + #[cfg(feature = "isolation")] + if let PatternObject::Isolation { .. } = &pattern { + // create the csp for the isolation iframe styling now, to make the runtime less complex + let mut hasher = Sha256::new(); + hasher.update(tauri_utils::pattern::isolation::IFRAME_STYLE); + let hash = hasher.finalize(); + csp_hashes + .styles + .push(format!("'sha256-{}'", base64::encode(&hash))); + } + } + + *input = document.to_string().as_bytes().to_vec(); + } + Ok(()) + } +} + +#[cfg(feature = "isolation")] +fn map_isolation( + _options: &AssetOptions, + dir: PathBuf, +) -> impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError> { + move |_key, path, input, _csp_hashes| { + if path.extension() == Some(OsStr::new("html")) { + let mut isolation_html = + tauri_utils::html::parse(String::from_utf8_lossy(input).into_owned()); + + // this is appended, so no need to reverse order it + tauri_utils::html::inject_codegen_isolation_script(&mut isolation_html); + + // temporary workaround for windows not loading assets + tauri_utils::html::inline_isolation(&mut isolation_html, &dir); + + *input = isolation_html.to_string().as_bytes().to_vec() + } + + Ok(()) + } +} + /// Build a `tauri::Context` for including in application code. pub fn context_codegen(data: ContextData) -> Result { let ContextData { @@ -25,7 +107,8 @@ pub fn context_codegen(data: ContextData) -> Result Result unimplemented!(), }, @@ -73,7 +156,7 @@ pub fn context_codegen(data: ContextData) -> Result>(), - options, + map_core_assets(&options), )?, _ => unimplemented!(), }; @@ -180,7 +263,31 @@ pub fn context_codegen(data: ContextData) -> Result quote!(#root::Pattern::Brownfield(std::marker::PhantomData)), + #[cfg(feature = "isolation")] + PatternKind::Isolation { dir } => { + let dir = config_parent.join(dir); + if !dir.exists() { + panic!( + "The isolation dir configuration is set to `{:?}` but this path doesn't exist", + dir + ) + } + + let key = uuid::Uuid::new_v4().to_string(); + let assets = EmbeddedAssets::new(dir.clone(), map_isolation(&options, dir))?; + let schema = options.isolation_schema; + + quote!(#root::Pattern::Isolation { + assets: ::std::sync::Arc::new(#assets), + schema: #schema.into(), + key: #key.into(), + crypto_keys: std::boxed::Box::new(::tauri::utils::pattern::isolation::Keys::new().expect("unable to generate cryptographically secure keys for Tauri \"Isolation\" Pattern")), + }) + } + }; + Ok(quote!(#root::Context::new( #config, ::std::sync::Arc::new(#assets), @@ -188,6 +295,7 @@ pub fn context_codegen(data: ContextData) -> Result, + pub(crate) scripts: Vec, /// Inline scripts (``). Maps a HTML path to a list of hashes. - inline_scripts: HashMap>, + pub(crate) inline_scripts: HashMap>, + /// A list of hashes of the contents of all `style` elements. + pub(crate) styles: Vec, } impl CspHashes { @@ -181,20 +179,38 @@ impl CspHashes { /// Options used to embed assets. #[derive(Default)] pub struct AssetOptions { - csp: bool, + pub(crate) csp: bool, + pub(crate) pattern: PatternKind, + pub(crate) freeze_prototype: bool, + #[cfg(feature = "isolation")] + pub(crate) isolation_schema: String, } impl AssetOptions { /// Creates the default asset options. - pub fn new() -> Self { - Self::default() + pub fn new(pattern: PatternKind) -> Self { + Self { + csp: false, + pattern, + freeze_prototype: true, + #[cfg(feature = "isolation")] + isolation_schema: format!("isolation-{}", uuid::Uuid::new_v4()), + } } /// Instruct the asset handler to inject the CSP token to HTML files. + #[must_use] pub fn with_csp(mut self) -> Self { self.csp = true; self } + + /// Instruct the asset handler to include a script to freeze the `Object.prototype` on all HTML files. + #[must_use] + pub fn freeze_prototype(mut self, freeze: bool) -> Self { + self.freeze_prototype = freeze; + self + } } impl EmbeddedAssets { @@ -203,18 +219,27 @@ impl EmbeddedAssets { /// [`Assets`]: tauri_utils::assets::Assets pub fn new( input: impl Into, - options: AssetOptions, + map: impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError>, ) -> Result { // we need to pre-compute all files now, so that we can inject data from all files into a few - let RawEmbeddedAssets { - paths, - mut csp_hashes, - } = RawEmbeddedAssets::new(input.into())?; + let RawEmbeddedAssets { paths, csp_hashes } = RawEmbeddedAssets::new(input.into())?; - let assets = paths - .into_iter() - .map(|(prefix, entry)| Self::compress_file(&prefix, entry.path(), &options, &mut csp_hashes)) - .collect::>()?; + struct CompressState { + csp_hashes: CspHashes, + assets: HashMap, + } + + let CompressState { assets, csp_hashes } = paths.into_iter().try_fold( + CompressState { + csp_hashes, + assets: HashMap::new(), + }, + move |mut state, (prefix, entry)| { + let (key, asset) = Self::compress_file(&prefix, entry.path(), &map, &mut state.csp_hashes)?; + state.assets.insert(key, asset); + Ok(state) + }, + )?; Ok(Self { assets, csp_hashes }) } @@ -234,7 +259,7 @@ impl EmbeddedAssets { fn compress_file( prefix: &Path, path: &Path, - options: &AssetOptions, + map: &impl Fn(&AssetKey, &Path, &mut Vec, &mut CspHashes) -> Result<(), EmbeddedAssetsError>, csp_hashes: &mut CspHashes, ) -> Result { let mut input = std::fs::read(path).map_err(|error| EmbeddedAssetsError::AssetRead { @@ -251,75 +276,8 @@ impl EmbeddedAssets { path: path.to_owned(), })?; - if path.extension() == Some(OsStr::new("html")) { - let mut document = parse_html(String::from_utf8_lossy(&input).into_owned()); - if options.csp { - #[cfg(target_os = "linux")] - ::tauri_utils::html::inject_csp_token(&mut document); - inject_nonce_token(&mut document); - if let Ok(inline_script_elements) = document.select("script:not(empty)") { - let mut scripts = Vec::new(); - for inline_script_el in inline_script_elements { - let script = inline_script_el.as_node().text_contents(); - let mut hasher = Sha256::new(); - hasher.update(&script); - let hash = hasher.finalize(); - scripts.push(format!("'sha256-{}'", base64::encode(&hash))); - } - csp_hashes - .inline_scripts - .insert(key.clone().into(), scripts); - } - } - inject_invoke_key_token(&mut document); - input = document.to_string().as_bytes().to_vec(); - } else { - let is_javascript = ["js", "cjs", "mjs"] - .iter() - .any(|e| path.extension() == Some(OsStr::new(e))); - if is_javascript { - let js = String::from_utf8_lossy(&input).into_owned(); - input = if RegexSet::new(&[ - // import keywords - "import\\{", - "import \\{", - "import\\*", - "import \\*", - "import (\"|');?$", - "import\\(", - "import (.|\n)+ from (\"|')([A-Za-z/\\.@-]+)(\"|')", - // export keywords - "export\\{", - "export \\{", - "export\\*", - "export \\*", - "export (default|class|let|const|function|async)", - ]) - .unwrap() - .is_match(&js) - { - format!( - r#" - const __TAURI_INVOKE_KEY__ = __TAURI__INVOKE_KEY_TOKEN__; - {} - "#, - js - ) - .as_bytes() - .to_vec() - } else { - format!( - r#"(function () {{ - const __TAURI_INVOKE_KEY__ = __TAURI__INVOKE_KEY_TOKEN__; - {} - }})()"#, - js - ) - .as_bytes() - .to_vec() - }; - } - } + // perform any caller-requested input manipulation + map(&key, path, &mut input, csp_hashes)?; // we must canonicalize the base of our paths to allow long paths on windows let out_dir = std::env::var("OUT_DIR") @@ -404,6 +362,11 @@ impl ToTokens for EmbeddedAssets { global_hashes.append_all(quote!(CspHash::Script(#hash),)); } + for style_hash in &self.csp_hashes.styles { + let hash = style_hash.as_str(); + global_hashes.append_all(quote!(CspHash::Style(#hash),)); + } + let mut html_hashes = TokenStream::new(); for (path, hashes) in &self.csp_hashes.inline_scripts { let key = path.as_str(); diff --git a/core/tauri-macros/Cargo.toml b/core/tauri-macros/Cargo.toml index 4f356e352..c612fafc7 100644 --- a/core/tauri-macros/Cargo.toml +++ b/core/tauri-macros/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri" description = "Macros for the tauri crate." edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -25,3 +25,4 @@ tauri-codegen = { version = "1.0.0-beta.4", default-features = false, path = ".. [features] custom-protocol = [ ] compression = [ "tauri-codegen/compression" ] +isolation = ["tauri-codegen/isolation"] diff --git a/core/tauri-runtime-wry/Cargo.toml b/core/tauri-runtime-wry/Cargo.toml index e3a274ab7..42d526708 100644 --- a/core/tauri-runtime-wry/Cargo.toml +++ b/core/tauri-runtime-wry/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri" description = "Wry bindings to the Tauri runtime" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" diff --git a/core/tauri-runtime/Cargo.toml b/core/tauri-runtime/Cargo.toml index 545031681..e0c8db7b8 100644 --- a/core/tauri-runtime/Cargo.toml +++ b/core/tauri-runtime/Cargo.toml @@ -8,7 +8,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri" description = "Runtime for Tauri applications" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" diff --git a/core/tauri-runtime/src/http/response.rs b/core/tauri-runtime/src/http/response.rs index c23b5fcd3..7e2549834 100644 --- a/core/tauri-runtime/src/http/response.rs +++ b/core/tauri-runtime/src/http/response.rs @@ -168,7 +168,8 @@ impl Builder { } /// Set the HTTP mimetype for this response. - pub fn mimetype(self, mimetype: &str) -> Builder { + #[must_use] + pub fn mimetype(self, mimetype: &str) -> Self { self.and_then(move |mut head| { head.mimetype = Some(mimetype.to_string()); Ok(head) @@ -176,7 +177,8 @@ impl Builder { } /// Set the HTTP status for this response. - pub fn status(self, status: T) -> Builder + #[must_use] + pub fn status(self, status: T) -> Self where StatusCode: TryFrom, >::Error: Into, @@ -193,7 +195,8 @@ impl Builder { /// will be returned from `Builder::build`. /// /// By default this is HTTP/1.1 - pub fn version(self, version: Version) -> Builder { + #[must_use] + pub fn version(self, version: Version) -> Self { self.and_then(move |mut head| { head.version = version; Ok(head) @@ -205,7 +208,8 @@ impl Builder { /// This function will append the provided key/value as a header to the /// internal `HeaderMap` being constructed. Essentially this is equivalent /// to calling `HeaderMap::append`. - pub fn header(self, key: K, value: V) -> Builder + #[must_use] + pub fn header(self, key: K, value: V) -> Self where HeaderName: TryFrom, >::Error: Into, diff --git a/core/tauri-runtime/src/lib.rs b/core/tauri-runtime/src/lib.rs index c68ce2679..614461185 100644 --- a/core/tauri-runtime/src/lib.rs +++ b/core/tauri-runtime/src/lib.rs @@ -57,6 +57,7 @@ impl SystemTray { } /// Sets the tray icon. Must be a [`Icon::File`] on Linux and a [`Icon::Raw`] on Windows and macOS. + #[must_use] pub fn with_icon(mut self, icon: Icon) -> Self { self.icon.replace(icon); self @@ -64,12 +65,14 @@ impl SystemTray { /// Sets the tray icon as template. #[cfg(target_os = "macos")] + #[must_use] pub fn with_icon_as_template(mut self, is_template: bool) -> Self { self.icon_as_template = is_template; self } /// Sets the menu to show when the system tray is right clicked. + #[must_use] pub fn with_menu(mut self, menu: menu::SystemTrayMenu) -> Self { self.menu.replace(menu); self diff --git a/core/tauri-runtime/src/menu.rs b/core/tauri-runtime/src/menu.rs index f3ea9d3a7..5e116f39d 100644 --- a/core/tauri-runtime/src/menu.rs +++ b/core/tauri-runtime/src/menu.rs @@ -206,18 +206,21 @@ impl Menu { } /// Adds the custom menu item to the menu. + #[must_use] pub fn add_item(mut self, item: CustomMenuItem) -> Self { self.items.push(MenuEntry::CustomItem(item)); self } /// Adds a native item to the menu. + #[must_use] pub fn add_native_item(mut self, item: MenuItem) -> Self { self.items.push(MenuEntry::NativeItem(item)); self } /// Adds an entry with submenu. + #[must_use] pub fn add_submenu(mut self, submenu: Submenu) -> Self { self.items.push(MenuEntry::Submenu(submenu)); self @@ -255,6 +258,7 @@ impl CustomMenuItem { } /// Assign a keyboard shortcut to the menu action. + #[must_use] pub fn accelerator>(mut self, accelerator: T) -> Self { self.keyboard_accelerator.replace(accelerator.into()); self @@ -262,6 +266,7 @@ impl CustomMenuItem { #[cfg(target_os = "macos")] #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] + #[must_use] /// A native image do render on the menu item. pub fn native_image(mut self, image: NativeImage) -> Self { self.native_image.replace(image); @@ -269,12 +274,14 @@ impl CustomMenuItem { } /// Mark the item as disabled. + #[must_use] pub fn disabled(mut self) -> Self { self.enabled = false; self } /// Mark the item as selected. + #[must_use] pub fn selected(mut self) -> Self { self.selected = true; self @@ -320,18 +327,21 @@ impl SystemTrayMenu { } /// Adds the custom menu item to the system tray menu. + #[must_use] pub fn add_item(mut self, item: CustomMenuItem) -> Self { self.items.push(SystemTrayMenuEntry::CustomItem(item)); self } /// Adds a native item to the system tray menu. + #[must_use] pub fn add_native_item(mut self, item: SystemTrayMenuItem) -> Self { self.items.push(SystemTrayMenuEntry::NativeItem(item)); self } /// Adds an entry with submenu. + #[must_use] pub fn add_submenu(mut self, submenu: SystemTraySubmenu) -> Self { self.items.push(SystemTrayMenuEntry::Submenu(submenu)); self diff --git a/core/tauri-runtime/src/webview.rs b/core/tauri-runtime/src/webview.rs index 0aac7e72d..efe70d183 100644 --- a/core/tauri-runtime/src/webview.rs +++ b/core/tauri-runtime/src/webview.rs @@ -36,18 +36,21 @@ impl WebviewAttributes { } /// Sets the init script. + #[must_use] pub fn initialization_script(mut self, script: &str) -> Self { self.initialization_scripts.push(script.to_string()); self } /// Data directory for the webview. + #[must_use] pub fn data_directory(mut self, data_directory: PathBuf) -> Self { self.data_directory.replace(data_directory); self } /// Disables the file drop handler. This is required to use drag and drop APIs on the front end on Windows. + #[must_use] pub fn disable_file_drop_handler(mut self) -> Self { self.file_drop_handler_enabled = false; self @@ -57,6 +60,7 @@ impl WebviewAttributes { /// /// **macOS** doesn't provide such method and is always enabled by default, /// but you still need to add menu item accelerators to use shortcuts. + #[must_use] pub fn enable_clipboard_access(mut self) -> Self { self.clipboard = true; self @@ -80,39 +84,51 @@ pub trait WindowBuilder: WindowBuilderBase { fn with_config(config: WindowConfig) -> Self; /// Sets the menu for the window. + #[must_use] fn menu(self, menu: Menu) -> Self; /// Show window in the center of the screen. + #[must_use] fn center(self) -> Self; /// The initial position of the window's. + #[must_use] fn position(self, x: f64, y: f64) -> Self; /// Window size. + #[must_use] fn inner_size(self, min_width: f64, min_height: f64) -> Self; /// Window min inner size. + #[must_use] fn min_inner_size(self, min_width: f64, min_height: f64) -> Self; /// Window max inner size. + #[must_use] fn max_inner_size(self, max_width: f64, max_height: f64) -> Self; /// Whether the window is resizable or not. + #[must_use] fn resizable(self, resizable: bool) -> Self; /// The title of the window in the title bar. + #[must_use] fn title>(self, title: S) -> Self; /// Whether to start the window in fullscreen or not. + #[must_use] fn fullscreen(self, fullscreen: bool) -> Self; /// Whether the window will be initially hidden or focused. + #[must_use] fn focus(self) -> Self; /// Whether the window should be maximized upon creation. + #[must_use] fn maximized(self, maximized: bool) -> Self; /// Whether the window should be immediately visible upon creation. + #[must_use] fn visible(self, visible: bool) -> Self; /// Whether the the window should be transparent. If this is true, writing colors @@ -122,18 +138,22 @@ pub trait WindowBuilder: WindowBuilderBase { doc_cfg, doc(cfg(any(not(target_os = "macos"), feature = "macos-private-api"))) )] + #[must_use] fn transparent(self, transparent: bool) -> Self; /// Whether the window should have borders and bars. + #[must_use] fn decorations(self, decorations: bool) -> Self; /// Whether the window should always be on top of other windows. + #[must_use] fn always_on_top(self, always_on_top: bool) -> Self; /// Sets the window icon. fn icon(self, icon: Icon) -> crate::Result; /// Sets whether or not the window icon should be added to the taskbar. + #[must_use] fn skip_taskbar(self, skip: bool) -> Self; /// Sets a parent to the window to be created. @@ -142,6 +162,7 @@ pub trait WindowBuilder: WindowBuilderBase { /// /// For more information, see #[cfg(windows)] + #[must_use] fn parent_window(self, parent: HWND) -> Self; /// Set an owner to the window to be created. @@ -153,6 +174,7 @@ pub trait WindowBuilder: WindowBuilderBase { /// /// For more information, see #[cfg(windows)] + #[must_use] fn owner_window(self, owner: HWND) -> Self; /// Whether the icon was set or not. diff --git a/core/tauri-runtime/src/window.rs b/core/tauri-runtime/src/window.rs index fe4dada9c..3175ea29f 100644 --- a/core/tauri-runtime/src/window.rs +++ b/core/tauri-runtime/src/window.rs @@ -168,6 +168,7 @@ impl PendingWindow { } } + #[must_use] pub fn set_menu(mut self, menu: Menu) -> Self { let mut menu_ids = HashMap::new(); get_menu_ids(&mut menu_ids, &menu); diff --git a/core/tauri-utils/Cargo.toml b/core/tauri-utils/Cargo.toml index 8ba2aa9c3..519516bf7 100644 --- a/core/tauri-utils/Cargo.toml +++ b/core/tauri-utils/Cargo.toml @@ -7,7 +7,7 @@ homepage = "https://tauri.studio" repository = "https://github.com/tauri-apps/tauri" description = "Utilities for Tauri" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", "/target" ] readme = "README.md" @@ -24,6 +24,13 @@ proc-macro2 = { version = "1.0", optional = true } quote = { version = "1.0", optional = true } schemars = { version = "0.8", features = ["url"], optional = true } serde_with = "1.10" +sha2 = "0.9" +base64 = "0.13" +aes-gcm = { version = "0.9", optional = true } +ring = { version = "0.16", optional = true, features = ["std"] } +once_cell = { version = "1.8", optional = true } +serialize-to-javascript = { git = "https://github.com/chippers/serialize-to-javascript" } + [target."cfg(target_os = \"linux\")".dependencies] heck = "0.4" @@ -32,3 +39,4 @@ heck = "0.4" build = [ "proc-macro2", "quote" ] compression = [ "zstd" ] schema = ["schemars"] +isolation = [ "aes-gcm", "ring", "once_cell" ] diff --git a/core/tauri-utils/src/assets.rs b/core/tauri-utils/src/assets.rs index ab148cc4e..cd4348954 100644 --- a/core/tauri-utils/src/assets.rs +++ b/core/tauri-utils/src/assets.rs @@ -81,6 +81,9 @@ impl> From

for AssetKey { pub enum CspHash<'a> { /// The `script-src` directive. Script(&'a str), + + /// The `style-src` directive. + Style(&'a str), } impl CspHash<'_> { @@ -88,6 +91,7 @@ impl CspHash<'_> { pub fn directive(&self) -> &'static str { match self { Self::Script(_) => "script-src", + Self::Style(_) => "style-src", } } @@ -95,6 +99,7 @@ impl CspHash<'_> { pub fn hash(&self) -> &str { match self { Self::Script(hash) => hash, + Self::Style(hash) => hash, } } } diff --git a/core/tauri-utils/src/config.rs b/core/tauri-utils/src/config.rs index f5bf2743c..91f1dc346 100644 --- a/core/tauri-utils/src/config.rs +++ b/core/tauri-utils/src/config.rs @@ -36,8 +36,8 @@ pub enum WindowUrl { App(PathBuf), } -impl std::fmt::Display for WindowUrl { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { +impl fmt::Display for WindowUrl { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { Self::External(url) => write!(f, "{}", url), Self::App(path) => write!(f, "{}", path.display()), @@ -542,7 +542,7 @@ fn default_file_drop_enabled() -> bool { /// Security configuration. #[skip_serializing_none] -#[derive(Debug, Default, PartialEq, Clone, Deserialize, Serialize)] +#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct SecurityConfig { @@ -557,6 +557,23 @@ pub struct SecurityConfig { /// This is a really important part of the configuration since it helps you ensure your WebView is secured. /// See . pub dev_csp: Option, + /// Freeze the `Object.prototype` when using the custom protocol. + #[serde(default = "default_freeze_prototype")] + pub freeze_prototype: bool, +} + +impl Default for SecurityConfig { + fn default() -> Self { + Self { + csp: None, + dev_csp: None, + freeze_prototype: default_freeze_prototype(), + } + } +} + +fn default_freeze_prototype() -> bool { + true } /// Defines an allowlist type. @@ -1292,12 +1309,37 @@ fn default_window_config() -> Vec { vec![Default::default()] } +/// The application pattern. +#[skip_serializing_none] +#[derive(Debug, PartialEq, Clone, Serialize, Deserialize)] +#[serde(rename_all = "lowercase", tag = "use", content = "options")] +#[cfg_attr(feature = "schema", derive(JsonSchema))] +pub enum PatternKind { + /// Brownfield pattern. + Brownfield, + /// Isolation pattern. Recommended for security purposes. + #[cfg(feature = "isolation")] + Isolation { + /// The dir containing the index.html file that contains the secure isolation application. + dir: PathBuf, + }, +} + +impl Default for PatternKind { + fn default() -> Self { + Self::Brownfield + } +} + /// The Tauri configuration object. #[skip_serializing_none] #[derive(Debug, PartialEq, Clone, Deserialize, Serialize)] #[cfg_attr(feature = "schema", derive(JsonSchema))] #[serde(rename_all = "camelCase", deny_unknown_fields)] pub struct TauriConfig { + /// The pattern to use. + #[serde(default)] + pub pattern: PatternKind, /// The windows configuration. #[serde(default = "default_window_config")] pub windows: Vec, @@ -1325,6 +1367,7 @@ pub struct TauriConfig { impl Default for TauriConfig { fn default() -> Self { Self { + pattern: Default::default(), windows: default_window_config(), cli: None, bundle: BundleConfig::default(), @@ -1338,6 +1381,20 @@ impl Default for TauriConfig { } impl TauriConfig { + /// Returns all Cargo features. + #[allow(dead_code)] + pub fn all_features() -> Vec<&'static str> { + let mut features = AllowlistConfig::all_features(); + features.extend(vec![ + "cli", + "updater", + "system-tray", + "macos-private-api", + "isolation", + ]); + features + } + /// Returns the enabled Cargo features. #[allow(dead_code)] pub fn features(&self) -> Vec<&str> { @@ -1354,6 +1411,10 @@ impl TauriConfig { if self.macos_private_api { features.push("macos-private-api"); } + #[cfg(feature = "isolation")] + if let PatternKind::Isolation { .. } = self.pattern { + features.push("isolation"); + } features.sort_unstable(); features } @@ -1964,6 +2025,21 @@ mod build { } } + impl ToTokens for PatternKind { + fn to_tokens(&self, tokens: &mut TokenStream) { + let prefix = quote! { ::tauri::utils::config::PatternKind }; + + tokens.append_all(match self { + Self::Brownfield => quote! { #prefix::Brownfield }, + #[cfg(feature = "isolation")] + Self::Isolation { dir } => { + let dir = path_buf_lit(dir); + quote! { #prefix::Isolation { dir: #dir } } + } + }) + } + } + impl ToTokens for WindowsConfig { fn to_tokens(&self, tokens: &mut TokenStream) { let webview_fixed_runtime_path = opt_lit( @@ -2082,8 +2158,9 @@ mod build { fn to_tokens(&self, tokens: &mut TokenStream) { let csp = opt_str_lit(self.csp.as_ref()); let dev_csp = opt_str_lit(self.dev_csp.as_ref()); + let freeze_prototype = self.freeze_prototype; - literal_struct!(tokens, SecurityConfig, csp, dev_csp); + literal_struct!(tokens, SecurityConfig, csp, dev_csp, freeze_prototype); } } @@ -2151,6 +2228,7 @@ mod build { impl ToTokens for TauriConfig { fn to_tokens(&self, tokens: &mut TokenStream) { + let pattern = &self.pattern; let windows = vec_lit(&self.windows, identity); let cli = opt_lit(self.cli.as_ref()); let bundle = &self.bundle; @@ -2163,6 +2241,7 @@ mod build { literal_struct!( tokens, TauriConfig, + pattern, windows, cli, bundle, @@ -2234,6 +2313,7 @@ mod test { // create a tauri config. let tauri = TauriConfig { + pattern: Default::default(), windows: vec![WindowConfig { label: "main".to_string(), url: WindowUrl::default(), @@ -2283,6 +2363,7 @@ mod test { security: SecurityConfig { csp: None, dev_csp: None, + freeze_prototype: true, }, allowlist: AllowlistConfig::default(), system_tray: None, diff --git a/core/tauri-utils/src/html.rs b/core/tauri-utils/src/html.rs index df163e1dd..a06b1fad4 100644 --- a/core/tauri-utils/src/html.rs +++ b/core/tauri-utils/src/html.rs @@ -4,8 +4,18 @@ //! The module to process HTML in Tauri. +use std::path::{Path, PathBuf}; + use html5ever::{interface::QualName, namespace_url, ns, tendril::TendrilSink, LocalName}; -use kuchiki::{Attribute, ExpandedName, NodeRef}; +pub use kuchiki::NodeRef; +use kuchiki::{Attribute, ExpandedName}; +use serde::Serialize; +#[cfg(feature = "isolation")] +use serialize_to_javascript::DefaultTemplate; + +use crate::config::PatternKind; +#[cfg(feature = "isolation")] +use crate::pattern::isolation::IsolationJavascriptCodegen; /// The token used on the CSP tag content. pub const CSP_TOKEN: &str = "__TAURI_CSP__"; @@ -13,14 +23,25 @@ pub const CSP_TOKEN: &str = "__TAURI_CSP__"; pub const SCRIPT_NONCE_TOKEN: &str = "__TAURI_SCRIPT_NONCE__"; /// The token used for style nonces. pub const STYLE_NONCE_TOKEN: &str = "__TAURI_STYLE_NONCE__"; -/// The token used for the invoke key. -pub const INVOKE_KEY_TOKEN: &str = "__TAURI__INVOKE_KEY_TOKEN__"; /// Parses the given HTML string. pub fn parse(html: String) -> NodeRef { kuchiki::parse_html().one(html) } +fn with_head(document: &mut NodeRef, f: F) { + if let Ok(ref node) = document.select_first("head") { + f(node.as_node()) + } else { + let node = NodeRef::new_element( + QualName::new(None, ns!(html), LocalName::from("head")), + None, + ); + f(&node); + document.prepend(node) + } +} + fn inject_nonce(document: &mut NodeRef, selector: &str, token: &str) { if let Ok(scripts) = document.select(selector) { for target in scripts { @@ -43,88 +64,11 @@ pub fn inject_nonce_token(document: &mut NodeRef) { inject_nonce(document, "style", STYLE_NONCE_TOKEN); } -/// Injects the invoke key token to each script on the document. -/// -/// The invoke key token is replaced at runtime with the actual invoke key value. -pub fn inject_invoke_key_token(document: &mut NodeRef) { - let mut targets = vec![]; - if let Ok(scripts) = document.select("script") { - for target in scripts { - targets.push(target); - } - for target in targets { - let node = target.as_node(); - let element = node.as_element().unwrap(); - - let attrs = element.attributes.borrow(); - // if the script is external (has `src`), we won't inject the token - if attrs.get("src").is_some() { - continue; - } - - let replacement_node = match attrs.get("type") { - Some("module") | Some("application/ecmascript") => { - let replacement_node = NodeRef::new_element( - QualName::new(None, ns!(html), "script".into()), - element - .attributes - .borrow() - .clone() - .map - .into_iter() - .collect::>(), - ); - let script = node.text_contents(); - replacement_node.append(NodeRef::new_text(format!( - r#" - const __TAURI_INVOKE_KEY__ = {token}; - {script} - "#, - token = INVOKE_KEY_TOKEN, - script = script - ))); - replacement_node - } - Some("application/javascript") | None => { - let replacement_node = NodeRef::new_element( - QualName::new(None, ns!(html), "script".into()), - element - .attributes - .borrow() - .clone() - .map - .into_iter() - .collect::>(), - ); - let script = node.text_contents(); - replacement_node.append(NodeRef::new_text( - script.replace("__TAURI_INVOKE_KEY__", INVOKE_KEY_TOKEN), - )); - replacement_node - } - _ => { - continue; - } - }; - - node.insert_after(replacement_node); - node.detach(); - } - } -} - /// Injects a content security policy to the HTML. pub fn inject_csp(document: &mut NodeRef, csp: &str) { - if let Ok(ref head) = document.select_first("head") { - head.as_node().append(create_csp_meta_tag(csp)); - } else { - let head = NodeRef::new_element( - QualName::new(None, ns!(html), LocalName::from("head")), - None, - ); + with_head(document, |head| { head.append(create_csp_meta_tag(csp)); - document.prepend(head); - } + }); } /// Injects a content security policy token to the HTML. @@ -154,9 +98,101 @@ fn create_csp_meta_tag(csp: &str) -> NodeRef { ) } +/// The shape of the JavaScript Pattern config +#[derive(Debug, Serialize)] +#[serde(rename_all = "lowercase", tag = "pattern")] +pub enum PatternObject { + /// Brownfield pattern. + Brownfield, + /// Isolation pattern. Recommended for security purposes. + Isolation { + /// Which `IsolationSide` this `PatternObject` is getting injected into + side: IsolationSide, + }, +} + +impl From<&PatternKind> for PatternObject { + fn from(pattern_kind: &PatternKind) -> Self { + match pattern_kind { + PatternKind::Brownfield => Self::Brownfield, + #[cfg(feature = "isolation")] + PatternKind::Isolation { .. } => Self::Isolation { + side: IsolationSide::default(), + }, + } + } +} + +/// Where the JavaScript is injected to +#[derive(Debug, Serialize)] +#[serde(rename_all = "lowercase")] +pub enum IsolationSide { + /// Original frame, the Brownfield application + Original, + /// Secure frame, the isolation security application + Secure, +} + +impl Default for IsolationSide { + fn default() -> Self { + Self::Original + } +} + +/// Injects the Isolation JavaScript to a codegen time document. +/// +/// Note: This function is not considered part of the stable API. +#[cfg(feature = "isolation")] +pub fn inject_codegen_isolation_script(document: &mut NodeRef) { + with_head(document, |head| { + let script = NodeRef::new_element(QualName::new(None, ns!(html), "script".into()), None); + script.append(NodeRef::new_text( + IsolationJavascriptCodegen {} + .render_default(&Default::default()) + .expect("unable to render codegen isolation script template"), + )); + + head.prepend(script); + }); +} + +/// Temporary workaround for Windows not allowing requests +/// +/// Note: this does not prevent path traversal due to the isolation application expectation that it +/// is secure. +pub fn inline_isolation(document: &mut NodeRef, dir: &Path) { + for script in document + .select("script[src]") + .expect("unable to parse document for scripts") + { + let src = { + let attributes = script.attributes.borrow(); + attributes + .get(LocalName::from("src")) + .expect("script with src attribute has no src value") + .to_string() + }; + + let mut path = PathBuf::from(src); + if path.has_root() { + path = path + .strip_prefix("/") + .expect("Tauri \"Isolation\" Pattern only supports relative or absolute (`/`) paths.") + .into(); + } + + let file = std::fs::read_to_string(dir.join(path)).expect("unable to find isolation file"); + script.as_node().append(NodeRef::new_text(file)); + + let mut attributes = script.attributes.borrow_mut(); + attributes.remove(LocalName::from("src")); + } +} + #[cfg(test)] mod tests { use kuchiki::traits::*; + #[test] fn csp() { let htmls = vec![ diff --git a/core/tauri-utils/src/lib.rs b/core/tauri-utils/src/lib.rs index 19c72497e..597418b02 100644 --- a/core/tauri-utils/src/lib.rs +++ b/core/tauri-utils/src/lib.rs @@ -10,6 +10,9 @@ pub mod config; pub mod html; pub mod platform; +/// Application pattern. +pub mod pattern; + /// `tauri::App` package information. #[derive(Debug, Clone)] pub struct PackageInfo { @@ -112,4 +115,7 @@ pub enum Error { /// IO error #[error("{0}")] Io(#[from] std::io::Error), + /// Invalid pattern. + #[error("invalid pattern `{0}`. Expected either `brownfield` or `isolation`.")] + InvalidPattern(String), } diff --git a/core/tauri-utils/src/pattern/isolation.js b/core/tauri-utils/src/pattern/isolation.js new file mode 100644 index 000000000..42e2604ce --- /dev/null +++ b/core/tauri-utils/src/pattern/isolation.js @@ -0,0 +1,115 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/** + * IMPORTANT: See ipc.js for the main frame implementation. + * main frame -> isolation frame = isolation payload + * isolation frame -> main frame = isolation message + */ + +;(async function () { + /** + * Sends the message to the isolation frame. + * @param {any} message + */ + function sendMessage(message) { + window.parent.postMessage(message, '*') + } + + /** + * @type {Uint8Array} - Injected by Tauri during runtime + */ + const aesGcmKeyRaw = new Uint8Array(__TEMPLATE_runtime_aes_gcm_key__) + + /** + * @type {CryptoKey} + */ + const aesGcmKey = await window.crypto.subtle.importKey( + 'raw', + aesGcmKeyRaw, + 'AES-GCM', + true, + ['encrypt'] + ) + + /** + * @param {object} data + * @return {Promise<{nonce: number[], payload: number[]}>} + */ + async function encrypt(data) { + let algorithm = Object.create(null) + algorithm.name = 'AES-GCM' + algorithm.iv = window.crypto.getRandomValues(new Uint8Array(12)) + + let encoder = new TextEncoder() + let payloadRaw = encoder.encode(JSON.stringify(data)) + + return window.crypto.subtle + .encrypt(algorithm, aesGcmKey, payloadRaw) + .then((payload) => { + let result = Object.create(null) + result.nonce = Array.from(new Uint8Array(algorithm.iv)) + result.payload = Array.from(new Uint8Array(payload)) + return result + }) + } + + /** + * Detect if a message event is a valid isolation payload. + * + * @param {MessageEvent} event - a message event that is expected to be an isolation payload + * @return boolean + */ + function isIsolationPayload(event) { + return ( + typeof event.data === 'object' && + 'callback' in event.data && + 'error' in event.data + ) + } + + /** + * Handle incoming payload events. + * @param {MessageEvent} event + */ + async function payloadHandler(event) { + if (!isIsolationPayload(event)) { + return + } + + let data = event.data + + if (typeof window.__TAURI_ISOLATION_HOOK__ === 'function') { + // await even if it's not async so that we can support async ones + data = await window.__TAURI_ISOLATION_HOOK__(data) + } + + const encrypted = await encrypt(data) + sendMessage(encrypted) + } + + window.addEventListener('message', payloadHandler, false) + + /** + * @type {number} - How many milliseconds to wait between ready checks + */ + const readyIntervalMs = 50 + + /** + * Wait until this Isolation context is ready to receive messages, and let the main frame know. + */ + function waitUntilReady() { + // consider either a function or an explicitly set null value as the ready signal + if ( + typeof window.__TAURI_ISOLATION_HOOK__ === 'function' || + window.__TAURI_ISOLATION_HOOK__ === null + ) { + sendMessage('__TAURI_ISOLATION_READY__') + } else { + setTimeout(waitUntilReady, readyIntervalMs) + } + } + + setTimeout(waitUntilReady, readyIntervalMs) +})() diff --git a/core/tauri-utils/src/pattern/isolation.rs b/core/tauri-utils/src/pattern/isolation.rs new file mode 100644 index 000000000..8e3c8d581 --- /dev/null +++ b/core/tauri-utils/src/pattern/isolation.rs @@ -0,0 +1,164 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::array::TryFromSliceError; +use std::borrow::Cow; +use std::fmt::{Debug, Formatter}; +use std::string::FromUtf8Error; + +use aes_gcm::aead::Aead; +use aes_gcm::{aead::NewAead, Aes256Gcm, Nonce}; +use once_cell::sync::OnceCell; +use ring::error::Unspecified; +use ring::rand::SystemRandom; +use serialize_to_javascript::{default_template, Template}; + +/// Cryptographically secure pseudo-random number generator. +static RNG: OnceCell = OnceCell::new(); + +/// The style for the isolation iframe. +pub const IFRAME_STYLE: &str = "#__tauri_isolation__ { display: none !important }"; + +/// Errors that can occur during Isolation keys generation. +#[derive(Debug, thiserror::Error)] +#[non_exhaustive] +pub enum Error { + /// Something went wrong with the CSPRNG. + #[error("Unspecified CSPRNG error")] + Csprng, + + /// Something went wrong with decryping an AES-GCM payload + #[error("AES-GCM")] + Aes, + + /// Nonce was not 96 bits + #[error("Nonce: {0}")] + NonceSize(#[from] TryFromSliceError), + + /// Payload was not valid utf8 + #[error("{0}")] + Utf8(#[from] FromUtf8Error), + + /// Invalid json format + #[error("{0}")] + Json(#[from] serde_json::Error), +} + +impl From for Error { + fn from(_: Unspecified) -> Self { + Self::Csprng + } +} + +/// A formatted AES-GCM cipher instance along with the key used to initialize it. +#[derive(Clone)] +pub struct AesGcmPair { + raw: [u8; 32], + key: Aes256Gcm, +} + +impl Debug for AesGcmPair { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "AesGcmPair(...)") + } +} + +impl AesGcmPair { + fn new() -> Result { + let rng = RNG.get_or_init(SystemRandom::new); + let raw: [u8; 32] = ring::rand::generate(rng)?.expose(); + let key = aes_gcm::Key::from_slice(&raw); + Ok(Self { + raw, + key: Aes256Gcm::new(key), + }) + } + + /// The raw value used to create the AES-GCM key + pub fn raw(&self) -> &[u8; 32] { + &self.raw + } + + /// The formatted AES-GCM key + pub fn key(&self) -> &Aes256Gcm { + &self.key + } +} + +/// All cryptographic keys required for Isolation encryption +#[derive(Debug, Clone)] +pub struct Keys { + /// AES-GCM key + aes_gcm: AesGcmPair, +} + +impl Keys { + /// Securely generate required keys for Isolation encryption. + pub fn new() -> Result { + AesGcmPair::new() + .map(|aes_gcm| Self { aes_gcm }) + .map_err(Into::into) + } + + /// The AES-GCM data (and raw data). + pub fn aes_gcm(&self) -> &AesGcmPair { + &self.aes_gcm + } + + /// Decrypts a message using the generated keys. + pub fn decrypt(&self, raw: RawIsolationPayload<'_>) -> Result { + let RawIsolationPayload { nonce, payload } = raw; + let nonce: [u8; 12] = nonce.as_ref().try_into()?; + let bytes = self + .aes_gcm + .key + .decrypt(Nonce::from_slice(&nonce), payload.as_ref()) + .map_err(|_| self::Error::Aes)?; + + String::from_utf8(bytes).map_err(Into::into) + } +} + +/// Raw representation of +#[derive(Debug, serde::Deserialize)] +pub struct RawIsolationPayload<'a> { + nonce: Cow<'a, [u8]>, + payload: Cow<'a, [u8]>, +} + +impl<'a> TryFrom<&'a str> for RawIsolationPayload<'a> { + type Error = Error; + + fn try_from(value: &'a str) -> Result { + serde_json::from_str(value).map_err(Into::into) + } +} + +/// The Isolation JavaScript template meant to be injected during codegen. +/// +/// Note: This struct is not considered part of the stable API +#[derive(Template)] +#[default_template("isolation.js")] +pub struct IsolationJavascriptCodegen { + // this template intentionally does not include the runtime field +} + +/// The Isolation JavaScript template meant to be injected during runtime. +/// +/// Note: This struct is not considered part of the stable API +#[derive(Template)] +#[default_template("isolation.js")] +pub struct IsolationJavascriptRuntime<'a> { + /// The key used on the Rust backend and the Isolation Javascript + pub runtime_aes_gcm_key: &'a [u8; 32], +} + +#[cfg(test)] +mod test { + #[test] + fn create_keys() -> Result<(), Box> { + let _ = super::Keys::new()?; + Ok(()) + } +} diff --git a/core/tauri-utils/src/pattern/mod.rs b/core/tauri-utils/src/pattern/mod.rs new file mode 100644 index 000000000..d0a1019b0 --- /dev/null +++ b/core/tauri-utils/src/pattern/mod.rs @@ -0,0 +1,7 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/// Handling the Tauri "Isolation" Pattern. +#[cfg(feature = "isolation")] +pub mod isolation; diff --git a/core/tauri/Cargo.toml b/core/tauri/Cargo.toml index 6e1f5b64e..aa048b840 100644 --- a/core/tauri/Cargo.toml +++ b/core/tauri/Cargo.toml @@ -3,7 +3,7 @@ authors = ["Tauri Programme within The Commons Conservancy"] categories = ["gui", "web-programming"] description = "Make tiny, secure apps for all desktop platforms with Tauri" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ "/test", "/.scripts", @@ -77,6 +77,7 @@ epi = { git = "https://github.com/wusyong/egui", branch = "tao", optional = true regex = "1.5" glob = "0.3" data-url = "0.1" +serialize-to-javascript = { git = "https://github.com/chippers/serialize-to-javascript" } [target."cfg(any(target_os = \"linux\", target_os = \"dragonfly\", target_os = \"freebsd\", target_os = \"openbsd\", target_os = \"netbsd\"))".dependencies] glib = "0.14" @@ -99,10 +100,14 @@ tauri = {path = "."} tokio-test = "0.4.2" tokio = { version = "1.15", features = [ "full" ] } +[target."cfg(windows)".dev-dependencies] +webview2-com = "0.7.0" + [features] default = [ "wry", "compression" ] compression = [ "tauri-macros/compression", "tauri-utils/compression" ] wry = ["tauri-runtime-wry"] +isolation = ["tauri-utils/isolation", "tauri-macros/isolation"] custom-protocol = ["tauri-macros/custom-protocol"] updater = ["minisign-verify", "base64", "dialog-ask"] http-api = ["attohttpc"] @@ -233,10 +238,12 @@ path = "../../examples/helloworld/src-tauri/src/main.rs" [[example]] name = "multiwindow" path = "../../examples/multiwindow/src-tauri/src/main.rs" +required-features = [ "window-create" ] [[example]] name = "navigation" path = "../../examples/navigation/src-tauri/src/main.rs" +required-features = [ "window-create" ] [[example]] name = "splashscreen" @@ -249,3 +256,8 @@ path = "../../examples/state/src-tauri/src/main.rs" [[example]] name = "streaming" path = "../../examples/streaming/src-tauri/src/main.rs" + +[[example]] +name = "isolation" +path = "../../examples/isolation/src-tauri/src/main.rs" +required-features = [ "isolation" ] diff --git a/core/tauri/scripts/bundle.js b/core/tauri/scripts/bundle.js index 6e1ad0fc4..4ba48f463 100644 --- a/core/tauri/scripts/bundle.js +++ b/core/tauri/scripts/bundle.js @@ -1 +1 @@ -function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,i)}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,o)}),!0);window.__TAURI_POST_MESSAGE__(t,_objectSpread({__invokeKey:__TAURI_INVOKE_KEY__,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){return navigator.userAgent.includes("Windows")?"https://asset.localhost/".concat(e):"asset://".concat(e)}});function s(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.apply(this,arguments)}});function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return g.apply(this,arguments)}});function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var x=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return v.apply(this,arguments)},message:function(e){return b.apply(this,arguments)},ask:function(e,t){return R.apply(this,arguments)},confirm:function(e,t){return k.apply(this,arguments)}});function T(e,t,r){return G.apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e){return M.apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",eventId:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,handler:a(r)}}).then((function(e){return _asyncToGenerator(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",P(e));case 1:case"end":return t.stop()}}),t)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e,t){return S.apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,(function(e){r(e),P(e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function A(e,t){return D.apply(this,arguments)}function D(){return(D=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",T(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var z,L=Object.freeze({__proto__:null,listen:O,once:C,emit:A});function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}}).then((function(e){return(new TextDecoder).decode(new Uint8Array(e))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(){return(F=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from((new TextEncoder).encode(t.contents)),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from(t.contents),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App";e[e.Current=19]="Current";e[e.Log=20]="Log"}(z||(z={}));var J=Object.freeze({__proto__:null,get BaseDirectory(){return z},get Dir(){return z},readTextFile:function(e){return E.apply(this,arguments)},readBinaryFile:function(e){return W.apply(this,arguments)},writeFile:function(e){return F.apply(this,arguments)},writeBinaryFile:function(e){return I.apply(this,arguments)},readDir:function(e){return N.apply(this,arguments)},createDir:function(e){return U.apply(this,arguments)},removeDir:function(e){return H.apply(this,arguments)},copyFile:function(e,t){return q.apply(this,arguments)},removeFile:function(e){return B.apply(this,arguments)},renameFile:function(e,t){return V.apply(this,arguments)}});function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(){return(Q=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(){return(X=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Z,ee=Object.freeze({__proto__:null,register:function(e,t){return K.apply(this,arguments)},registerAll:function(e,t){return Y.apply(this,arguments)},isRegistered:function(e){return $.apply(this,arguments)},unregister:function(e){return Q.apply(this,arguments)},unregisterAll:function(){return X.apply(this,arguments)}});function te(e,t){return null!=e?e:t()}function re(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),oe=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===Z.JSON)&&(t.responseType=Z.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new ae(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function ie(e){return ue.apply(this,arguments)}function ue(){return(ue=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new oe(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var se=null;function ce(){return(ce=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==se){e.next=4;break}return e.next=3,ie();case 3:se=e.sent;case 4:return e.abrupt("return",se.request(_objectSpread({url:t,method:te(re([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var pe=Object.freeze({__proto__:null,getClient:ie,fetch:function(e,t){return ce.apply(this,arguments)},Body:ne,Client:oe,Response:ae,get ResponseType(){return Z}});function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fe(){return(fe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var he=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return fe.apply(this,arguments)},isPermissionGranted:function(){return le.apply(this,arguments)}});function me(){return navigator.appVersion.includes("Win")}function de(){return(de=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(){return(ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(){return(ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(){return(_e=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function we(){return(we=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return(be=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){return(Re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(){return(Pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Current}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ze=me()?"\\":"/",Le=me()?";":":";function Ee(){return(Ee=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(){return(Ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Je=Object.freeze({__proto__:null,exit:function(){return Be.apply(this,arguments)},relaunch:function(){return Ve.apply(this,arguments)}});function Ke(e,t){return null!=e?e:t()}function Ye(e,t,r,n){return $e.apply(this,arguments)}function $e(){return($e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n,o){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:"string"==typeof n?[n]:n,options:o,onEventFn:a(t)}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qe=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),Xe=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:t}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),Ze=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=Ke(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new Qe}},{key:"__init3",value:function(){this.stderr=new Qe}},{key:"spawn",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ye((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new Xe(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(Qe);function et(){return(et=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var tt=Object.freeze({__proto__:null,Command:Ze,Child:Xe,open:function(e,t){return et.apply(this,arguments)}});function rt(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),it([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return ft().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(dt),gt=new yt(null,{skip:!0});function _t(){return(_t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wt(){return(wt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vt(){return(vt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var bt=Object.freeze({__proto__:null,WebviewWindow:yt,WebviewWindowHandle:mt,WindowManager:dt,getCurrent:function(){return new yt(window.__TAURI__.__currentWindow.label,{skip:!0})},getAll:ft,appWindow:gt,LogicalSize:st,PhysicalSize:ct,LogicalPosition:pt,PhysicalPosition:lt,get UserAttentionType(){return ut},currentMonitor:function(){return _t.apply(this,arguments)},primaryMonitor:function(){return wt.apply(this,arguments)},availableMonitors:function(){return vt.apply(this,arguments)}}),Rt=me()?"\r\n":"\n";function kt(){return(kt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xt(){return(xt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tt(){return(Tt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gt(){return(Gt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pt(){return(Pt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Mt=Object.freeze({__proto__:null,EOL:Rt,platform:function(){return kt.apply(this,arguments)},version:function(){return xt.apply(this,arguments)},type:function(){return Tt.apply(this,arguments)},arch:function(){return Gt.apply(this,arguments)},tempdir:function(){return Pt.apply(this,arguments)}}),Ot=o;e.app=h,e.cli=d,e.clipboard=_,e.dialog=x,e.event=L,e.fs=J,e.globalShortcut=ee,e.http=pe,e.invoke=Ot,e.notification=he,e.os=Mt,e.path=qe,e.process=Je,e.shell=tt,e.tauri=u,e.updater=ot,e.window=bt,Object.defineProperty(e,"__esModule",{value:!0})})); +function _inherits(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&_setPrototypeOf(e,t)}function _setPrototypeOf(e,t){return(_setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function _createSuper(e){var t=_isNativeReflectConstruct();return function(){var r,n=_getPrototypeOf(e);if(t){var a=_getPrototypeOf(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _possibleConstructorReturn(this,r)}}function _possibleConstructorReturn(e,t){if(t&&("object"===_typeof(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(e)}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function _isNativeReflectConstruct(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function _getPrototypeOf(e){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _createForOfIteratorHelper(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=_unsupportedIterableToArray(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,i=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){u=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(u)throw o}}}}function _unsupportedIterableToArray(e,t){if(e){if("string"==typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),d}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:O(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),d}},e}("object"===("undefined"==typeof module?"undefined":_typeof(module))?module.exports:{});try{regeneratorRuntime=t}catch(e){"object"===("undefined"==typeof globalThis?"undefined":_typeof(globalThis))?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}function r(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]&&arguments[1],a=n(),o="_".concat(a);return Object.defineProperty(window,o,{value:function(n){return t&&Reflect.deleteProperty(window,o),r([e,"optionalCall",function(e){return e(n)}])},writable:!1,configurable:!0}),a}function o(e){return i.apply(this,arguments)}function i(){return(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",new Promise((function(e,n){var o=a((function(t){e(t),Reflect.deleteProperty(window,i)}),!0),i=a((function(e){n(e),Reflect.deleteProperty(window,o)}),!0);window.__TAURI_IPC__(_objectSpread({cmd:t,callback:o,error:i},r))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var u=Object.freeze({__proto__:null,transformCallback:a,invoke:o,convertFileSrc:function(e){return navigator.userAgent.includes("Windows")?"https://asset.localhost/".concat(e):"asset://".concat(e)}});function s(e){return c.apply(this,arguments)}function c(){return(c=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",o("tauri",t));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function p(){return(p=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function l(){return(l=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getAppName"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function f(){return(f=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"App",message:{cmd:"getTauriVersion"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var h=Object.freeze({__proto__:null,getName:function(){return l.apply(this,arguments)},getVersion:function(){return p.apply(this,arguments)},getTauriVersion:function(){return f.apply(this,arguments)}});function m(){return(m=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Cli",message:{cmd:"cliMatches"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var d=Object.freeze({__proto__:null,getMatches:function(){return m.apply(this,arguments)}});function y(){return(y=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"writeText",data:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function g(){return(g=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Clipboard",message:{cmd:"readText"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var _=Object.freeze({__proto__:null,writeText:function(e){return y.apply(this,arguments)},readText:function(){return g.apply(this,arguments)}});function w(){return(w=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"openDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function v(){return(v=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(t=r.length>0&&void 0!==r[0]?r[0]:{})&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:t}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function b(){return(b=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function R(){return(R=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"askDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function k(){return(k=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:r,message:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var x=Object.freeze({__proto__:null,open:function(){return w.apply(this,arguments)},save:function(){return v.apply(this,arguments)},message:function(e){return b.apply(this,arguments)},ask:function(e,t){return R.apply(this,arguments)},confirm:function(e,t){return k.apply(this,arguments)}});function T(e,t,r){return G.apply(this,arguments)}function G(){return(G=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s({__tauriModule:"Event",message:{cmd:"emit",event:t,windowLabel:r,payload:"string"==typeof n?n:JSON.stringify(n)}});case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function P(e){return M.apply(this,arguments)}function M(){return(M=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"unlisten",eventId:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function O(e,t){return j.apply(this,arguments)}function j(){return(j=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Event",message:{cmd:"listen",event:t,handler:a(r)}}).then((function(e){return _asyncToGenerator(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",P(e));case 1:case"end":return t.stop()}}),t)})))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function C(e,t){return S.apply(this,arguments)}function S(){return(S=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",O(t,(function(e){r(e),P(e.id).catch((function(){}))})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function D(e,t){return A.apply(this,arguments)}function A(){return(A=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",T(t,null,r));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var z,L=Object.freeze({__proto__:null,listen:O,once:C,emit:D});function E(){return(E=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}}).then((function(e){return(new TextDecoder).decode(new Uint8Array(e))})));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function W(){return(W=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function F(){return(F=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from((new TextEncoder).encode(t.contents)),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function I(){return(I=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(r=n.length>1&&void 0!==n[1]?n[1]:{})&&Object.freeze(r),"object"===_typeof(t)&&Object.freeze(t),e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"writeFile",path:t.path,contents:Array.from(t.contents),options:r}}));case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function N(){return(N=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"readDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function U(){return(U=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"createDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function H(){return(H=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeDir",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function q(){return(q=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"copyFile",source:t,destination:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function B(){return(B=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=n.length>1&&void 0!==n[1]?n[1]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"removeFile",path:t,options:r}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function V(){return(V=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){var n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=a.length>2&&void 0!==a[2]?a[2]:{},e.abrupt("return",s({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:t,newPath:r,options:n}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}!function(e){e[e.Audio=1]="Audio";e[e.Cache=2]="Cache";e[e.Config=3]="Config";e[e.Data=4]="Data";e[e.LocalData=5]="LocalData";e[e.Desktop=6]="Desktop";e[e.Document=7]="Document";e[e.Download=8]="Download";e[e.Executable=9]="Executable";e[e.Font=10]="Font";e[e.Home=11]="Home";e[e.Picture=12]="Picture";e[e.Public=13]="Public";e[e.Runtime=14]="Runtime";e[e.Template=15]="Template";e[e.Video=16]="Video";e[e.Resource=17]="Resource";e[e.App=18]="App";e[e.Current=19]="Current";e[e.Log=20]="Log"}(z||(z={}));var J=Object.freeze({__proto__:null,get BaseDirectory(){return z},get Dir(){return z},readTextFile:function(e){return E.apply(this,arguments)},readBinaryFile:function(e){return W.apply(this,arguments)},writeFile:function(e){return F.apply(this,arguments)},writeBinaryFile:function(e){return I.apply(this,arguments)},readDir:function(e){return N.apply(this,arguments)},createDir:function(e){return U.apply(this,arguments)},removeDir:function(e){return H.apply(this,arguments)},copyFile:function(e,t){return q.apply(this,arguments)},removeFile:function(e){return B.apply(this,arguments)},renameFile:function(e,t){return V.apply(this,arguments)}});function K(){return(K=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Y(){return(Y=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:t,handler:a(r)}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function $(){return($=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Q(){return(Q=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:t}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function X(){return(X=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Z,ee=Object.freeze({__proto__:null,register:function(e,t){return K.apply(this,arguments)},registerAll:function(e,t){return Y.apply(this,arguments)},isRegistered:function(e){return $.apply(this,arguments)},unregister:function(e){return Q.apply(this,arguments)},unregisterAll:function(){return X.apply(this,arguments)}});function te(e,t){return null!=e?e:t()}function re(e){for(var t=void 0,r=e[0],n=1;n=200&&this.status<300,this.headers=t.headers,this.rawHeaders=t.rawHeaders,this.data=t.data})),oe=function(){function e(t){_classCallCheck(this,e),this.id=t}var t,r,n,a,o,i,u;return _createClass(e,[{key:"drop",value:(u=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"request",value:(i=_asyncToGenerator(regeneratorRuntime.mark((function e(t){var r;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=!t.responseType||t.responseType===Z.JSON)&&(t.responseType=Z.Text),e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then((function(e){var t=new ae(e);if(r){try{t.data=JSON.parse(t.data)}catch(e){if(t.ok&&""===t.data)t.data={};else if(t.ok)throw Error("Failed to parse response `".concat(t.data,"` as JSON: ").concat(e,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return t}return t})));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"get",value:(o=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"GET",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"post",value:(a=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"POST",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"put",value:(n=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PUT",url:t,body:r},n)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"patch",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"PATCH",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"delete",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.request(_objectSpread({method:"DELETE",url:t},r)));case 1:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),e}();function ie(e){return ue.apply(this,arguments)}function ue(){return(ue=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then((function(e){return new oe(e)})));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var se=null;function ce(){return(ce=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!==se){e.next=4;break}return e.next=3,ie();case 3:se=e.sent;case 4:return e.abrupt("return",se.request(_objectSpread({url:t,method:te(re([r,"optionalAccess",function(e){return e.method}]),(function(){return"GET"}))},r)));case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var pe=Object.freeze({__proto__:null,getClient:ie,fetch:function(e,t){return ce.apply(this,arguments)},Body:ne,Client:oe,Response:ae,get ResponseType(){return Z}});function le(){return(le=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("default"===window.Notification.permission){e.next=2;break}return e.abrupt("return",Promise.resolve("granted"===window.Notification.permission));case 2:return e.abrupt("return",s({__tauriModule:"Notification",message:{cmd:"isNotificationPermissionGranted"}}));case 3:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function fe(){return(fe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",window.Notification.requestPermission());case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var he=Object.freeze({__proto__:null,sendNotification:function(e){"string"==typeof e?new window.Notification(e):new window.Notification(e.title,e)},requestPermission:function(){return fe.apply(this,arguments)},isPermissionGranted:function(){return le.apply(this,arguments)}});function me(){return navigator.appVersion.includes("Win")}function de(){return(de=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.App}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ye(){return(ye=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Audio}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ge(){return(ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Cache}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function _e(){return(_e=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Config}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function we(){return(we=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Data}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ve(){return(ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Desktop}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function be(){return(be=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Document}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Re(){return(Re=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Download}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function ke(){return(ke=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Executable}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xe(){return(xe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Font}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Te(){return(Te=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Home}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ge(){return(Ge=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.LocalData}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pe(){return(Pe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Picture}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Me(){return(Me=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Public}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Oe(){return(Oe=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Resource}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function je(){return(je=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Runtime}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ce(){return(Ce=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Template}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Se(){return(Se=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Video}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function De(){return(De=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Current}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ae(){return(Ae=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Path",message:{cmd:"resolvePath",path:"",directory:z.Log}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var ze=me()?"\\":"/",Le=me()?";":":";function Ee(){return(Ee=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t,r,n,a=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=a.length,r=new Array(t),n=0;n0&&void 0!==r[0]?r[0]:0,e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"exit",exitCode:t}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Ve(){return(Ve=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Process",message:{cmd:"relaunch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Je=Object.freeze({__proto__:null,exit:function(){return Be.apply(this,arguments)},relaunch:function(){return Ve.apply(this,arguments)}});function Ke(e,t){return null!=e?e:t()}function Ye(e,t,r,n){return $e.apply(this,arguments)}function $e(){return($e=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r,n,o){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"object"===_typeof(n)&&Object.freeze(n),e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"execute",program:r,args:"string"==typeof n?[n]:n,options:o,onEventFn:a(t)}}));case 2:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Qe=function(){function e(){_classCallCheck(this,e),e.prototype.__init.call(this)}return _createClass(e,[{key:"__init",value:function(){this.eventListeners=Object.create(null)}},{key:"addEventListener",value:function(e,t){e in this.eventListeners?this.eventListeners[e].push(t):this.eventListeners[e]=[t]}},{key:"_emit",value:function(e,t){if(e in this.eventListeners){var r,n=_createForOfIteratorHelper(this.eventListeners[e]);try{for(n.s();!(r=n.n()).done;){(0,r.value)(t)}}catch(e){n.e(e)}finally{n.f()}}}},{key:"on",value:function(e,t){return this.addEventListener(e,t),this}}]),e}(),Xe=function(){function e(t){_classCallCheck(this,e),this.pid=t}var t,r;return _createClass(e,[{key:"write",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"stdinWrite",pid:this.pid,buffer:t}}));case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"kill",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"killChild",pid:this.pid}}));case 1:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),e}(),Ze=function(e){_inherits(a,e);var t,r,n=_createSuper(a);function a(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],o=arguments.length>2?arguments[2]:void 0;return _classCallCheck(this,a),t=n.call(this),a.prototype.__init2.call(_assertThisInitialized(t)),a.prototype.__init3.call(_assertThisInitialized(t)),t.program=e,t.args="string"==typeof r?[r]:r,t.options=Ke(o,(function(){return{}})),t}return _createClass(a,[{key:"__init2",value:function(){this.stdout=new Qe}},{key:"__init3",value:function(){this.stderr=new Qe}},{key:"spawn",value:(r=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",Ye((function(e){switch(e.event){case"Error":t._emit("error",e.payload);break;case"Terminated":t._emit("close",e.payload);break;case"Stdout":t.stdout._emit("data",e.payload);break;case"Stderr":t.stderr._emit("data",e.payload)}}),this.program,this.args,this.options).then((function(e){return new Xe(e)})));case 1:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"execute",value:(t=_asyncToGenerator(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise((function(e,r){t.on("error",r);var n=[],a=[];t.stdout.on("data",(function(e){n.push(e)})),t.stderr.on("data",(function(e){a.push(e)})),t.on("close",(function(t){e({code:t.code,signal:t.signal,stdout:n.join("\n"),stderr:a.join("\n")})})),t.spawn().catch(r)})));case 1:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})}],[{key:"sidecar",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=arguments.length>2?arguments[2]:void 0,n=new a(e,t,r);return n.options.sidecar=!0,n}}]),a}(Qe);function et(){return(et=_asyncToGenerator(regeneratorRuntime.mark((function e(t,r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Shell",message:{cmd:"open",path:t,with:r}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var tt=Object.freeze({__proto__:null,Command:Ze,Child:Xe,open:function(e,t){return et.apply(this,arguments)}});function rt(e){for(var t=void 0,r=e[0],n=1;n1&&void 0!==arguments[1]?arguments[1]:{};return _classCallCheck(this,r),n=t.call(this,e),it([a,"optionalAccess",function(e){return e.skip}])||s({__tauriModule:"Window",message:{cmd:"createWebview",data:{options:_objectSpread({label:e},a)}}}).then(_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://created"));case 1:case"end":return e.stop()}}),e)})))).catch(function(){var e=_asyncToGenerator(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",n.emit("tauri://error",t));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n}return _createClass(r,null,[{key:"getByLabel",value:function(e){return ft().some((function(t){return t.label===e}))?new r(e,{skip:!0}):null}}]),r}(dt),gt=new yt(null,{skip:!0});function _t(){return(_t=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"currentMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function wt(){return(wt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"primaryMonitor"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function vt(){return(vt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Window",message:{cmd:"manage",data:{cmd:{type:"availableMonitors"}}}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var bt=Object.freeze({__proto__:null,WebviewWindow:yt,WebviewWindowHandle:mt,WindowManager:dt,getCurrent:function(){return new yt(window.__TAURI__.__currentWindow.label,{skip:!0})},getAll:ft,appWindow:gt,LogicalSize:st,PhysicalSize:ct,LogicalPosition:pt,PhysicalPosition:lt,get UserAttentionType(){return ut},currentMonitor:function(){return _t.apply(this,arguments)},primaryMonitor:function(){return wt.apply(this,arguments)},availableMonitors:function(){return vt.apply(this,arguments)}}),Rt=me()?"\r\n":"\n";function kt(){return(kt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"platform"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function xt(){return(xt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"version"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Tt(){return(Tt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"osType"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Gt(){return(Gt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"arch"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Pt(){return(Pt=_asyncToGenerator(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",s({__tauriModule:"Os",message:{cmd:"tempdir"}}));case 1:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var Mt=Object.freeze({__proto__:null,EOL:Rt,platform:function(){return kt.apply(this,arguments)},version:function(){return xt.apply(this,arguments)},type:function(){return Tt.apply(this,arguments)},arch:function(){return Gt.apply(this,arguments)},tempdir:function(){return Pt.apply(this,arguments)}}),Ot=o;e.app=h,e.cli=d,e.clipboard=_,e.dialog=x,e.event=L,e.fs=J,e.globalShortcut=ee,e.http=pe,e.invoke=Ot,e.notification=he,e.os=Mt,e.path=qe,e.process=Je,e.shell=tt,e.tauri=u,e.updater=ot,e.window=bt,Object.defineProperty(e,"__esModule",{value:!0})})); diff --git a/core/tauri/scripts/core.js b/core/tauri/scripts/core.js index 8b2633441..4f40ea899 100644 --- a/core/tauri/scripts/core.js +++ b/core/tauri/scripts/core.js @@ -8,7 +8,9 @@ } if (!window.__TAURI__) { - window.__TAURI__ = {} + Object.defineProperty(window, '__TAURI__', { + value: {} + }) } window.__TAURI__.transformCallback = function transformCallback( @@ -33,7 +35,20 @@ return identifier } - window.__TAURI_INVOKE__ = function invoke(cmd, args = {}, key = null) { + const ipcQueue = [] + let isWaitingForIpc = false + + function waitForIpc() { + if ('__TAURI_IPC__' in window) { + for (const action of ipcQueue) { + action() + } + } else { + setTimeout(waitForIpc, 50) + } + } + + window.__TAURI_INVOKE__ = function invoke(cmd, args = {}) { return new Promise(function (resolve, reject) { var callback = window.__TAURI__.transformCallback(function (r) { resolve(r) @@ -52,25 +67,21 @@ return reject(new Error('Invalid argument type.')) } - if ( - document.readyState === 'complete' || - document.readyState === 'interactive' - ) { - window.__TAURI_POST_MESSAGE__(cmd, { + const action = () => { + window.__TAURI_IPC__({ ...args, - callback: callback, - error: error, - __invokeKey: key || __TAURI_INVOKE_KEY__ + callback, + error: error }) + } + if (window.__TAURI_IPC__) { + action() } else { - window.addEventListener('DOMContentLoaded', function () { - window.__TAURI_POST_MESSAGE__(cmd, { - ...args, - callback: callback, - error: error, - __invokeKey: key || __TAURI_INVOKE_KEY__ - }) - }) + ipcQueue.push(action) + if (!isWaitingForIpc) { + waitForIpc() + isWaitingForIpc = true + } } }) } @@ -88,17 +99,13 @@ target.href.startsWith('http') && target.target === '_blank' ) { - window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Shell', - message: { - cmd: 'open', - path: target.href - } - }, - _KEY_VALUE_ - ) + window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Shell', + message: { + cmd: 'open', + path: target.href + } + }) e.preventDefault() } break @@ -129,43 +136,35 @@ document.addEventListener('mousedown', (e) => { if (e.target.hasAttribute('data-tauri-drag-region') && e.buttons === 1) { // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it - window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Window', - message: { - cmd: 'manage', - data: { - cmd: { - type: e.detail === 2 ? '__toggleMaximize' : 'startDragging' - } + window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Window', + message: { + cmd: 'manage', + data: { + cmd: { + type: e.detail === 2 ? '__toggleMaximize' : 'startDragging' } } - }, - _KEY_VALUE_ - ) + } + }) } }) - window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Event', - message: { - cmd: 'listen', - event: 'tauri://window-created', - handler: window.__TAURI__.transformCallback(function (event) { - if (event.payload) { - var windowLabel = event.payload.label - window.__TAURI__.__windows.push({ - label: windowLabel - }) - } - }) - } - }, - _KEY_VALUE_ - ) + window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Event', + message: { + cmd: 'listen', + event: 'tauri://window-created', + handler: window.__TAURI__.transformCallback(function (event) { + if (event.payload) { + var windowLabel = event.payload.label + window.__TAURI__.__windows.push({ + label: windowLabel + }) + } + }) + } + }) let permissionSettable = false let permissionValue = 'default' @@ -174,16 +173,12 @@ if (window.Notification.permission !== 'default') { return Promise.resolve(window.Notification.permission === 'granted') } - return window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Notification', - message: { - cmd: 'isNotificationPermissionGranted' - } - }, - _KEY_VALUE_ - ) + return window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Notification', + message: { + cmd: 'isNotificationPermissionGranted' + } + }) } function setNotificationPermission(value) { @@ -194,16 +189,12 @@ function requestPermission() { return window - .__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Notification', - message: { - cmd: 'requestNotificationPermission' - } - }, - _KEY_VALUE_ - ) + .__TAURI_INVOKE__('tauri', { + __tauriModule: 'Notification', + message: { + cmd: 'requestNotificationPermission' + } + }) .then(function (permission) { setNotificationPermission(permission) return permission @@ -215,20 +206,18 @@ Object.freeze(options) } - return window.__TAURI_INVOKE__( - 'tauri', { - __tauriModule: 'Notification', - message: { - cmd: 'notification', - options: typeof options === 'string' ? - { - title: options - } : - options - } - }, - _KEY_VALUE_ - ) + return window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Notification', + message: { + cmd: 'notification', + options: + typeof options === 'string' + ? { + title: options + } + : options + } + }) } window.Notification = function (title, options) { @@ -264,51 +253,39 @@ }) window.alert = function (message) { - window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Dialog', - message: { - cmd: 'messageDialog', - message: message - } - }, - _KEY_VALUE_ - ) + window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Dialog', + message: { + cmd: 'messageDialog', + message: message + } + }) } window.confirm = function (message) { - return window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Dialog', - message: { - cmd: 'confirmDialog', - message: message - } - }, - _KEY_VALUE_ - ) + return window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Dialog', + message: { + cmd: 'confirmDialog', + message: message + } + }) } // window.print works on Linux/Windows; need to use the API on macOS if (navigator.userAgent.includes('Mac')) { window.print = function () { - return window.__TAURI_INVOKE__( - 'tauri', - { - __tauriModule: 'Window', - message: { - cmd: 'manage', - data: { - cmd: { - type: 'print' - } + return window.__TAURI_INVOKE__('tauri', { + __tauriModule: 'Window', + message: { + cmd: 'manage', + data: { + cmd: { + type: 'print' } } - }, - _KEY_VALUE_ - ) + } + }) } } })() diff --git a/core/tauri/scripts/freeze_prototype.js b/core/tauri/scripts/freeze_prototype.js new file mode 100644 index 000000000..6c17c8e79 --- /dev/null +++ b/core/tauri/scripts/freeze_prototype.js @@ -0,0 +1,5 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +Object.freeze(Object.prototype) diff --git a/core/tauri/scripts/init.js b/core/tauri/scripts/init.js new file mode 100644 index 000000000..e9bfe883a --- /dev/null +++ b/core/tauri/scripts/init.js @@ -0,0 +1,26 @@ +;(function () { + if (window.location.origin.startsWith(__TEMPLATE_origin__)) { + __RAW_freeze_prototype__ + + __RAW_pattern_script__ + + __RAW_ipc_script__ + ;(function () { + __RAW_bundle_script__ + })() + + __RAW_core_script__ + + __RAW_event_initialization_script__ + + if (window.ipc) { + window.__TAURI_INVOKE__('__initialized', { url: window.location.href }) + } else { + window.addEventListener('DOMContentLoaded', function () { + window.__TAURI_INVOKE__('__initialized', { url: window.location.href }) + }) + } + + __RAW_plugin_initialization_script__ + } +})() diff --git a/core/tauri/scripts/ipc.js b/core/tauri/scripts/ipc.js new file mode 100644 index 000000000..c98967a1e --- /dev/null +++ b/core/tauri/scripts/ipc.js @@ -0,0 +1,153 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +/** + * @typedef {{callback: string, error: string, data: *}} IsolationPayload - a valid isolation payload + */ + +; +(function () { + /** + * @type {string} + */ + const pattern = window.__TAURI_PATTERN__.pattern + + /** + * @type {string} + */ + const isolationOrigin = __TEMPLATE_isolation_origin__ + + /** + * @type {{queue: object[], ready: boolean, frame: HTMLElement | null}} + */ + const isolation = Object.create(null) + isolation.queue = [] + isolation.ready = false + isolation.frame = null + + /** + * Detects if a message event is a valid isolation message. + * + * @param {MessageEvent} event - a message event that is expected to be an isolation message + * @return {boolean} - if the event was a valid isolation message + */ + function isIsolationMessage(event) { + return ( + typeof event.data === 'object' && + 'nonce' in event.data && + 'payload' in event.data + ) + } + + /** + * Detects if data is able to transform into an isolation payload. + * + * @param {object} data - object that is expected to contain at least a callback and error identifier + * @return {boolean} - if the data is able to transform into an isolation payload + */ + function isIsolationPayload(data) { + return typeof data === 'object' && 'callback' in data && 'error' in data + } + + /** + * Sends a properly formatted message to the isolation frame. + * + * @param {IsolationPayload} data - data that has been validated to be an isolation payload + */ + function sendIsolationMessage(data) { + // set the frame dom element if it's not been set before + if (!isolation.frame) { + const frame = document.querySelector('iframe#__tauri_isolation__') + if (frame.src.startsWith(isolationOrigin)) { + isolation.frame = frame + } else { + console.error( + 'Tauri IPC found an isolation iframe, but it had the wrong origin' + ) + } + } + + // ensure we have the target to send the message to + if (!isolation.frame || !isolation.frame.contentWindow) { + console.error( + 'Tauri "Isolation" Pattern could not find the Isolation iframe window' + ) + return + } + + isolation.frame.contentWindow.postMessage( + data, + '*' /* todo: set this to the secure origin */ + ) + } + + Object.defineProperty(window, '__TAURI_IPC__', { + // todo: JSDoc this function + value: Object.freeze((message) => { + switch (pattern) { + case 'brownfield': + window.__TAURI_POST_MESSAGE__(message) + break + + case 'isolation': + if (!isIsolationPayload(message)) { + console.error( + 'Tauri "Isolation" Pattern found an invalid isolation message payload', + message + ) + break + } + + if (isolation.ready) { + sendIsolationMessage(message) + } else { + isolation.queue.push(message) + } + + break + + case 'error': + console.error( + 'Tauri IPC found a Tauri Pattern, but it was an error. Check for other log messages to find the cause.' + ) + break + + default: + console.error( + 'Tauri IPC did not find a Tauri Pattern that it understood.' + ) + break + } + }) + }) + + /** + * IMPORTANT: See isolation_secure.js for the isolation frame implementation. + * main frame -> isolation frame = isolation payload + * isolation frame -> main frame = isolation message + */ + if (pattern === 'isolation') { + window.addEventListener( + 'message', + (event) => { + // watch for the isolation frame being ready and flush any queued messages + if (event.data === '__TAURI_ISOLATION_READY__') { + isolation.ready = true + + for (const message of isolation.queue) { + sendIsolationMessage(message) + } + + isolation.queue = [] + return + } + + if (isIsolationMessage(event)) { + window.__TAURI_POST_MESSAGE__(event.data) + } + }, + false + ) + } +})() diff --git a/core/tauri/scripts/isolation.js b/core/tauri/scripts/isolation.js new file mode 100644 index 000000000..7bb0e6df2 --- /dev/null +++ b/core/tauri/scripts/isolation.js @@ -0,0 +1,15 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +window.addEventListener('DOMContentLoaded', () => { + let style = document.createElement('style') + style.textContent = __TEMPLATE_style__ + document.head.append(style) + + let iframe = document.createElement('iframe') + iframe.id = '__tauri_isolation__' + iframe.sandbox.add('allow-scripts') + iframe.src = __TEMPLATE_isolation_src__ + document.body.append(iframe) +}) diff --git a/core/tauri/scripts/pattern.js b/core/tauri/scripts/pattern.js new file mode 100644 index 000000000..dbdea97c2 --- /dev/null +++ b/core/tauri/scripts/pattern.js @@ -0,0 +1,21 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +;(function () { + function __tauriDeepFreeze(object) { + const props = Object.getOwnPropertyNames(object) + + for (const prop of props) { + if (typeof object[name] === 'object') { + __tauriDeepFreeze(object[name]) + } + } + + return Object.freeze(object) + } + + Object.defineProperty(window, '__TAURI_PATTERN__', { + value: __tauriDeepFreeze(__TEMPLATE_pattern__) + }) +})() diff --git a/core/tauri/src/api/dialog.rs b/core/tauri/src/api/dialog.rs index 40582594c..6d347ad9d 100644 --- a/core/tauri/src/api/dialog.rs +++ b/core/tauri/src/api/dialog.rs @@ -47,24 +47,28 @@ impl FileDialogBuilder { } /// Add file extension filter. Takes in the name of the filter, and list of extensions + #[must_use] pub fn add_filter(mut self, name: impl AsRef, extensions: &[&str]) -> Self { self.0 = self.0.add_filter(name.as_ref(), extensions); self } /// Set starting directory of the dialog. + #[must_use] pub fn set_directory>(mut self, directory: P) -> Self { self.0 = self.0.set_directory(directory); self } /// Set starting file name of the dialog. + #[must_use] pub fn set_file_name(mut self, file_name: &str) -> Self { self.0 = self.0.set_file_name(file_name); self } /// Sets the parent window of the dialog. + #[must_use] pub fn set_parent(mut self, parent: &W) -> Self { self.0 = self.0.set_parent(parent); self diff --git a/core/tauri/src/api/http.rs b/core/tauri/src/api/http.rs index fe9315a9c..7c2f012d7 100644 --- a/core/tauri/src/api/http.rs +++ b/core/tauri/src/api/http.rs @@ -29,12 +29,14 @@ impl ClientBuilder { } /// Sets the maximum number of redirections. + #[must_use] pub fn max_redirections(mut self, max_redirections: usize) -> Self { self.max_redirections = Some(max_redirections); self } /// Sets the connection timeout. + #[must_use] pub fn connect_timeout(mut self, connect_timeout: u64) -> Self { self.connect_timeout = Some(connect_timeout); self @@ -294,30 +296,35 @@ impl HttpRequestBuilder { } /// Sets the request parameters. + #[must_use] pub fn query(mut self, query: HashMap) -> Self { self.query = Some(query); self } /// Sets the request headers. + #[must_use] pub fn headers(mut self, headers: HashMap) -> Self { self.headers = Some(headers); self } /// Sets the request body. + #[must_use] pub fn body(mut self, body: Body) -> Self { self.body = Some(body); self } /// Sets the general request timeout. + #[must_use] pub fn timeout(mut self, timeout: u64) -> Self { self.timeout = Some(timeout); self } /// Sets the type of the response. Interferes with the way we read the response. + #[must_use] pub fn response_type(mut self, response_type: ResponseType) -> Self { self.response_type = Some(response_type); self diff --git a/core/tauri/src/api/notification.rs b/core/tauri/src/api/notification.rs index ff333c2d1..e93076988 100644 --- a/core/tauri/src/api/notification.rs +++ b/core/tauri/src/api/notification.rs @@ -43,18 +43,21 @@ impl Notification { } /// Sets the notification body. + #[must_use] pub fn body(mut self, body: impl Into) -> Self { self.body = Some(body.into()); self } /// Sets the notification title. + #[must_use] pub fn title(mut self, title: impl Into) -> Self { self.title = Some(title.into()); self } /// Sets the notification icon. + #[must_use] pub fn icon(mut self, icon: impl Into) -> Self { self.icon = Some(icon.into()); self diff --git a/core/tauri/src/api/path.rs b/core/tauri/src/api/path.rs index 100dfc716..3e6452f2a 100644 --- a/core/tauri/src/api/path.rs +++ b/core/tauri/src/api/path.rs @@ -134,8 +134,7 @@ pub fn parse>( let mut p = PathBuf::new(); let mut components = path.as_ref().components(); if let Some(Component::Normal(str)) = components.next() { - if let Some(base_directory) = BaseDirectory::from_variable(&str.to_string_lossy().into_owned()) - { + if let Some(base_directory) = BaseDirectory::from_variable(&str.to_string_lossy()) { p.push(resolve_path( config, package_info, diff --git a/core/tauri/src/api/process/command.rs b/core/tauri/src/api/process/command.rs index ea9450d55..185d020e5 100644 --- a/core/tauri/src/api/process/command.rs +++ b/core/tauri/src/api/process/command.rs @@ -192,6 +192,7 @@ impl Command { } /// Appends arguments to the command. + #[must_use] pub fn args(mut self, args: I) -> Self where I: IntoIterator, @@ -204,18 +205,21 @@ impl Command { } /// Clears the entire environment map for the child process. + #[must_use] pub fn env_clear(mut self) -> Self { self.env_clear = true; self } /// Adds or updates multiple environment variable mappings. + #[must_use] pub fn envs(mut self, env: HashMap) -> Self { self.env = env; self } /// Sets the working directory for the child process. + #[must_use] pub fn current_dir(mut self, current_dir: PathBuf) -> Self { self.current_dir.replace(current_dir); self diff --git a/core/tauri/src/api/shell.rs b/core/tauri/src/api/shell.rs index 696313ea8..15a1e9d6e 100644 --- a/core/tauri/src/api/shell.rs +++ b/core/tauri/src/api/shell.rs @@ -36,7 +36,6 @@ impl FromStr for Program { type Err = super::Error; fn from_str(s: &str) -> Result { - #[allow(clippy::match_str_case_mismatch)] let p = match s.to_lowercase().as_str() { "open" => Self::Open, "start" => Self::Start, diff --git a/core/tauri/src/app.rs b/core/tauri/src/app.rs index 84430f0ff..94ce169ba 100644 --- a/core/tauri/src/app.rs +++ b/core/tauri/src/app.rs @@ -676,7 +676,7 @@ impl Builder { invoke_handler: Box::new(|_| ()), invoke_responder: Arc::new(window_invoke_responder), invoke_initialization_script: - "Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (command, args) => window.ipc.notify(JSON.stringify({{ ...args, command }})) })".into(), + "Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (message) => window.ipc.postMessage(JSON.stringify(message)) })".into(), on_page_load: Box::new(|_, _| ()), pending_windows: Default::default(), plugins: PluginStore::default(), @@ -693,6 +693,7 @@ impl Builder { } /// Defines the JS message handler callback. + #[must_use] pub fn invoke_handler(mut self, invoke_handler: F) -> Self where F: Fn(Invoke) + Send + Sync + 'static, @@ -706,7 +707,7 @@ impl Builder { /// The `responder` is a function that will be called when a command has been executed and must send a response to the JS layer. /// /// The `initialization_script` is a script that initializes `window.__TAURI_POST_MESSAGE__`. - /// That function must take the `command: string` and `args: object` types and send a message to the backend. + /// That function must take the `message: object` argument and send it to the backend. pub fn invoke_system(mut self, initialization_script: String, responder: F) -> Self where F: Fn(Window, InvokeResponse, CallbackFn, CallbackFn) + Send + Sync + 'static, @@ -717,6 +718,7 @@ impl Builder { } /// Defines the setup hook. + #[must_use] pub fn setup(mut self, setup: F) -> Self where F: FnOnce(&mut App) -> Result<(), Box> + Send + 'static, @@ -726,6 +728,7 @@ impl Builder { } /// Defines the page load hook. + #[must_use] pub fn on_page_load(mut self, on_page_load: F) -> Self where F: Fn(Window, PageLoadPayload) + Send + Sync + 'static, @@ -735,6 +738,7 @@ impl Builder { } /// Adds a plugin to the runtime. + #[must_use] pub fn plugin + 'static>(mut self, plugin: P) -> Self { self.plugins.register(plugin); self @@ -815,6 +819,7 @@ impl Builder { /// .expect("error while running tauri application"); /// } /// ``` + #[must_use] pub fn manage(self, state: T) -> Self where T: Send + Sync + 'static, @@ -829,6 +834,7 @@ impl Builder { } /// Creates a new webview window. + #[must_use] pub fn create_window(mut self, label: impl Into, url: WindowUrl, setup: F) -> Self where F: FnOnce( @@ -854,18 +860,21 @@ impl Builder { /// Adds the icon configured on `tauri.conf.json` to the system tray with the specified menu items. #[cfg(feature = "system-tray")] #[cfg_attr(doc_cfg, doc(cfg(feature = "system-tray")))] + #[must_use] pub fn system_tray(mut self, system_tray: tray::SystemTray) -> Self { self.system_tray.replace(system_tray); self } /// Sets the menu to use on all windows. + #[must_use] pub fn menu(mut self, menu: Menu) -> Self { self.menu.replace(menu); self } /// Registers a menu event handler for all windows. + #[must_use] pub fn on_menu_event) + Send + Sync + 'static>( mut self, handler: F, @@ -875,6 +884,7 @@ impl Builder { } /// Registers a window event handler for all windows. + #[must_use] pub fn on_window_event) + Send + Sync + 'static>( mut self, handler: F, @@ -886,6 +896,7 @@ impl Builder { /// Registers a system tray event handler. #[cfg(feature = "system-tray")] #[cfg_attr(doc_cfg, doc(cfg(feature = "system-tray")))] + #[must_use] pub fn on_system_tray_event< F: Fn(&AppHandle, tray::SystemTrayEvent) + Send + Sync + 'static, >( @@ -905,6 +916,7 @@ impl Builder { /// /// * `uri_scheme` The URI scheme to register, such as `example`. /// * `protocol` the protocol associated with the given URI scheme. It's a function that takes an URL such as `example://localhost/asset.css`. + #[must_use] pub fn register_uri_scheme_protocol< N: Into, H: Fn(&AppHandle, &HttpRequest) -> Result> @@ -1245,16 +1257,16 @@ impl Default for Builder { mod tests { #[test] fn is_send_sync() { - crate::test::assert_send::(); - crate::test::assert_sync::(); + crate::test_utils::assert_send::(); + crate::test_utils::assert_sync::(); #[cfg(feature = "wry")] { - crate::test::assert_send::>(); - crate::test::assert_sync::>(); + crate::test_utils::assert_send::>(); + crate::test_utils::assert_sync::>(); } - crate::test::assert_send::(); - crate::test::assert_sync::(); + crate::test_utils::assert_send::(); + crate::test_utils::assert_sync::(); } } diff --git a/core/tauri/src/async_runtime.rs b/core/tauri/src/async_runtime.rs index 0b5f65416..0ee1e14c3 100644 --- a/core/tauri/src/async_runtime.rs +++ b/core/tauri/src/async_runtime.rs @@ -279,6 +279,7 @@ where runtime.spawn_blocking(func) } +#[allow(dead_code)] pub(crate) fn safe_block_on(task: F) -> F::Output where F: Future + Send + 'static, diff --git a/core/tauri/src/endpoints/cli.rs b/core/tauri/src/endpoints/cli.rs index a008f2961..c720f58f4 100644 --- a/core/tauri/src/endpoints/cli.rs +++ b/core/tauri/src/endpoints/cli.rs @@ -19,7 +19,7 @@ impl Cmd { #[module_command_handler(cli, "CLI definition not set under tauri.conf.json > tauri > cli (https://tauri.studio/docs/api/config#tauri.cli)")] fn cli_matches(context: InvokeContext) -> crate::Result { if let Some(cli) = &context.config.tauri.cli { - crate::api::cli::get_matches(cli, context.package_info) + crate::api::cli::get_matches(cli, &context.package_info) .map(Into::into) .map_err(Into::into) } else { diff --git a/core/tauri/src/endpoints/file_system.rs b/core/tauri/src/endpoints/file_system.rs index 440900d9e..6ed9c0d0e 100644 --- a/core/tauri/src/endpoints/file_system.rs +++ b/core/tauri/src/endpoints/file_system.rs @@ -15,6 +15,7 @@ use serde::{ }; use tauri_macros::{module_command_handler, CommandModule}; +use std::fmt::{Debug, Formatter}; use std::{ fs, fs::File, @@ -334,8 +335,21 @@ fn resolve_path( #[cfg(test)] mod tests { use super::{BaseDirectory, DirOperationOptions, FileOperationOptions, SafePathBuf}; + use quickcheck::{Arbitrary, Gen}; + use std::path::PathBuf; + + impl Arbitrary for super::SafePathBuf { + fn arbitrary(g: &mut Gen) -> Self { + Self(PathBuf::arbitrary(g)) + } + + fn shrink(&self) -> Box> { + Box::new(self.0.shrink().map(SafePathBuf)) + } + } + impl Arbitrary for BaseDirectory { fn arbitrary(g: &mut Gen) -> Self { if bool::arbitrary(g) { @@ -363,12 +377,6 @@ mod tests { } } - impl Arbitrary for SafePathBuf { - fn arbitrary(g: &mut Gen) -> Self { - SafePathBuf(std::path::PathBuf::arbitrary(g)) - } - } - #[tauri_macros::module_command_test(fs_read_file, "fs > readFile")] #[quickcheck_macros::quickcheck] fn read_file(path: SafePathBuf, options: Option) { diff --git a/core/tauri/src/error.rs b/core/tauri/src/error.rs index 7c403258c..b52ffeb66 100644 --- a/core/tauri/src/error.rs +++ b/core/tauri/src/error.rs @@ -96,6 +96,10 @@ pub enum Error { /// Program not allowed by the scope. #[error("program not allowed on the configured shell scope: {0}")] ProgramNotAllowed(PathBuf), + /// An error happened inside the isolation pattern. + #[cfg(feature = "isolation")] + #[error("isolation pattern error: {0}")] + IsolationPattern(#[from] tauri_utils::pattern::isolation::Error), } impl From for Error { diff --git a/core/tauri/src/hooks.rs b/core/tauri/src/hooks.rs index aaf4d8cec..8d7a5c93f 100644 --- a/core/tauri/src/hooks.rs +++ b/core/tauri/src/hooks.rs @@ -10,6 +10,7 @@ use crate::{ }; use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; +use serialize_to_javascript::{default_template, Template}; use std::{future::Future, sync::Arc}; use tauri_macros::default_runtime; @@ -28,6 +29,21 @@ pub type InvokeResponder = /// A closure that is run once every time a window is created and loaded. pub type OnPageLoad = dyn Fn(Window, PageLoadPayload) + Send + Sync + 'static; +// todo: why is this derive broken but the output works manually? +#[derive(Template)] +#[default_template("../scripts/ipc.js")] +pub(crate) struct IpcJavascript<'a> { + pub(crate) isolation_origin: &'a str, +} + +#[cfg(feature = "isolation")] +#[derive(Template)] +#[default_template("../scripts/isolation.js")] +pub(crate) struct IsolationJavascript<'a> { + pub(crate) isolation_src: &'a str, + pub(crate) style: &'a str, +} + /// The payload for the [`OnPageLoad`] hook. #[derive(Debug, Clone, Deserialize)] pub struct PageLoadPayload { @@ -45,7 +61,7 @@ impl PageLoadPayload { #[derive(Debug, Deserialize)] pub struct InvokePayload { /// The invoke command. - pub command: String, + pub cmd: String, #[serde(rename = "__tauriModule")] #[doc(hidden)] pub tauri_module: Option, @@ -53,9 +69,6 @@ pub struct InvokePayload { pub callback: CallbackFn, /// The error callback. pub error: CallbackFn, - /// The invoke key. - #[serde(rename = "__invokeKey")] - pub key: u32, /// The payload of the message. #[serde(flatten)] pub inner: JsonValue, diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 1790d6244..5e4923959 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -11,6 +11,7 @@ //! The following are a list of [Cargo features](https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-features-section) that can be enabled or disabled: //! //! - **wry** *(enabled by default)*: Enables the [wry](https://github.com/tauri-apps/wry) runtime. Only disable it if you want a custom runtime. +//! - **isolation**: Enables the isolation pattern. Enabled by default if the `tauri > pattern > use` config option is set to `isolation` on the `tauri.conf.json` file. //! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one. //! - **updater**: Enables the application auto updater. Enabled by default if the `updater` config is defined on the `tauri.conf.json` file. //! - **http-api**: Enables the [`api::http`] module. @@ -144,6 +145,7 @@ mod error; mod event; mod hooks; mod manager; +mod pattern; pub mod plugin; pub mod window; pub use tauri_runtime as runtime; @@ -255,6 +257,8 @@ macro_rules! tauri_build_context { }; } +pub use pattern::Pattern; + /// User supplied data required inside of a Tauri application. /// /// # Stability @@ -267,6 +271,7 @@ pub struct Context { pub(crate) system_tray_icon: Option, pub(crate) package_info: PackageInfo, pub(crate) _info_plist: (), + pub(crate) pattern: Pattern, } impl fmt::Debug for Context { @@ -276,6 +281,7 @@ impl fmt::Debug for Context { .field("default_window_icon", &self.default_window_icon) .field("system_tray_icon", &self.system_tray_icon) .field("package_info", &self.package_info) + .field("pattern", &self.pattern) .finish() } } @@ -341,6 +347,12 @@ impl Context { &mut self.package_info } + /// The application pattern. + #[inline(always)] + pub fn pattern(&self) -> &Pattern { + &self.pattern + } + /// Create a new [`Context`] from the minimal required items. #[inline(always)] pub fn new( @@ -350,6 +362,7 @@ impl Context { system_tray_icon: Option, package_info: PackageInfo, info_plist: (), + pattern: Pattern, ) -> Self { Self { config, @@ -358,6 +371,7 @@ impl Context { system_tray_icon, package_info, _info_plist: info_plist, + pattern, } } } @@ -503,7 +517,7 @@ pub(crate) mod sealed { pub mod test; #[cfg(test)] -mod tests { +mod test_utils { use proptest::prelude::*; pub fn assert_send() {} diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 94657b5f9..d29a785af 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -2,6 +2,35 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT +use std::{ + borrow::Cow, + collections::{HashMap, HashSet}, + fmt, + fs::create_dir_all, + sync::{Arc, Mutex, MutexGuard}, +}; + +use regex::{Captures, Regex}; +use serde::Serialize; +use serde_json::Value as JsonValue; +use serialize_to_javascript::{default_template, DefaultTemplate, Template}; +use url::Url; + +use tauri_macros::default_runtime; +#[cfg(feature = "isolation")] +use tauri_utils::pattern::isolation::RawIsolationPayload; +use tauri_utils::{ + assets::{AssetKey, CspHash}, + html::{inject_csp, parse as parse_html, SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN}, +}; + +#[cfg(target_os = "windows")] +use crate::api::path::{resolve_path, BaseDirectory}; +use crate::app::{GlobalMenuEventListener, WindowMenuEvent}; +use crate::hooks::IpcJavascript; +#[cfg(feature = "isolation")] +use crate::hooks::IsolationJavascript; +use crate::pattern::{format_real_schema, PatternJavascript}; use crate::{ app::{AppHandle, GlobalWindowEvent, GlobalWindowEventListener}, event::{is_event_name_valid, Event, EventHandler, Listeners}, @@ -21,36 +50,14 @@ use crate::{ config::{AppUrl, Config, WindowUrl}, PackageInfo, }, - Context, Invoke, StateManager, Window, + Context, Invoke, Pattern, StateManager, Window, }; #[cfg(any(target_os = "linux", target_os = "windows"))] use crate::api::path::{resolve_path, BaseDirectory}; -use crate::app::{GlobalMenuEventListener, WindowMenuEvent}; - use crate::{runtime::menu::Menu, MenuEvent}; -use regex::{Captures, Regex}; -use serde::Serialize; -use serde_json::Value as JsonValue; -use std::{ - borrow::Cow, - collections::{HashMap, HashSet}, - fmt, - fs::create_dir_all, - sync::{Arc, Mutex, MutexGuard}, -}; -use tauri_macros::default_runtime; -use tauri_utils::{ - assets::{AssetKey, CspHash}, - html::{ - inject_csp, parse as parse_html, CSP_TOKEN, INVOKE_KEY_TOKEN, SCRIPT_NONCE_TOKEN, - STYLE_NONCE_TOKEN, - }, -}; -use url::Url; - const WINDOW_RESIZED_EVENT: &str = "tauri://resize"; const WINDOW_MOVED_EVENT: &str = "tauri://move"; const WINDOW_CLOSE_REQUESTED_EVENT: &str = "tauri://close-requested"; @@ -67,6 +74,71 @@ struct CspHashStrings { style: String, } +/// Sets the CSP value to the asset HTML if needed (on Linux). +/// Returns the CSP string for access on the response header (on Windows and macOS). +fn set_csp( + asset: &mut String, + assets: Arc, + asset_path: &AssetKey, + #[allow(unused_variables)] manager: &WindowManager, + mut csp: String, +) -> String { + let hash_strings = + assets + .csp_hashes(asset_path) + .fold(CspHashStrings::default(), |mut acc, hash| { + match hash { + CspHash::Script(hash) => { + acc.script.push(' '); + acc.script.push_str(hash); + } + CspHash::Style(hash) => { + acc.style.push(' '); + acc.style.push_str(hash); + } + _csp_hash => { + #[cfg(debug_assertions)] + eprintln!("Unknown CspHash variant encountered: {:?}", _csp_hash) + } + } + + acc + }); + + replace_csp_nonce( + asset, + SCRIPT_NONCE_TOKEN, + &mut csp, + "script-src", + hash_strings.script, + ); + + replace_csp_nonce( + asset, + STYLE_NONCE_TOKEN, + &mut csp, + "style-src", + hash_strings.style, + ); + + #[cfg(feature = "isolation")] + if let Pattern::Isolation { schema, .. } = &manager.inner.pattern { + let default_src = format!("default-src {}", format_real_schema(schema)); + if csp.contains("default-src") { + csp = csp.replace("default-src", &default_src); + } else { + csp.push_str("; "); + csp.push_str(&default_src); + } + } + + #[cfg(target_os = "linux")] + { + *asset = asset.replacen(tauri_utils::html::CSP_TOKEN, &csp, 1); + } + csp +} + fn replace_csp_nonce( asset: &mut String, token: &str, @@ -141,6 +213,8 @@ pub struct InnerWindowManager { invoke_responder: Arc>, /// The script that initializes the invoke system. invoke_initialization_script: String, + /// Application pattern. + pattern: Pattern, } impl fmt::Debug for InnerWindowManager { @@ -152,6 +226,7 @@ impl fmt::Debug for InnerWindowManager { .field("default_window_icon", &self.default_window_icon) .field("package_info", &self.package_info) .field("menu", &self.menu) + .field("pattern", &self.pattern) .finish() } } @@ -181,14 +256,12 @@ pub struct CustomProtocol { #[derive(Debug)] pub struct WindowManager { pub inner: Arc>, - invoke_keys: Arc>>, } impl Clone for WindowManager { fn clone(&self) -> Self { Self { inner: self.inner.clone(), - invoke_keys: self.invoke_keys.clone(), } } } @@ -196,7 +269,7 @@ impl Clone for WindowManager { impl WindowManager { #[allow(clippy::too_many_arguments)] pub(crate) fn with_handlers( - context: Context, + #[allow(unused_mut)] mut context: Context, plugins: PluginStore, invoke_handler: Box>, on_page_load: Box>, @@ -206,6 +279,12 @@ impl WindowManager { (menu, menu_event_listeners): (Option, Vec>), (invoke_responder, invoke_initialization_script): (Arc>, String), ) -> Self { + // generate a random isolation key at runtime + #[cfg(feature = "isolation")] + if let Pattern::Isolation { ref mut key, .. } = &mut context.pattern { + *key = uuid::Uuid::new_v4().to_string(); + } + Self { inner: Arc::new(InnerWindowManager { windows: Mutex::default(), @@ -218,6 +297,7 @@ impl WindowManager { assets: context.assets, default_window_icon: context.default_window_icon, package_info: context.package_info, + pattern: context.pattern, uri_scheme_protocols, menu, menu_event_listeners: Arc::new(menu_event_listeners), @@ -225,10 +305,13 @@ impl WindowManager { invoke_responder, invoke_initialization_script, }), - invoke_keys: Default::default(), } } + pub(crate) fn pattern(&self) -> &Pattern { + &self.inner.pattern + } + /// Get a locked handle to the windows. pub(crate) fn windows_lock(&self) -> MutexGuard<'_, HashMap>> { self.inner.windows.lock().expect("poisoned window manager") @@ -268,10 +351,18 @@ impl WindowManager { } } - fn generate_invoke_key(&self) -> u32 { - let key = rand::random(); - self.invoke_keys.lock().unwrap().push(key); - key + /// Get the origin as it will be seen in the webview. + fn get_browser_origin(&self) -> Cow<'_, str> { + match self.base_path() { + AppUrl::Url(WindowUrl::External(url)) => { + let mut url = url.to_string(); + if url.ends_with('/') { + url.pop(); + } + Cow::Owned(url) + } + _ => Cow::Owned(format_real_schema("tauri")), + } } fn csp(&self) -> Option { @@ -289,13 +380,6 @@ impl WindowManager { } } - /// Checks whether the invoke key is valid or not. - /// - /// An invoke key is valid if it was generated by this manager instance. - pub(crate) fn verify_invoke_key(&self, key: u32) -> bool { - self.invoke_keys.lock().unwrap().contains(&key) - } - fn prepare_pending_window( &self, mut pending: PendingWindow, @@ -311,39 +395,48 @@ impl WindowManager { .expect("poisoned plugin store") .initialization_script(); - let mut webview_attributes = pending.webview_attributes; - webview_attributes = - webview_attributes.initialization_script(&self.inner.invoke_initialization_script); - if is_init_global { - webview_attributes = webview_attributes.initialization_script(&format!( - "(function () {{ - const __TAURI_INVOKE_KEY__ = {key}; - {bundle_script} - }})()", - key = self.generate_invoke_key(), - bundle_script = include_str!("../scripts/bundle.js"), - )); + let pattern_init = PatternJavascript { + pattern: self.pattern().into(), } + .render_default(&Default::default())?; + + let ipc_init = IpcJavascript { + isolation_origin: &match self.pattern() { + #[cfg(feature = "isolation")] + Pattern::Isolation { schema, .. } => crate::pattern::format_real_schema(schema), + _ => "".to_string(), + }, + } + .render_default(&Default::default())?; + + let mut webview_attributes = pending.webview_attributes; + webview_attributes = webview_attributes + .initialization_script(&self.inner.invoke_initialization_script) + .initialization_script(&self.initialization_script(&ipc_init,&pattern_init,&plugin_init, is_init_global)?) .initialization_script(&format!( r#" if (!window.__TAURI__) {{ - window.__TAURI__ = {{}} + Object.defineProperty(window, '__TAURI__', {{ + value: {{}} + }}) }} window.__TAURI__.__windows = {window_labels_array}.map(function (label) {{ return {{ label: label }} }}); window.__TAURI__.__currentWindow = {{ label: {current_window_label} }} "#, window_labels_array = serde_json::to_string(pending_labels)?, current_window_label = serde_json::to_string(&label)?, - )) - .initialization_script(&self.initialization_script(&plugin_init)); - - #[cfg(dev)] - { - webview_attributes = webview_attributes.initialization_script(&format!( - "window.__TAURI_INVOKE_KEY__ = {}", - self.generate_invoke_key() )); + + #[cfg(feature = "isolation")] + if let Pattern::Isolation { schema, .. } = self.pattern() { + webview_attributes = webview_attributes.initialization_script( + &IsolationJavascript { + isolation_src: &crate::pattern::format_real_schema(schema), + style: tauri_utils::pattern::isolation::IFRAME_STYLE, + } + .render_default(&Default::default())?, + ); } pending.webview_attributes = webview_attributes; @@ -492,14 +585,76 @@ impl WindowManager { }); } + #[cfg(feature = "isolation")] + if let Pattern::Isolation { + assets, + schema, + key: _, + crypto_keys, + } = &self.inner.pattern + { + let assets = assets.clone(); + let schema_ = schema.clone(); + let url_base = format!("{}://localhost", schema_); + let aes_gcm_key = *crypto_keys.aes_gcm().raw(); + + pending.register_uri_scheme_protocol(schema, move |request| { + match request_to_path(request, &url_base).as_str() { + "index.html" => match assets.get(&"index.html".into()) { + Some(asset) => { + let asset = String::from_utf8_lossy(asset.as_ref()); + let template = tauri_utils::pattern::isolation::IsolationJavascriptRuntime { + runtime_aes_gcm_key: &aes_gcm_key, + }; + match template.render(asset.as_ref(), &Default::default()) { + Ok(asset) => HttpResponseBuilder::new() + .mimetype("text/html") + .body(asset.as_bytes().to_vec()), + Err(_) => HttpResponseBuilder::new() + .status(500) + .mimetype("text/plain") + .body(Vec::new()), + } + } + + None => HttpResponseBuilder::new() + .status(404) + .mimetype("text/plain") + .body(Vec::new()), + }, + _ => HttpResponseBuilder::new() + .status(404) + .mimetype("text/plain") + .body(Vec::new()), + } + }); + } + Ok(pending) } fn prepare_ipc_handler(&self, app_handle: AppHandle) -> WebviewIpcHandler { let manager = self.clone(); - Box::new(move |window, request| { + Box::new(move |window, #[allow(unused_mut)] mut request| { let window = Window::new(manager.clone(), window, app_handle.clone()); + #[cfg(feature = "isolation")] + if let Pattern::Isolation { crypto_keys, .. } = manager.pattern() { + match RawIsolationPayload::try_from(request.as_str()) + .and_then(|raw| crypto_keys.decrypt(raw)) + { + Ok(json) => request = json, + Err(e) => { + let error: crate::Error = e.into(); + let _ = window.eval(&format!( + r#"console.error({})"#, + JsonValue::String(error.to_string()) + )); + return; + } + } + } + match serde_json::from_str::(&request) { Ok(message) => { let _ = window.on_message(message); @@ -530,7 +685,6 @@ impl WindowManager { // skip leading `/` path.chars().skip(1).collect::() }; - let is_javascript = path.ends_with(".js") || path.ends_with(".cjs") || path.ends_with(".mjs"); let is_html = path.ends_with(".html"); let mut asset_path = AssetKey::from(path.as_str()); @@ -558,48 +712,16 @@ impl WindowManager { match asset_response { Ok(asset) => { - let final_data = if is_javascript || is_html { + let final_data = if is_html { let mut asset = String::from_utf8_lossy(&asset).into_owned(); - asset = asset.replacen(INVOKE_KEY_TOKEN, &self.generate_invoke_key().to_string(), 1); - - if is_html { - if let Some(mut csp) = self.csp() { - let hash_strings = self.inner.assets.csp_hashes(&asset_path).fold( - CspHashStrings::default(), - |mut acc, hash| { - match hash { - CspHash::Script(hash) => { - acc.script.push(' '); - acc.script.push_str(hash); - } - csp_hash => { - #[cfg(debug_assertions)] - eprintln!("Unknown CspHash variant encountered: {:?}", csp_hash) - } - } - - acc - }, - ); - - replace_csp_nonce( - &mut asset, - SCRIPT_NONCE_TOKEN, - &mut csp, - "script-src", - hash_strings.script, - ); - replace_csp_nonce( - &mut asset, - STYLE_NONCE_TOKEN, - &mut csp, - "style-src", - hash_strings.style, - ); - - asset = asset.replace(CSP_TOKEN, &csp); - csp_header.replace(csp); - } + if let Some(csp) = self.csp() { + csp_header.replace(set_csp( + &mut asset, + self.inner.assets.clone(), + &asset_path, + &self, + csp, + )); } asset.as_bytes().to_vec() @@ -659,26 +781,57 @@ impl WindowManager { }) } - fn initialization_script(&self, plugin_initialization_script: &str) -> String { - let key = self.generate_invoke_key(); - format!( - r#" - {core_script} - {event_initialization_script} - if (document.readyState === 'complete') {{ - window.__TAURI_INVOKE__("__initialized", {{ url: window.location.href }}, {key}) - }} else {{ - window.addEventListener('DOMContentLoaded', function () {{ - window.__TAURI_INVOKE__("__initialized", {{ url: window.location.href }}, {key}) - }}) - }} - {plugin_initialization_script} - "#, - key = key, - core_script = include_str!("../scripts/core.js").replace("_KEY_VALUE_", &key.to_string()), - event_initialization_script = self.event_initialization_script(), - plugin_initialization_script = plugin_initialization_script - ) + fn initialization_script( + &self, + ipc_script: &str, + pattern_script: &str, + plugin_initialization_script: &str, + with_global_tauri: bool, + ) -> crate::Result { + #[derive(Template)] + #[default_template("../scripts/init.js")] + struct InitJavascript<'a> { + origin: Cow<'a, str>, + #[raw] + pattern_script: &'a str, + #[raw] + ipc_script: &'a str, + #[raw] + bundle_script: &'a str, + #[raw] + core_script: &'a str, + #[raw] + event_initialization_script: &'a str, + #[raw] + plugin_initialization_script: &'a str, + #[raw] + freeze_prototype: &'a str, + } + + let bundle_script = if with_global_tauri { + include_str!("../scripts/bundle.js") + } else { + "" + }; + + let freeze_prototype = if self.inner.config.tauri.security.freeze_prototype { + include_str!("../scripts/freeze_prototype.js") + } else { + "" + }; + + InitJavascript { + origin: self.get_browser_origin(), + pattern_script, + ipc_script, + bundle_script, + core_script: include_str!("../scripts/core.js"), + event_initialization_script: &self.event_initialization_script(), + plugin_initialization_script, + freeze_prototype, + } + .render_default(&Default::default()) + .map_err(Into::into) } fn event_initialization_script(&self) -> String { @@ -702,9 +855,10 @@ impl WindowManager { #[cfg(test)] mod test { - use super::WindowManager; use crate::{generate_context, plugin::PluginStore, StateManager, Wry}; + use super::WindowManager; + #[test] fn check_get_url() { let context = generate_context!("test/fixture/src-tauri/tauri.conf.json", crate); @@ -1029,3 +1183,31 @@ struct ScaleFactorChanged { fn on_menu_event(window: &Window, event: &MenuEvent) -> crate::Result<()> { window.emit_and_trigger(MENU_EVENT, event.menu_item_id.clone()) } + +#[cfg(feature = "isolation")] +fn request_to_path(request: &tauri_runtime::http::Request, replace: &str) -> String { + let mut path = request + .uri() + .split(&['?', '#'][..]) + // ignore query string + .next() + .unwrap() + .to_string() + .replace(replace, ""); + + if path.ends_with('/') { + path.pop(); + } + + let path = percent_encoding::percent_decode(path.as_bytes()) + .decode_utf8_lossy() + .to_string(); + + if path.is_empty() { + // if the url has no path, we should load `index.html` + "index.html".to_string() + } else { + // skip leading `/` + path.chars().skip(1).collect() + } +} diff --git a/core/tauri/src/pattern.rs b/core/tauri/src/pattern.rs new file mode 100644 index 000000000..19b371303 --- /dev/null +++ b/core/tauri/src/pattern.rs @@ -0,0 +1,94 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use std::marker::PhantomData; +#[cfg(feature = "isolation")] +use std::sync::Arc; + +use serde::Serialize; +use serialize_to_javascript::{default_template, Template}; + +use tauri_utils::assets::{Assets, EmbeddedAssets}; + +/// An application pattern. +#[derive(Debug, Clone)] +pub enum Pattern { + /// The brownfield pattern. + Brownfield(PhantomData), + /// Isolation pattern. Recommended for security purposes. + #[cfg(feature = "isolation")] + Isolation { + /// The HTML served on `isolation://index.html`. + assets: Arc, + + /// The schema used for the isolation frames. + schema: String, + + /// A random string used to ensure that the message went through the isolation frame. + /// + /// This should be regenerated at runtime. + key: String, + + /// Cryptographically secure keys + crypto_keys: Box, + }, +} + +/// The shape of the JavaScript Pattern config +#[derive(Debug, Serialize)] +#[serde(rename_all = "lowercase", tag = "pattern")] +pub(crate) enum PatternObject { + /// Brownfield pattern. + Brownfield, + /// Isolation pattern. Recommended for security purposes. + #[cfg(feature = "isolation")] + Isolation { + /// Which `IsolationSide` this `PatternObject` is getting injected into + side: IsolationSide, + }, +} + +impl From<&Pattern> for PatternObject { + fn from(pattern: &Pattern) -> Self { + match pattern { + Pattern::Brownfield(_) => Self::Brownfield, + #[cfg(feature = "isolation")] + Pattern::Isolation { .. } => Self::Isolation { + side: IsolationSide::default(), + }, + } + } +} + +/// Where the JavaScript is injected to +#[derive(Debug, Serialize)] +#[serde(rename_all = "lowercase")] +pub(crate) enum IsolationSide { + /// Original frame, the Brownfield application + Original, + /// Secure frame, the isolation security application + #[allow(dead_code)] + Secure, +} + +impl Default for IsolationSide { + fn default() -> Self { + Self::Original + } +} + +#[derive(Template)] +#[default_template("../scripts/pattern.js")] +pub(crate) struct PatternJavascript { + pub(crate) pattern: PatternObject, +} + +#[allow(dead_code)] +pub(crate) fn format_real_schema(schema: &str) -> String { + if cfg!(windows) { + format!("https://{}.localhost", schema) + } else { + format!("{}://localhost", schema) + } +} diff --git a/core/tauri/src/test/mock_runtime.rs b/core/tauri/src/test/mock_runtime.rs index 29c8d250b..ef1cd62db 100644 --- a/core/tauri/src/test/mock_runtime.rs +++ b/core/tauri/src/test/mock_runtime.rs @@ -12,14 +12,17 @@ use tauri_runtime::{ dpi::{PhysicalPosition, PhysicalSize, Position, Size}, DetachedWindow, MenuEvent, PendingWindow, WindowEvent, }, - ActivationPolicy, ClipboardManager, Dispatch, GlobalShortcutManager, Icon, Result, RunEvent, - RunIteration, Runtime, RuntimeHandle, UserAttentionType, + ClipboardManager, Dispatch, GlobalShortcutManager, Icon, Result, RunEvent, Runtime, + RuntimeHandle, UserAttentionType, }; #[cfg(feature = "system-tray")] use tauri_runtime::{SystemTray, SystemTrayEvent}; use tauri_utils::config::WindowConfig; use uuid::Uuid; +#[cfg(windows)] +use webview2_com::Windows::Win32::Foundation::HWND; + use std::{ collections::HashMap, fmt, @@ -60,6 +63,7 @@ impl RuntimeHandle for MockRuntimeHandle { context: self.context.clone(), }, menu_ids: Default::default(), + js_event_listeners: Default::default(), }) } @@ -534,6 +538,7 @@ impl Runtime for MockRuntime { context: self.context.clone(), }, menu_ids: Default::default(), + js_event_listeners: Default::default(), }) } @@ -551,10 +556,13 @@ impl Runtime for MockRuntime { #[cfg(target_os = "macos")] #[cfg_attr(doc_cfg, doc(cfg(target_os = "macos")))] - fn set_activation_policy(&mut self, activation_policy: ActivationPolicy) {} + fn set_activation_policy(&mut self, activation_policy: tauri_runtime::ActivationPolicy) {} #[cfg(any(target_os = "windows", target_os = "macos"))] - fn run_iteration(&mut self, callback: F) -> RunIteration { + fn run_iteration( + &mut self, + callback: F, + ) -> tauri_runtime::RunIteration { Default::default() } diff --git a/core/tauri/src/test/mod.rs b/core/tauri/src/test/mod.rs index b53fba0c4..49e81a500 100644 --- a/core/tauri/src/test/mod.rs +++ b/core/tauri/src/test/mod.rs @@ -9,10 +9,10 @@ pub use mock_runtime::*; use std::{borrow::Cow, sync::Arc}; -use crate::Manager; +use crate::{Manager, Pattern}; use tauri_utils::{ assets::{AssetKey, Assets, CspHash}, - config::{CliConfig, Config, TauriConfig}, + config::{CliConfig, Config, PatternKind, TauriConfig}, }; pub struct NoopAsset { @@ -40,6 +40,7 @@ pub fn mock_context(assets: A) -> crate::Context { config: Config { package: Default::default(), tauri: TauriConfig { + pattern: PatternKind::Brownfield, windows: vec![Default::default()], cli: Some(CliConfig { description: None, @@ -65,8 +66,11 @@ pub fn mock_context(assets: A) -> crate::Context { package_info: crate::PackageInfo { name: "test".into(), version: "0.1.0".into(), + authors: "Tauri".into(), + description: "Tauri test".into(), }, _info_plist: (), + pattern: Pattern::Brownfield(std::marker::PhantomData), } } diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index dbaab9d21..69c7da8ef 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -11,8 +11,7 @@ use crate::api::{ use base64::decode; use http::StatusCode; use minisign_verify::{PublicKey, Signature}; -use tauri_utils::platform::current_exe; -use tauri_utils::Env; +use tauri_utils::{platform::current_exe, Env}; use std::{ collections::HashMap, @@ -552,7 +551,7 @@ fn copy_files_and_run( let mut extractor = Extract::from_cursor(archive_buffer, ArchiveFormat::Zip); // extract the msi - extractor.extract_into(&tmp_dir); + extractor.extract_into(&tmp_dir)?; let paths = read_dir(&tmp_dir)?; // This consumes the TempDir without deleting directory on the filesystem, @@ -648,7 +647,7 @@ fn copy_files_and_run(archive_buffer: R, extract_path: &Path) -> .tempdir()?; // create backup of our current app - Move::from_source(extract_path).to_dest(&tmp_dir.path())?; + Move::from_source(extract_path).to_dest(tmp_dir.path())?; // extract all the files for file in all_files { @@ -666,7 +665,7 @@ fn copy_files_and_run(archive_buffer: R, extract_path: &Path) -> std::fs::remove_file(file)?; } } - Move::from_source(&tmp_dir.path()).to_dest(extract_path)?; + Move::from_source(tmp_dir.path()).to_dest(extract_path)?; return Err(Error::Extract(err.to_string())); } @@ -776,7 +775,7 @@ where mod test { use super::*; #[cfg(target_os = "macos")] - use std::{env, fs::File}; + use std::fs::File; macro_rules! block { ($e:expr) => { diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 8ec4074b7..328fec7bd 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -226,7 +226,7 @@ impl Window { /// How to handle this window receiving an [`InvokeMessage`]. pub fn on_message(self, payload: InvokePayload) -> crate::Result<()> { let manager = self.manager.clone(); - match payload.command.as_str() { + match payload.cmd.as_str() { "__initialized" => { let payload: PageLoadPayload = serde_json::from_value(payload.inner)?; manager.run_on_page_load(self, payload); @@ -235,25 +235,19 @@ impl Window { let message = InvokeMessage::new( self.clone(), manager.state(), - payload.command.to_string(), + payload.cmd.to_string(), payload.inner, ); let resolver = InvokeResolver::new(self, payload.callback, payload.error); + let invoke = Invoke { message, resolver }; - if manager.verify_invoke_key(payload.key) { - if let Some(module) = &payload.tauri_module { - let module = module.to_string(); - crate::endpoints::handle(module, invoke, manager.config(), manager.package_info()); - } else if payload.command.starts_with("plugin:") { - manager.extend_api(invoke); - } else { - manager.run_invoke_handler(invoke); - } + if let Some(module) = &payload.tauri_module { + let module = module.to_string(); + crate::endpoints::handle(module, invoke, manager.config(), manager.package_info()); + } else if payload.cmd.starts_with("plugin:") { + manager.extend_api(invoke); } else { - panic!( - r#"The invoke key "{}" is invalid. This means that an external, possible malicious script is trying to access the system interface."#, - payload.key - ); + manager.run_invoke_handler(invoke); } } } @@ -718,7 +712,7 @@ impl Window { mod tests { #[test] fn window_is_send_sync() { - crate::test::assert_send::(); - crate::test::assert_sync::(); + crate::test_utils::assert_send::(); + crate::test_utils::assert_sync::(); } } diff --git a/core/tauri/tests/restart.rs b/core/tauri/tests/restart.rs index a11410c78..5e9d60738 100644 --- a/core/tauri/tests/restart.rs +++ b/core/tauri/tests/restart.rs @@ -107,7 +107,7 @@ fn create_symlink(original: &Path, link: PathBuf) -> io::Result { Ok(()) => Ok(Symlink::Created(link)), Err(e) => match e.raw_os_error() { Some(ERROR_PRIVILEGE_NOT_HELD) => Ok(Symlink::Privilege), - _ => Err(e.into()), + _ => Err(e), }, }; } diff --git a/core/tauri/tests/restart/Cargo.lock b/core/tauri/tests/restart/Cargo.lock index b505a44f5..259c754ff 100644 --- a/core/tauri/tests/restart/Cargo.lock +++ b/core/tauri/tests/restart/Cargo.lock @@ -34,9 +34,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.44" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61604a8f862e1d5c3229fdd78f8b02c68dcf73a4c4b05fd636d12240aaa242c1" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" [[package]] name = "arrayref" @@ -103,9 +103,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "blake3" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2607a74355ce2e252d0c483b2d8a348e1bba36036e786ccc2dcd777213c86ffd" +checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413" dependencies = [ "arrayref", "arrayvec", @@ -199,9 +199,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79c2681d6594606957bbb8631c4b90a7fcaaa72cdb714743a437b156d6a7eedd" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" dependencies = [ "jobserver", ] @@ -252,18 +252,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" -[[package]] -name = "chrono" -version = "0.4.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" -dependencies = [ - "libc", - "num-integer", - "num-traits", - "winapi", -] - [[package]] name = "cocoa" version = "0.24.0" @@ -295,12 +283,6 @@ dependencies = [ "objc", ] -[[package]] -name = "const-sha1" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d" - [[package]] name = "constant_time_eq" version = "0.1.5" @@ -406,9 +388,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81156fece84ab6a9f2afdb109ce3ae577e42b1228441eded99bd77f627953b1a" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" dependencies = [ "cfg-if 1.0.0", ] @@ -465,7 +447,7 @@ checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" dependencies = [ "cssparser-macros", "dtoa-short", - "itoa", + "itoa 0.4.8", "matches", "phf 0.8.0", "proc-macro2", @@ -484,6 +466,12 @@ dependencies = [ "syn", ] +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + [[package]] name = "darling" version = "0.10.2" @@ -496,12 +484,12 @@ dependencies = [ [[package]] name = "darling" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "757c0ded2af11d8e739c4daea1ac623dd1624b06c844cf3f5a39f1bdbd99bb12" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" dependencies = [ - "darling_core 0.13.0", - "darling_macro 0.13.0", + "darling_core 0.13.1", + "darling_macro 0.13.1", ] [[package]] @@ -520,9 +508,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c34d8efb62d0c2d7f60ece80f75e5c63c1588ba68032740494b0b9a996466e3" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" dependencies = [ "fnv", "ident_case", @@ -545,20 +533,20 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" dependencies = [ - "darling_core 0.13.0", + "darling_core 0.13.1", "quote", "syn", ] [[package]] name = "data-url" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33fe99ccedd6e84bc035f1931bb2e6be79739d6242bd895e7311c886c50dc9c" +checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" dependencies = [ "matches", ] @@ -596,14 +584,14 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.16" +version = "0.99.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eebddd2156ce1bb37b20bbe5151340a31828b1f2d22ba4141f3531710e38df" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version", + "rustc_version 0.4.0", "syn", ] @@ -672,9 +660,9 @@ checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99" [[package]] name = "fastrand" -version = "1.5.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b394ed3d285a429378d3b384b9eb1285267e7df4b166df24b7a6939a04dc392e" +checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" dependencies = [ "instant", ] @@ -686,7 +674,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" dependencies = [ "memoffset", - "rustc_version", + "rustc_version 0.3.3", ] [[package]] @@ -756,9 +744,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12aa0eb539080d55c3f2d45a67c3b58b6b0773c1a3ca2dfec66d58c97fd66ca" +checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" dependencies = [ "futures-channel", "futures-core", @@ -771,9 +759,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5da6ba8c3bb3c165d3c7319fc1cc8304facf1fb8db99c5de877183c08a273888" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" dependencies = [ "futures-core", "futures-sink", @@ -781,15 +769,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d1c26957f23603395cd326b0ffe64124b818f4449552f960d815cfba83a53d" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" [[package]] name = "futures-executor" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45025be030969d763025784f7f355043dc6bc74093e4ecc5000ca4dc50d8745c" +checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" dependencies = [ "futures-core", "futures-task", @@ -798,9 +786,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "522de2a0fe3e380f1bc577ba0474108faf3f6b18321dbf60b3b9c39a75073377" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" [[package]] name = "futures-lite" @@ -819,12 +807,10 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18e4a4b95cea4b4ccbcf1c5675ca7c4ee4e9e75eb79944d07defde18068f79bb" +checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" dependencies = [ - "autocfg", - "proc-macro-hack", "proc-macro2", "quote", "syn", @@ -832,23 +818,22 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36ea153c13024fe480590b3e3d4cad89a0cfacecc24577b68f86c6ced9c2bc11" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" [[package]] name = "futures-task" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d3d00f4eddb73e498a54394f228cd55853bdf059259e8e7bc6e69d408892e99" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" [[package]] name = "futures-util" -version = "0.3.17" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36568465210a3a6ee45e1f165136d68671471a501e632e9a98d96872222b5481" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" dependencies = [ - "autocfg", "futures-channel", "futures-core", "futures-io", @@ -858,8 +843,6 @@ dependencies = [ "memchr", "pin-project-lite", "pin-utils", - "proc-macro-hack", - "proc-macro-nested", "slab", ] @@ -1209,7 +1192,7 @@ checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" dependencies = [ "bytes", "fnv", - "itoa", + "itoa 0.4.8", ] [[package]] @@ -1292,9 +1275,9 @@ dependencies = [ [[package]] name = "itertools" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" dependencies = [ "either", ] @@ -1306,10 +1289,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" [[package]] -name = "javascriptcore-rs" -version = "0.15.1" +name = "itoa" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9644bfae308588f4e57616bd8402b982dbcd68d1934c0848e2869ffcc03b562" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[package]] +name = "javascriptcore-rs" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e207780c1d1cd3c36056695e44010a19dd481574a2106cd2540edda4128a9794" dependencies = [ "bitflags", "glib", @@ -1318,9 +1307,9 @@ dependencies = [ [[package]] name = "javascriptcore-rs-sys" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4f53f580ab519a92d142d6dbcff5fd59b8e9634f965bdeb892383d787165e" +checksum = "2adf2de824b178d76c6017da59f4e7e95de49a766b584c59d47821a6c3dce9e2" dependencies = [ "glib-sys 0.14.0", "gobject-sys 0.14.0", @@ -1363,9 +1352,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.106" +version = "0.2.112" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a60553f9a9e039a333b4e9b20573b9e9b9c0bb3a11e201ccc48ef4283456d673" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" [[package]] name = "lock_api" @@ -1387,9 +1376,9 @@ dependencies = [ [[package]] name = "loom" -version = "0.5.2" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b9df80a3804094bf49bb29881d18f6f05048db72127e84e09c26fc7c2324f5" +checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309" dependencies = [ "cfg-if 1.0.0", "generator", @@ -1431,9 +1420,9 @@ dependencies = [ [[package]] name = "matchers" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ "regex-automata", ] @@ -1452,9 +1441,9 @@ checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memoffset" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59accc507f1338036a0477ef61afdae33cde60840f4dfe481319ce3ad116ddf9" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" dependencies = [ "autocfg", ] @@ -1520,9 +1509,9 @@ dependencies = [ [[package]] name = "ndk-sys" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" [[package]] name = "new_debug_unreachable" @@ -1568,9 +1557,9 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" dependencies = [ "hermit-abi", "libc", @@ -1578,9 +1567,9 @@ dependencies = [ [[package]] name = "num_enum" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f" +checksum = "085fe377a4b2805c0fbc09484415ec261174614b7f080b0e0d520456ac421a67" dependencies = [ "derivative", "num_enum_derive", @@ -1588,9 +1577,9 @@ dependencies = [ [[package]] name = "num_enum_derive" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9" +checksum = "5249369707a1e07b39f78d98c8f34e00aca7dcb053812fdbb5ad7be82c1bba38" dependencies = [ "proc-macro-crate 1.1.0", "proc-macro2", @@ -1628,9 +1617,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" [[package]] name = "opaque-debug" @@ -1722,9 +1711,9 @@ dependencies = [ [[package]] name = "phf" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fc3db1018c4b59d7d582a739436478b6035138b6aecbce989fc91c3e98409f" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" dependencies = [ "phf_macros 0.10.0", "phf_shared 0.10.0", @@ -1821,9 +1810,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12295df4f294471248581bc09bef3c38a5e46f1e36d6a37353621a0c6c357e1f" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" [[package]] name = "png" @@ -1910,17 +1899,11 @@ version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" -[[package]] -name = "proc-macro-nested" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" - [[package]] name = "proc-macro2" -version = "1.0.32" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43" +checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" dependencies = [ "unicode-xid", ] @@ -2027,11 +2010,21 @@ dependencies = [ [[package]] name = "raw-window-handle" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a441a7a6c80ad6473bd4b74ec1c9a4c951794285bf941c2126f607c72e48211" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" dependencies = [ "libc", + "raw-window-handle 0.4.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba75eee94a9d5273a68c9e1e105d9cffe1ef700532325788389e5a83e2522b7" +dependencies = [ + "cty", ] [[package]] @@ -2130,16 +2123,25 @@ dependencies = [ ] [[package]] -name = "rustversion" -version = "1.0.5" +name = "rustc_version" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.4", +] + +[[package]] +name = "rustversion" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" [[package]] name = "ryu" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71d301d4193d031abdd79ff7e3dd721168a9572ef3fe51a1517aba235bd8f86e" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" [[package]] name = "same-file" @@ -2208,18 +2210,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.130" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12d06de37cf59146fbdecab66aa99f9fe4f78722e3607577a5375d66bd0c913" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.130" +version = "1.0.132" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7bc1a1ab1961464eae040d96713baa5a724a8152c1222492465b54322ec508b" +checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" dependencies = [ "proc-macro2", "quote", @@ -2228,11 +2230,11 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.68" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f690853975602e1bfe1ccbf50504d67174e3bcf340f23b5ea9992e0587a52d8" +checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" dependencies = [ - "itoa", + "itoa 1.0.1", "ryu", "serde", ] @@ -2265,7 +2267,27 @@ version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" dependencies = [ - "darling 0.13.0", + "darling 0.13.1", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ "proc-macro2", "quote", "syn", @@ -2427,9 +2449,9 @@ dependencies = [ [[package]] name = "syn" -version = "1.0.81" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2afee18b8beb5a596ecb4a2dce128c719b4ba399d34126b9e4396e3f9860966" +checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" dependencies = [ "proc-macro2", "quote", @@ -2485,7 +2507,7 @@ dependencies = [ [[package]] name = "tao" version = "0.5.2" -source = "git+https://github.com/tauri-apps/tao?branch=next#97cd0497ae827903f7d67aa1c991a77a397c9cb8" +source = "git+https://github.com/tauri-apps/tao?branch=next#9f699a345788fbb08bc483a3f335ca4a94339676" dependencies = [ "bitflags", "cairo-rs", @@ -2512,20 +2534,19 @@ dependencies = [ "ndk-sys", "objc", "parking_lot", - "raw-window-handle", + "raw-window-handle 0.3.4", "scopeguard", "serde", "unicode-segmentation", - "webview2-com-sys", "windows", "x11-dl", ] [[package]] name = "tar" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6f5515d3add52e0bbdcad7b83c388bb36ba7b754dda3b5f5bc2d38640cdba5c" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" dependencies = [ "filetime", "libc", @@ -2553,12 +2574,13 @@ dependencies = [ "once_cell", "percent-encoding", "rand 0.8.4", - "raw-window-handle", + "raw-window-handle 0.3.4", "regex", "semver 1.0.4", "serde", "serde_json", "serde_repr", + "serialize-to-javascript", "state", "tar", "tauri-macros", @@ -2587,6 +2609,7 @@ dependencies = [ "sha2", "tauri-utils", "thiserror", + "uuid", "walkdir", "zstd", ] @@ -2615,7 +2638,7 @@ dependencies = [ "tauri-utils", "thiserror", "uuid", - "webview2-com-sys", + "webview2-com", ] [[package]] @@ -2630,6 +2653,7 @@ dependencies = [ "tauri-utils", "uuid", "webview2-com", + "windows", "wry", ] @@ -2637,15 +2661,18 @@ dependencies = [ name = "tauri-utils" version = "1.0.0-beta.3" dependencies = [ + "base64", "heck", "html5ever", "kuchiki", - "phf 0.10.0", + "phf 0.10.1", "proc-macro2", "quote", "serde", "serde_json", "serde_with", + "serialize-to-javascript", + "sha2", "thiserror", "url", "zstd", @@ -2723,9 +2750,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f83b2a3d4d9091d0abd7eba4dc2710b1718583bd4d8992e2190720ea38f391f7" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" dependencies = [ "tinyvec_macros", ] @@ -2738,11 +2765,10 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.13.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "588b2d10a336da58d877567cd8fb8a14b463e2104910f8132cd054b4b96e29ee" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ - "autocfg", "bytes", "memchr", "num_cpus", @@ -2801,36 +2827,22 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" -version = "0.2.25" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3" dependencies = [ "ansi_term", - "chrono", "lazy_static", "matchers", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] [[package]] @@ -2949,9 +2961,9 @@ checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" [[package]] name = "webkit2gtk" -version = "0.15.2" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca90927b3d0625c84c7de59b70174cc6384237d0599f2b8e510a7ee10509d1d" +checksum = "d5725e8ede878b7c00419066868085b83fb7d01eea904c1a0bd0159ad3ce0ba3" dependencies = [ "bitflags", "cairo-rs", @@ -2972,9 +2984,9 @@ dependencies = [ [[package]] name = "webkit2gtk-sys" -version = "0.15.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0e5e08218be3884e56aff0aedcb9e222b311be53214eb6019200caf9b52815" +checksum = "b34314407e381b88a72610d0f4eeff1552cbf8ee5420dbe84749fa26aa11b4e3" dependencies = [ "atk-sys", "bitflags", @@ -2995,9 +3007,9 @@ dependencies = [ [[package]] name = "webview2-com" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2294dee38668da0d71019097dddc6cef525fde7aa4784243dd83f0752e08aa5" +checksum = "abdc9ca7cebd96a1005d5ba1e9d70c61c0f6c276a41cddaeecb7842d436ab3bc" dependencies = [ "webview2-com-macros", "webview2-com-sys", @@ -3006,9 +3018,9 @@ dependencies = [ [[package]] name = "webview2-com-macros" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eba35fdbb8fbc8de7e7479532a356dbbf2754d8a6e9c9fbfa430896cbb1ca89" +checksum = "07bca4b354035275764ea4ca8d6bfa74cc5b0e8126e7cd675ee327574b59e13d" dependencies = [ "proc-macro2", "quote", @@ -3017,9 +3029,9 @@ dependencies = [ [[package]] name = "webview2-com-sys" -version = "0.4.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14690dcb8b57c5238c4502cfc321f858fa1306edd4109e8e1d7ddee0c29b06a5" +checksum = "73472d7f0e9038b58204cb3f582ee138a8c181719dc6825ea03371ad085c6058" dependencies = [ "regex", "serde", @@ -3061,30 +3073,53 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.19.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef84dd25f4c69a271b1bba394532bf400523b43169de21dfc715e8f8e491053d" +checksum = "e46c474738425c090573ecf5472d54ee5f78132e6195d0bbfcc2aabc0ed29f37" dependencies = [ - "const-sha1", + "windows_aarch64_msvc", "windows_gen", + "windows_i686_gnu", + "windows_i686_msvc", "windows_macros", + "windows_reader", + "windows_x86_64_gnu", + "windows_x86_64_msvc", ] [[package]] -name = "windows_gen" -version = "0.19.0" +name = "windows_aarch64_msvc" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac7bb21b8ff5e801232b72a6ff554b4cc0cef9ed9238188c3ca78fe3968a7e5d" +checksum = "3022d174000fcaeb6f95933fb04171ea0e21b9289ac57fe4400bfa148e41df79" + +[[package]] +name = "windows_gen" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54e0f0e40e950724f92de0f714817c7030a88161738b9b1c58d62c817246fe1c" dependencies = [ "windows_quote", "windows_reader", ] [[package]] -name = "windows_macros" -version = "0.19.0" +name = "windows_i686_gnu" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5566b8c51118769e4a9094a688bf1233a3f36aacbfc78f3b15817fe0b6e0442f" +checksum = "03b1584eebf06654708eab4301152032c13c1e47f4a754ffc93c733f10993e85" + +[[package]] +name = "windows_i686_msvc" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49df16591e9ad429997ec57d462b0cc45168f639d03489e8c2e933ea9c389d7" + +[[package]] +name = "windows_macros" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6103bcf1a7396d66f6f08a2d67d8a2ab34efaf4b1d7567301af2c002507c8c3b" dependencies = [ "syn", "windows_gen", @@ -3094,20 +3129,32 @@ dependencies = [ [[package]] name = "windows_quote" -version = "0.19.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af8236a9493c38855f95cdd11b38b342512a5df4ee7473cffa828b5ebb0e39c" +checksum = "e414df8d5dd2013f2317fdc414d3ad035effcb7aef1f16bf508ac5743154835a" [[package]] name = "windows_reader" -version = "0.19.0" +version = "0.25.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8d5cf83fb08083438c5c46723e6206b2970da57ce314f80b57724439aaacab" +checksum = "8132c9fb77903d852ea20053af816bd15c088a6e8d283b8283e80353347bb6b9" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cb06177184100374f97d5e7261ee0b6adefa8ee32e38f87518ca22b519bb80e" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c27bcbb33ddbed3569e36c14775c99f72b97c72ce49f81d128637fb48a061f" [[package]] name = "wry" version = "0.12.2" -source = "git+ssh://git@github.com/tauri-sec/wry?branch=next#0f9eb9b1b9288b5be443bced0e8fa58a2479c491" +source = "git+ssh://git@github.com/tauri-sec/wry?branch=next#c60bb8f49e971237a1e9ed73fad2cec38dc7c9db" dependencies = [ "cocoa", "core-graphics 0.22.3", diff --git a/docs/guides/webdriver/example/setup.md b/docs/guides/webdriver/example/setup.md index 79b68a51b..7f75234bf 100644 --- a/docs/guides/webdriver/example/setup.md +++ b/docs/guides/webdriver/example/setup.md @@ -72,7 +72,7 @@ to the Cargo Manifest (`Cargo.toml`) so that Cargo knows to pull in our dependen name = "hello-tauri-webdriver" version = "0.1.0" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" # Needed to set up some things for Tauri at build time [build-dependencies] diff --git a/examples/api/dist/assets/index.4b6f33f7.js b/examples/api/dist/assets/index.4b6f33f7.js new file mode 100644 index 000000000..b8c90b0df --- /dev/null +++ b/examples/api/dist/assets/index.4b6f33f7.js @@ -0,0 +1,39 @@ +var Ho=Object.defineProperty,Io=Object.defineProperties;var qo=Object.getOwnPropertyDescriptors;var Ui=Object.getOwnPropertySymbols;var No=Object.prototype.hasOwnProperty,Bo=Object.prototype.propertyIsEnumerable;var Hi=(e,t,n)=>t in e?Ho(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ii=(e,t)=>{for(var n in t||(t={}))No.call(t,n)&&Hi(e,n,t[n]);if(Ui)for(var n of Ui(t))Bo.call(t,n)&&Hi(e,n,t[n]);return e},qi=(e,t)=>Io(e,qo(t));import{S as X,i as Y,s as $,e as s,a as v,t as z,b as a,c as O,d as r,l as T,f as G,n as I,g as W,r as x,o as Xe,h as Wn,j as A,p as Ye,k as he,m as Go,q as Ni,u as dt,v as $e,w as Bi,x as J,y as Gi,z as Vi,A as Ji,B as Ki,C as Xi,D as Yi,E as Vo,F as $i,G as Qi,H as Jo,I as Ko,J as Xo}from"./vendor.3a672f03.js";const Yo=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const o of document.querySelectorAll('link[rel="modulepreload"]'))i(o);new MutationObserver(o=>{for(const l of o)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function n(o){const l={};return o.integrity&&(l.integrity=o.integrity),o.referrerpolicy&&(l.referrerPolicy=o.referrerpolicy),o.crossorigin==="use-credentials"?l.credentials="include":o.crossorigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(o){if(o.ep)return;o.ep=!0;const l=n(o);fetch(o.href,l)}};Yo();/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var Zi=function(e,t){return(Zi=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])})(e,t)};function Ln(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}Zi(e,t),e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var ft=function(){return(ft=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&o[o.length-1])||f[0]!==6&&f[0]!==2)){u=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]{n(2,l=p)}),no().then(p=>{n(0,i=p)}),oo().then(p=>{n(1,o=p)});async function u(){await ro()}async function c(){await Dn()}return[i,o,l,u,c]}class xo extends X{constructor(t){super();Y(this,t,Zo,Qo,$,{})}}function lo(){return g(this,void 0,void 0,function(){return _(this,function(e){return[2,C({__tauriModule:"Cli",message:{cmd:"cliMatches"}})]})})}Object.freeze({__proto__:null,getMatches:lo});function tr(e){let t,n,i,o,l,u,c,p,h,f,M;return{c(){t=s("div"),n=z(`This binary can be run on the terminal and takes the following arguments: + `),i=s("ul"),i.innerHTML=`
  • --config PATH
  • +
  • --theme light|dark|system
  • +
  • --verbose
  • `,o=z(` + Additionally, it has a `),l=s("i"),l.textContent="update --background",u=z(` subcommand. + Note that the arguments are only parsed, not implemented. + `),c=s("br"),p=v(),h=s("button"),h.textContent="Get matches",a(h,"class","button"),a(h,"id","cli-matches")},m(m,d){O(m,t,d),r(t,n),r(t,i),r(t,o),r(t,l),r(t,u),r(t,c),r(t,p),r(t,h),f||(M=T(h,"click",e[0]),f=!0)},p:I,i:I,o:I,d(m){m&&W(t),f=!1,M()}}}function er(e,t,n){let{onMessage:i}=t;function o(){lo().then(i).catch(i)}return e.$$set=l=>{"onMessage"in l&&n(1,i=l.onMessage)},[o,i]}class nr extends X{constructor(t){super();Y(this,t,er,tr,$,{onMessage:1})}}function uo(e,t,n){return g(this,void 0,void 0,function(){return _(this,function(i){switch(i.label){case 0:return[4,C({__tauriModule:"Event",message:{cmd:"emit",event:e,windowLabel:t,payload:typeof n=="string"?n:JSON.stringify(n)}})];case 1:return i.sent(),[2]}})})}function so(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"Event",message:{cmd:"unlisten",eventId:e}})]})})}function Et(e,t){return g(this,void 0,void 0,function(){var n=this;return _(this,function(i){return[2,C({__tauriModule:"Event",message:{cmd:"listen",event:e,handler:Lt(t)}}).then(function(o){return function(){return g(n,void 0,void 0,function(){return _(this,function(l){return[2,so(o)]})})}})]})})}function Rn(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,Et(e,function(i){t(i),so(i.id).catch(function(){})})]})})}function Qe(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,uo(e,null,t)]})})}Object.freeze({__proto__:null,listen:Et,once:Rn,emit:Qe});function ir(e){let t,n,i,o,l,u,c,p;return{c(){t=s("div"),n=s("button"),n.textContent="Call Log API",i=v(),o=s("button"),o.textContent="Call Request (async) API",l=v(),u=s("button"),u.textContent="Send event to Rust",a(n,"class","button"),a(n,"id","log"),a(o,"class","button"),a(o,"id","request"),a(u,"class","button"),a(u,"id","event")},m(h,f){O(h,t,f),r(t,n),r(t,i),r(t,o),r(t,l),r(t,u),c||(p=[T(n,"click",e[0]),T(o,"click",e[1]),T(u,"click",e[2])],c=!0)},p:I,i:I,o:I,d(h){h&&W(t),c=!1,x(p)}}}function or(e,t,n){let{onMessage:i}=t,o;Xe(async()=>{o=await Et("rust-event",i)}),Wn(()=>{o&&o()});function l(){me("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function u(){me("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(i).catch(i)}function c(){Qe("js-event","this is the payload string")}return e.$$set=p=>{"onMessage"in p&&n(3,i=p.onMessage)},[l,u,c,i]}class rr extends X{constructor(t){super();Y(this,t,or,ir,$,{onMessage:3})}}function jn(e){return e===void 0&&(e={}),g(this,void 0,void 0,function(){return _(this,function(t){return typeof e=="object"&&Object.freeze(e),[2,C({__tauriModule:"Dialog",message:{cmd:"openDialog",options:e}})]})})}function ao(e){return e===void 0&&(e={}),g(this,void 0,void 0,function(){return _(this,function(t){return typeof e=="object"&&Object.freeze(e),[2,C({__tauriModule:"Dialog",message:{cmd:"saveDialog",options:e}})]})})}function lr(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"Dialog",message:{cmd:"messageDialog",message:e}})]})})}function ur(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Dialog",message:{cmd:"askDialog",title:t,message:e}})]})})}function sr(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Dialog",message:{cmd:"confirmDialog",title:t,message:e}})]})})}Object.freeze({__proto__:null,open:jn,save:ao,message:lr,ask:ur,confirm:sr});var Vt;function ar(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"readFile",path:e,options:t}}).then(function(i){return new TextDecoder().decode(new Uint8Array(i))})]})})}function Fn(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"readFile",path:e,options:t}})]})})}function cr(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return typeof t=="object"&&Object.freeze(t),typeof e=="object"&&Object.freeze(e),[2,C({__tauriModule:"Fs",message:{cmd:"writeFile",path:e.path,contents:Array.from(new TextEncoder().encode(e.contents)),options:t}})]})})}function dr(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return typeof t=="object"&&Object.freeze(t),typeof e=="object"&&Object.freeze(e),[2,C({__tauriModule:"Fs",message:{cmd:"writeFile",path:e.path,contents:Array.from(e.contents),options:t}})]})})}function co(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"readDir",path:e,options:t}})]})})}function fr(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"createDir",path:e,options:t}})]})})}function pr(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"removeDir",path:e,options:t}})]})})}function hr(e,t,n){return n===void 0&&(n={}),g(this,void 0,void 0,function(){return _(this,function(i){return[2,C({__tauriModule:"Fs",message:{cmd:"copyFile",source:e,destination:t,options:n}})]})})}function mr(e,t){return t===void 0&&(t={}),g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"Fs",message:{cmd:"removeFile",path:e,options:t}})]})})}function vr(e,t,n){return n===void 0&&(n={}),g(this,void 0,void 0,function(){return _(this,function(i){return[2,C({__tauriModule:"Fs",message:{cmd:"renameFile",oldPath:e,newPath:t,options:n}})]})})}(function(e){e[e.Audio=1]="Audio",e[e.Cache=2]="Cache",e[e.Config=3]="Config",e[e.Data=4]="Data",e[e.LocalData=5]="LocalData",e[e.Desktop=6]="Desktop",e[e.Document=7]="Document",e[e.Download=8]="Download",e[e.Executable=9]="Executable",e[e.Font=10]="Font",e[e.Home=11]="Home",e[e.Picture=12]="Picture",e[e.Public=13]="Public",e[e.Runtime=14]="Runtime",e[e.Template=15]="Template",e[e.Video=16]="Video",e[e.Resource=17]="Resource",e[e.App=18]="App",e[e.Current=19]="Current",e[e.Log=20]="Log"})(Vt||(Vt={}));Object.freeze({__proto__:null,get BaseDirectory(){return Vt},get Dir(){return Vt},readTextFile:ar,readBinaryFile:Fn,writeFile:cr,writeBinaryFile:dr,readDir:co,createDir:fr,removeDir:pr,copyFile:hr,removeFile:mr,renameFile:vr});function gr(e){let t,n,i,o,l,u,c,p,h,f,M,m,d,b,k,y,P,S,j,F;return{c(){t=s("div"),n=s("input"),i=v(),o=s("input"),l=v(),u=s("div"),c=s("input"),p=v(),h=s("label"),h.textContent="Multiple",f=v(),M=s("div"),m=s("input"),d=v(),b=s("label"),b.textContent="Directory",k=v(),y=s("button"),y.textContent="Open dialog",P=v(),S=s("button"),S.textContent="Open save dialog",a(n,"id","dialog-default-path"),a(n,"placeholder","Default path"),a(o,"id","dialog-filter"),a(o,"placeholder","Extensions filter, comma-separated"),a(o,"class","svelte-1eg58yg"),a(c,"type","checkbox"),a(c,"id","dialog-multiple"),a(h,"for","dialog-multiple"),a(m,"type","checkbox"),a(m,"id","dialog-directory"),a(b,"for","dialog-directory"),a(y,"class","button"),a(y,"id","open-dialog"),a(S,"class","button"),a(S,"id","save-dialog")},m(U,L){O(U,t,L),r(t,n),A(n,e[0]),r(t,i),r(t,o),A(o,e[1]),r(t,l),r(t,u),r(u,c),c.checked=e[2],r(u,p),r(u,h),r(t,f),r(t,M),r(M,m),m.checked=e[3],r(M,d),r(M,b),r(t,k),r(t,y),r(t,P),r(t,S),j||(F=[T(n,"input",e[8]),T(o,"input",e[9]),T(c,"change",e[10]),T(m,"change",e[11]),T(y,"click",e[4]),T(S,"click",e[5])],j=!0)},p(U,[L]){L&1&&n.value!==U[0]&&A(n,U[0]),L&2&&o.value!==U[1]&&A(o,U[1]),L&4&&(c.checked=U[2]),L&8&&(m.checked=U[3])},i:I,o:I,d(U){U&&W(t),j=!1,x(F)}}}function _r(e,t){var n=new Blob([e],{type:"application/octet-binary"}),i=new FileReader;i.onload=function(o){var l=o.target.result;t(l.substr(l.indexOf(",")+1))},i.readAsDataURL(n)}function br(e,t,n){let{onMessage:i}=t,{insecureRenderHtml:o}=t,l=null,u=null,c=!1,p=!1;function h(){jn({defaultPath:l,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(k=>k.trim())}]:[],multiple:c,directory:p}).then(function(k){if(Array.isArray(k))i(k);else{var y=k,P=y.match(/\S+\.\S+$/g);Fn(y).then(function(S){P&&(y.includes(".png")||y.includes(".jpg"))?_r(new Uint8Array(S),function(j){var F="data:image/png;base64,"+j;o('')}):i(k)}).catch(i(k))}}).catch(i)}function f(){ao({defaultPath:l,filters:u?[{name:"Tauri Example",extensions:u.split(",").map(k=>k.trim())}]:[]}).then(i).catch(i)}function M(){l=this.value,n(0,l)}function m(){u=this.value,n(1,u)}function d(){c=this.checked,n(2,c)}function b(){p=this.checked,n(3,p)}return e.$$set=k=>{"onMessage"in k&&n(6,i=k.onMessage),"insecureRenderHtml"in k&&n(7,o=k.insecureRenderHtml)},[l,u,c,p,h,f,i,o,M,m,d,b]}class yr extends X{constructor(t){super();Y(this,t,br,gr,$,{onMessage:6,insecureRenderHtml:7})}}function fo(e,t,n){const i=e.slice();return i[9]=t[n],i}function po(e){let t,n=e[9][0]+"",i,o;return{c(){t=s("option"),i=z(n),t.__value=o=e[9][1],t.value=t.__value},m(l,u){O(l,t,u),r(t,i)},p:I,d(l){l&&W(t)}}}function wr(e){let t,n,i,o,l,u,c,p,h,f,M,m,d,b=e[2],k=[];for(let y=0;yisNaN(parseInt(m))).map(m=>[m,Vt[m]]);function p(){const m=l.match(/\S+\.\S+$/g),d={dir:ho()};(m?Fn(l,d):co(l,d)).then(function(k){if(m)if(l.includes(".png")||l.includes(".jpg"))Mr(new Uint8Array(k),function(y){const P="data:image/png;base64,"+y;o('')});else{const y=String.fromCharCode.apply(null,k);o(''),setTimeout(()=>{const P=document.getElementById("file-response");P.value=y,document.getElementById("file-save").addEventListener("click",function(){writeFile({file:l,contents:P.value},{dir:ho()}).catch(i)})})}else i(k)}).catch(i)}function h(){n(1,u.src=xi(l),u)}function f(){l=this.value,n(0,l)}function M(m){Go[m?"unshift":"push"](()=>{u=m,n(1,u)})}return e.$$set=m=>{"onMessage"in m&&n(5,i=m.onMessage),"insecureRenderHtml"in m&&n(6,o=m.insecureRenderHtml)},[l,u,c,p,h,i,o,f,M]}class Cr extends X{constructor(t){super();Y(this,t,kr,wr,$,{onMessage:5,insecureRenderHtml:6})}}var ve;(function(e){e[e.JSON=1]="JSON",e[e.Text=2]="Text",e[e.Binary=3]="Binary"})(ve||(ve={}));var Un=function(){function e(t,n){this.type=t,this.payload=n}return e.form=function(t){return new e("Form",t)},e.json=function(t){return new e("Json",t)},e.text=function(t){return new e("Text",t)},e.bytes=function(t){return new e("Bytes",t)},e}(),mo=function(e){this.url=e.url,this.status=e.status,this.ok=this.status>=200&&this.status<300,this.headers=e.headers,this.rawHeaders=e.rawHeaders,this.data=e.data},vo=function(){function e(t){this.id=t}return e.prototype.drop=function(){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},e.prototype.request=function(t){return g(this,void 0,void 0,function(){var n;return _(this,function(i){return(n=!t.responseType||t.responseType===ve.JSON)&&(t.responseType=ve.Text),[2,C({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:t}}).then(function(o){var l=new mo(o);if(n){try{l.data=JSON.parse(l.data)}catch(u){if(l.ok&&l.data==="")l.data={};else if(l.ok)throw Error("Failed to parse response `".concat(l.data,"` as JSON: ").concat(u,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return l}return l})]})})},e.prototype.get=function(t,n){return g(this,void 0,void 0,function(){return _(this,function(i){return[2,this.request(ft({method:"GET",url:t},n))]})})},e.prototype.post=function(t,n,i){return g(this,void 0,void 0,function(){return _(this,function(o){return[2,this.request(ft({method:"POST",url:t,body:n},i))]})})},e.prototype.put=function(t,n,i){return g(this,void 0,void 0,function(){return _(this,function(o){return[2,this.request(ft({method:"PUT",url:t,body:n},i))]})})},e.prototype.patch=function(t,n){return g(this,void 0,void 0,function(){return _(this,function(i){return[2,this.request(ft({method:"PATCH",url:t},n))]})})},e.prototype.delete=function(t,n){return g(this,void 0,void 0,function(){return _(this,function(i){return[2,this.request(ft({method:"DELETE",url:t},n))]})})},e}();function Hn(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"Http",message:{cmd:"createClient",options:e}}).then(function(n){return new vo(n)})]})})}var In=null;function Tr(e,t){var n;return g(this,void 0,void 0,function(){return _(this,function(i){switch(i.label){case 0:return In!==null?[3,2]:[4,Hn()];case 1:In=i.sent(),i.label=2;case 2:return[2,In.request(ft({url:e,method:(n=t==null?void 0:t.method)!==null&&n!==void 0?n:"GET"},t))]}})})}Object.freeze({__proto__:null,getClient:Hn,fetch:Tr,Body:Un,Client:vo,Response:mo,get ResponseType(){return ve}});function Sr(e){let t,n,i,o,l,u,c,p,h,f,M,m,d,b,k,y,P;return{c(){t=s("form"),n=s("select"),i=s("option"),i.textContent="GET",o=s("option"),o.textContent="POST",l=s("option"),l.textContent="PUT",u=s("option"),u.textContent="PATCH",c=s("option"),c.textContent="DELETE",p=v(),h=s("input"),f=v(),M=s("br"),m=v(),d=s("textarea"),b=v(),k=s("button"),k.textContent="Make request",i.__value="GET",i.value=i.__value,o.__value="POST",o.value=o.__value,l.__value="PUT",l.value=l.__value,u.__value="PATCH",u.value=u.__value,c.__value="DELETE",c.value=c.__value,a(n,"class","button"),a(n,"id","request-method"),e[0]===void 0&&Ni(()=>e[5].call(n)),a(h,"id","request-url"),a(h,"placeholder","Type the request URL..."),a(d,"id","request-body"),a(d,"placeholder","Request body"),a(d,"rows","5"),dt(d,"width","100%"),dt(d,"margin-right","10px"),dt(d,"font-size","12px"),a(k,"class","button"),a(k,"id","make-request")},m(S,j){O(S,t,j),r(t,n),r(n,i),r(n,o),r(n,l),r(n,u),r(n,c),$e(n,e[0]),r(t,p),r(t,h),A(h,e[1]),r(t,f),r(t,M),r(t,m),r(t,d),A(d,e[2]),r(t,b),r(t,k),y||(P=[T(n,"change",e[5]),T(h,"input",e[6]),T(d,"input",e[7]),T(t,"submit",Ye(e[3]))],y=!0)},p(S,[j]){j&1&&$e(n,S[0]),j&2&&h.value!==S[1]&&A(h,S[1]),j&4&&A(d,S[2])},i:I,o:I,d(S){S&&W(t),y=!1,x(P)}}}function zr(e,t,n){let i="GET",o="https://jsonplaceholder.typicode.com/todos/1",l="",{onMessage:u}=t;async function c(){const M=await Hn().catch(k=>{throw u(k),k}),b={url:o||""||"",method:i||"GET"||"GET"};l.startsWith("{")&&l.endsWith("}")||l.startsWith("[")&&l.endsWith("]")?b.body=Un.json(JSON.parse(l)):l!==""&&(b.body=Un.text(l)),M.request(b).then(u).catch(u)}function p(){i=Bi(this),n(0,i)}function h(){o=this.value,n(1,o)}function f(){l=this.value,n(2,l)}return e.$$set=M=>{"onMessage"in M&&n(4,u=M.onMessage)},[i,o,l,c,u,p,h,f]}class Pr extends X{constructor(t){super();Y(this,t,zr,Sr,$,{onMessage:4})}}function Or(e){let t,n,i;return{c(){t=s("button"),t.textContent="Send test notification",a(t,"class","button"),a(t,"id","notification")},m(o,l){O(o,t,l),n||(i=T(t,"click",Wr),n=!0)},p:I,i:I,o:I,d(o){o&&W(t),n=!1,i()}}}function Wr(){new Notification("Notification title",{body:"This is the notification body"})}function Lr(e,t,n){let{onMessage:i}=t;return e.$$set=o=>{"onMessage"in o&&n(0,i=o.onMessage)},[i]}class Er extends X{constructor(t){super();Y(this,t,Lr,Or,$,{onMessage:0})}}var Jt,Ze=function(e,t){this.type="Logical",this.width=e,this.height=t},Kt=function(){function e(t,n){this.type="Physical",this.width=t,this.height=n}return e.prototype.toLogical=function(t){return new Ze(this.width/t,this.height/t)},e}(),go=function(e,t){this.type="Logical",this.x=e,this.y=t},Xt=function(){function e(t,n){this.type="Physical",this.x=t,this.y=n}return e.prototype.toLogical=function(t){return new go(this.x/t,this.y/t)},e}();function Ar(){return new ge(window.__TAURI__.__currentWindow.label,{skip:!0})}function _o(){return window.__TAURI__.__windows.map(function(e){return new ge(e.label,{skip:!0})})}(function(e){e[e.Critical=1]="Critical",e[e.Informational=2]="Informational"})(Jt||(Jt={}));var bo=["tauri://created","tauri://error"],yo=function(){function e(t){try{this.label=t!=null?t:window.__TAURI__.__currentWindow.label}catch{this.label=""}this.listeners=Object.create(null)}return e.prototype.listen=function(t,n){return g(this,void 0,void 0,function(){var i=this;return _(this,function(o){return this._handleTauriEvent(t,n)?[2,Promise.resolve(function(){var l=i.listeners[t];l.splice(l.indexOf(n),1)})]:[2,Et(t,n)]})})},e.prototype.once=function(t,n){return g(this,void 0,void 0,function(){var i=this;return _(this,function(o){return this._handleTauriEvent(t,n)?[2,Promise.resolve(function(){var l=i.listeners[t];l.splice(l.indexOf(n),1)})]:[2,Rn(t,n)]})})},e.prototype.emit=function(t,n){return g(this,void 0,void 0,function(){var i,o;return _(this,function(l){if(bo.includes(t)){for(i=0,o=this.listeners[t]||[];ie[31].call(n)),a(u,"type","checkbox"),a(f,"type","checkbox"),a(d,"title","Unminimizes after 2 seconds"),a(k,"title","Unminimizes after 2 seconds"),a(P,"title","Visible again after 2 seconds"),a(F,"type","checkbox"),a(N,"type","checkbox"),a(B,"type","checkbox"),a(Q,"type","checkbox"),a(it,"type","number"),a(it,"min","0"),a(it,"class","svelte-12ggtr4"),a(ot,"type","number"),a(ot,"min","0"),a(ot,"class","svelte-12ggtr4"),a(pt,"class","flex col grow svelte-12ggtr4"),a(rt,"type","number"),a(rt,"min","400"),a(rt,"class","svelte-12ggtr4"),a(lt,"type","number"),a(lt,"min","400"),a(lt,"class","svelte-12ggtr4"),a(ht,"class","flex col grow svelte-12ggtr4"),a(mt,"type","number"),a(mt,"class","svelte-12ggtr4"),a(vt,"type","number"),a(vt,"class","svelte-12ggtr4"),a(q,"class","flex col grow svelte-12ggtr4"),a(at,"type","number"),a(at,"min","400"),a(at,"class","svelte-12ggtr4"),a(ct,"type","number"),a(ct,"min","400"),a(ct,"class","svelte-12ggtr4"),a(Ut,"class","flex col grow svelte-12ggtr4"),a(et,"class","window-controls flex flex-row svelte-12ggtr4"),a(t,"class","flex col"),a($t,"class","svelte-12ggtr4"),a(Qt,"class","svelte-12ggtr4"),a(gt,"class","grow window-property svelte-12ggtr4"),a(Zt,"class","svelte-12ggtr4"),a(xt,"class","svelte-12ggtr4"),a(_t,"class","grow window-property svelte-12ggtr4"),a(Ht,"class","flex"),a(te,"class","svelte-12ggtr4"),a(ee,"class","svelte-12ggtr4"),a(bt,"class","grow window-property svelte-12ggtr4"),a(ne,"class","svelte-12ggtr4"),a(ie,"class","svelte-12ggtr4"),a(yt,"class","grow window-property svelte-12ggtr4"),a(It,"class","flex"),a(oe,"class","svelte-12ggtr4"),a(re,"class","svelte-12ggtr4"),a(wt,"class","grow window-property svelte-12ggtr4"),a(le,"class","svelte-12ggtr4"),a(ue,"class","svelte-12ggtr4"),a(Mt,"class","grow window-property svelte-12ggtr4"),a(qt,"class","flex"),a(se,"class","svelte-12ggtr4"),a(ae,"class","svelte-12ggtr4"),a(kt,"class","grow window-property svelte-12ggtr4"),a(ce,"class","svelte-12ggtr4"),a(de,"class","svelte-12ggtr4"),a(Ct,"class","grow window-property svelte-12ggtr4"),a(Nt,"class","flex"),a(Pt,"id","title"),a(fe,"class","button"),a(fe,"type","submit"),dt(Tt,"margin-top","24px"),a(Ot,"id","url"),a(pe,"class","button"),a(pe,"id","open-url"),dt(St,"margin-top","24px"),a(Wt,"class","button"),a(Wt,"title","Minimizes the window, requests attention for 3s and then resets it"),a(Bt,"class","button")},m(w,E){O(w,t,E),r(t,n);for(let V=0;V{q&&o[i].setIcon(q)})}function be(){const q=Math.random().toString().replace(".",""),zt=new ge(q);n(1,o[q]=zt,o),zt.once("tauri://error",function(){l("Error creating new webview")})}function At(){o[i].innerSize().then(q=>{n(20,N=q),n(7,d=N.width),n(8,b=N.height)}),o[i].outerSize().then(q=>{n(21,tt=q)})}function ye(){o[i].innerPosition().then(q=>{n(18,L=q)}),o[i].outerPosition().then(q=>{n(19,H=q),n(13,j=H.x),n(14,F=H.y)})}async function Yt(q){st&&st(),K&&K(),K=await q.listen("tauri://move",ye),st=await q.listen("tauri://resize",At)}async function et(){await o[i].minimize(),await o[i].requestUserAttention(Jt.Critical),await new Promise(q=>setTimeout(q,3e3)),await o[i].requestUserAttention(null)}function pt(){i=Bi(this),n(0,i),n(1,o)}function Dt(){c=this.checked,n(2,c)}function we(){p=this.checked,n(3,p)}const it=()=>o[i].center();function Me(){h=this.checked,n(16,h)}function Rt(){f=this.checked,n(4,f)}function ke(){M=this.checked,n(5,M)}function ot(){m=this.checked,n(6,m)}function Ce(){j=J(this.value),n(13,j)}function ht(){F=J(this.value),n(14,F)}function jt(){d=J(this.value),n(7,d)}function Te(){b=J(this.value),n(8,b)}function rt(){k=J(this.value),n(9,k)}function Se(){y=J(this.value),n(10,y)}function Ft(){P=J(this.value),n(11,P)}function ze(){S=J(this.value),n(12,S)}function lt(){B=this.value,n(22,B)}function Pe(){u=this.value,n(15,u)}return e.$$set=q=>{"onMessage"in q&&n(30,l=q.onMessage)},e.$$.update=()=>{e.$$.dirty[0]&7&&o[i].setResizable(c),e.$$.dirty[0]&11&&(p?o[i].maximize():o[i].unmaximize()),e.$$.dirty[0]&19&&o[i].setDecorations(f),e.$$.dirty[0]&35&&o[i].setAlwaysOnTop(M),e.$$.dirty[0]&67&&o[i].setFullscreen(m),e.$$.dirty[0]&387&&o[i].setSize(new Kt(d,b)),e.$$.dirty[0]&1539&&(k&&y?o[i].setMinSize(new Ze(k,y)):o[i].setMinSize(null)),e.$$.dirty[0]&6147&&(P&&S?o[i].setMaxSize(new Ze(P,S)):o[i].setMaxSize(null)),e.$$.dirty[0]&24579&&o[i].setPosition(new Xt(j,F)),e.$$.dirty[0]&3&&o[i].scaleFactor().then(q=>n(17,U=q)),e.$$.dirty[0]&3&&Yt(o[i])},[i,o,c,p,f,M,m,d,b,k,y,P,S,j,F,u,h,U,L,H,N,tt,B,R,nt,D,Q,_e,be,et,l,pt,Dt,we,it,Me,Rt,ke,ot,Ce,ht,jt,Te,rt,Se,Ft,ze,lt,Pe]}class Hr extends X{constructor(t){super();Y(this,t,Ur,Fr,$,{onMessage:30},[-1,-1])}}function Co(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"GlobalShortcut",message:{cmd:"register",shortcut:e,handler:Lt(t)}})]})})}function Ir(e,t){return g(this,void 0,void 0,function(){return _(this,function(n){return[2,C({__tauriModule:"GlobalShortcut",message:{cmd:"registerAll",shortcuts:e,handler:Lt(t)}})]})})}function qr(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"GlobalShortcut",message:{cmd:"isRegistered",shortcut:e}})]})})}function To(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"GlobalShortcut",message:{cmd:"unregister",shortcut:e}})]})})}function So(){return g(this,void 0,void 0,function(){return _(this,function(e){return[2,C({__tauriModule:"GlobalShortcut",message:{cmd:"unregisterAll"}})]})})}Object.freeze({__proto__:null,register:Co,registerAll:Ir,isRegistered:qr,unregister:To,unregisterAll:So});function zo(e,t,n){const i=e.slice();return i[9]=t[n],i}function Po(e){let t,n=e[9]+"",i,o,l,u,c;function p(){return e[8](e[9])}return{c(){t=s("div"),i=z(n),o=v(),l=s("button"),l.textContent="Unregister",a(l,"type","button")},m(h,f){O(h,t,f),r(t,i),r(t,o),r(t,l),u||(c=T(l,"click",p),u=!0)},p(h,f){e=h,f&2&&n!==(n=e[9]+"")&&G(i,n)},d(h){h&&W(t),u=!1,c()}}}function Oo(e){let t,n,i;return{c(){t=s("button"),t.textContent="Unregister all",a(t,"type","button")},m(o,l){O(o,t,l),n||(i=T(t,"click",e[5]),n=!0)},p:I,d(o){o&&W(t),n=!1,i()}}}function Nr(e){let t,n,i,o,l,u,c,p,h,f,M=e[1],m=[];for(let b=0;bn(1,i=m));let u="CmdOrControl+X";function c(){const m=u;Co(m,()=>{o(`Shortcut ${m} triggered`)}).then(()=>{l.update(d=>[...d,m]),o(`Shortcut ${m} registered successfully`)}).catch(o)}function p(m){const d=m;To(d).then(()=>{l.update(b=>b.filter(k=>k!==d)),o(`Shortcut ${d} unregistered`)}).catch(o)}function h(){So().then(()=>{l.update(()=>[]),o("Unregistered all shortcuts")}).catch(o)}function f(){u=this.value,n(0,u)}const M=m=>p(m);return e.$$set=m=>{"onMessage"in m&&n(6,o=m.onMessage)},[u,i,l,c,p,h,o,f,M]}class Gr extends X{constructor(t){super();Y(this,t,Br,Nr,$,{onMessage:6})}}function Wo(e){let t,n,i,o,l;return{c(){t=s("input"),n=v(),i=s("button"),i.textContent="Write",a(t,"placeholder","write to stdin"),a(i,"class","button")},m(u,c){O(u,t,c),A(t,e[3]),O(u,n,c),O(u,i,c),o||(l=[T(t,"input",e[10]),T(i,"click",e[7])],o=!0)},p(u,c){c&8&&t.value!==u[3]&&A(t,u[3])},d(u){u&&W(t),u&&W(n),u&&W(i),o=!1,x(l)}}}function Vr(e){let t,n,i,o,l,u,c,p,h,f,M,m,d,b,k,y=e[4]&&Wo(e);return{c(){t=s("div"),n=s("div"),i=s("input"),o=v(),l=s("button"),l.textContent="Run",u=v(),c=s("button"),c.textContent="Kill",p=v(),y&&y.c(),h=v(),f=s("div"),M=s("input"),m=v(),d=s("input"),a(l,"class","button"),a(c,"class","button"),a(M,"placeholder","Working directory"),a(d,"placeholder","Environment variables"),dt(d,"width","300px")},m(P,S){O(P,t,S),r(t,n),r(n,i),A(i,e[0]),r(n,o),r(n,l),r(n,u),r(n,c),r(n,p),y&&y.m(n,null),r(t,h),r(t,f),r(f,M),A(M,e[1]),r(f,m),r(f,d),A(d,e[2]),b||(k=[T(i,"input",e[9]),T(l,"click",e[5]),T(c,"click",e[6]),T(M,"input",e[11]),T(d,"input",e[12])],b=!0)},p(P,[S]){S&1&&i.value!==P[0]&&A(i,P[0]),P[4]?y?y.p(P,S):(y=Wo(P),y.c(),y.m(n,null)):y&&(y.d(1),y=null),S&2&&M.value!==P[1]&&A(M,P[1]),S&4&&d.value!==P[2]&&A(d,P[2])},i:I,o:I,d(P){P&&W(t),y&&y.d(),b=!1,x(k)}}}function Jr(e,t,n){const i=navigator.userAgent.includes("Windows");let o=i?"cmd":"sh",l=i?["/C"]:["-c"],{onMessage:u}=t,c='echo "hello world"',p=null,h="SOMETHING=value ANOTHER=2",f="",M;function m(){return h.split(" ").reduce((F,U)=>{let[L,H]=U.split("=");return qi(Ii({},F),{[L]:H})},{})}function d(){n(4,M=null);const F=new eo(o,[...l,c],{cwd:p||null,env:m()});F.on("close",U=>{u(`command finished with code ${U.code} and signal ${U.signal}`),n(4,M=null)}),F.on("error",U=>u(`command error: "${U}"`)),F.stdout.on("data",U=>u(`command stdout: "${U}"`)),F.stderr.on("data",U=>u(`command stderr: "${U}"`)),F.spawn().then(U=>{n(4,M=U)}).catch(u)}function b(){M.kill().then(()=>u("killed child process")).catch(u)}function k(){M.write(f).catch(u)}function y(){c=this.value,n(0,c)}function P(){f=this.value,n(3,f)}function S(){p=this.value,n(1,p)}function j(){h=this.value,n(2,h)}return e.$$set=F=>{"onMessage"in F&&n(8,u=F.onMessage)},[c,p,h,f,M,d,b,k,u,y,P,S,j]}class Kr extends X{constructor(t){super();Y(this,t,Jr,Vr,$,{onMessage:8})}}function Lo(){return g(this,void 0,void 0,function(){function e(){t&&t(),t=void 0}var t;return _(this,function(n){return[2,new Promise(function(i,o){Et("tauri://update-status",function(l){var u;(u=l==null?void 0:l.payload).error?(e(),o(u.error)):u.status==="DONE"&&(e(),i())}).then(function(l){t=l}).catch(function(l){throw e(),l}),Qe("tauri://update-install").catch(function(l){throw e(),l})})]})})}function Eo(){return g(this,void 0,void 0,function(){function e(){t&&t(),t=void 0}var t;return _(this,function(n){return[2,new Promise(function(i,o){Rn("tauri://update-available",function(l){var u;u=l==null?void 0:l.payload,e(),i({manifest:u,shouldUpdate:!0})}).catch(function(l){throw e(),l}),Et("tauri://update-status",function(l){var u;(u=l==null?void 0:l.payload).error?(e(),o(u.error)):u.status==="UPTODATE"&&(e(),i({shouldUpdate:!1}))}).then(function(l){t=l}).catch(function(l){throw e(),l}),Qe("tauri://update").catch(function(l){throw e(),l})})]})})}Object.freeze({__proto__:null,installUpdate:Lo,checkUpdate:Eo});function Xr(e){let t,n,i,o,l,u;return{c(){t=s("div"),n=s("button"),n.textContent="Check update",i=v(),o=s("button"),o.textContent="Install update",a(n,"class","button"),a(n,"id","check_update"),a(o,"class","button hidden"),a(o,"id","start_update")},m(c,p){O(c,t,p),r(t,n),r(t,i),r(t,o),l||(u=[T(n,"click",e[0]),T(o,"click",e[1])],l=!0)},p:I,i:I,o:I,d(c){c&&W(t),l=!1,x(u)}}}function Yr(e,t,n){let{onMessage:i}=t,o;Xe(async()=>{o=await Et("tauri://update-status",i)}),Wn(()=>{o&&o()});async function l(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:c,manifest:p}=await Eo();i(`Should update: ${c}`),i(p),c&&document.getElementById("start_update").classList.remove("hidden")}catch(c){i(c)}}async function u(){try{document.getElementById("start_update").classList.add("hidden"),await Lo(),i("Installation complete, restart required."),await Dn()}catch(c){i(c)}}return e.$$set=c=>{"onMessage"in c&&n(2,i=c.onMessage)},[l,u,i]}class $r extends X{constructor(t){super();Y(this,t,Yr,Xr,$,{onMessage:2})}}function Ao(e){return g(this,void 0,void 0,function(){return _(this,function(t){return[2,C({__tauriModule:"Clipboard",message:{cmd:"writeText",data:e}})]})})}function Do(){return g(this,void 0,void 0,function(){return _(this,function(e){return[2,C({__tauriModule:"Clipboard",message:{cmd:"readText"}})]})})}Object.freeze({__proto__:null,writeText:Ao,readText:Do});function Qr(e){let t,n,i,o,l,u,c,p,h;return{c(){t=s("div"),n=s("div"),i=s("input"),o=v(),l=s("button"),l.textContent="Write",u=v(),c=s("button"),c.textContent="Read",a(i,"placeholder","Text to write to the clipboard"),a(l,"type","button"),a(c,"type","button")},m(f,M){O(f,t,M),r(t,n),r(n,i),A(i,e[0]),r(n,o),r(n,l),r(t,u),r(t,c),p||(h=[T(i,"input",e[4]),T(l,"click",e[1]),T(c,"click",e[2])],p=!0)},p(f,[M]){M&1&&i.value!==f[0]&&A(i,f[0])},i:I,o:I,d(f){f&&W(t),p=!1,x(h)}}}function Zr(e,t,n){let{onMessage:i}=t,o="clipboard message";function l(){Ao(o).then(()=>{i("Wrote to the clipboard")}).catch(i)}function u(){Do().then(p=>{i(`Clipboard contents: ${p}`)}).catch(i)}function c(){o=this.value,n(0,o)}return e.$$set=p=>{"onMessage"in p&&n(3,i=p.onMessage)},[o,l,u,i,c]}class xr extends X{constructor(t){super();Y(this,t,Zr,Qr,$,{onMessage:3})}}function tl(e){let t;return{c(){t=s("div"),t.innerHTML=`

    Not available for Linux

    + `},m(n,i){O(n,t,i)},p:I,i:I,o:I,d(n){n&&W(t)}}}function el(e,t,n){let{onMessage:i}=t;const o=window.constraints={audio:!0,video:!0};function l(c){const p=document.querySelector("video"),h=c.getVideoTracks();i("Got stream with constraints:",o),i(`Using video device: ${h[0].label}`),window.stream=c,p.srcObject=c}function u(c){if(c.name==="ConstraintNotSatisfiedError"){const p=o.video;i(`The resolution ${p.width.exact}x${p.height.exact} px is not supported by your device.`)}else c.name==="PermissionDeniedError"&&i("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");i(`getUserMedia error: ${c.name}`,c)}return Xe(async()=>{try{const c=await navigator.mediaDevices.getUserMedia(o);l(c)}catch(c){u(c)}}),Wn(()=>{window.stream.getTracks().forEach(function(c){c.stop()})}),e.$$set=c=>{"onMessage"in c&&n(0,i=c.onMessage)},[i]}class nl extends X{constructor(t){super();Y(this,t,el,tl,$,{onMessage:0})}}function il(e){let t,n,i,o,l,u,c,p,h,f,M,m;return{c(){t=s("input"),n=v(),i=s("input"),o=v(),l=s("button"),l.textContent="Post it.",u=v(),c=s("p"),c.textContent="Result:",p=v(),h=s("pre"),f=z(e[2]),a(l,"type","button")},m(d,b){O(d,t,b),A(t,e[0]),O(d,n,b),O(d,i,b),A(i,e[1]),O(d,o,b),O(d,l,b),O(d,u,b),O(d,c,b),O(d,p,b),O(d,h,b),r(h,f),M||(m=[T(t,"input",e[4]),T(i,"input",e[5]),T(l,"click",e[3])],M=!0)},p(d,[b]){b&1&&t.value!==d[0]&&A(t,d[0]),b&2&&i.value!==d[1]&&A(i,d[1]),b&4&&G(f,d[2])},i:I,o:I,d(d){d&&W(t),d&&W(n),d&&W(i),d&&W(o),d&&W(l),d&&W(u),d&&W(c),d&&W(p),d&&W(h),M=!1,x(m)}}}function ol(e,t,n){let i="baz",o="qux",l=null;async function u(){let h=navigator.userAgent.includes("Windows")?"https://customprotocol.test/example.html":"customprotocol://test/example.html";const M=await(await fetch(h,{method:"POST",body:JSON.stringify({foo:i,bar:o})})).json();n(2,l=JSON.stringify(M))}function c(){i=this.value,n(0,i)}function p(){o=this.value,n(1,o)}return[i,o,l,u,c,p]}class rl extends X{constructor(t){super();Y(this,t,ol,il,$,{})}}function Ro(e,t,n){const i=e.slice();return i[10]=t[n],i}function jo(e,t,n){const i=e.slice();return i[13]=t[n],i}function Fo(e){let t,n=e[13].label+"",i,o,l,u,c;function p(){return e[9](e[13])}return{c(){t=s("p"),i=z(n),o=v(),a(t,"class",l="nv noselect "+(e[0]===e[13]?"nv_selected":""))},m(h,f){O(h,t,f),r(t,i),r(t,o),u||(c=T(t,"click",p),u=!0)},p(h,f){e=h,f&1&&l!==(l="nv noselect "+(e[0]===e[13]?"nv_selected":""))&&a(t,"class",l)},d(h){h&&W(t),u=!1,c()}}}function ll(e){let t,n=e[10].html+"",i;return{c(){i=Ji(),t=new Xo(i)},m(o,l){t.m(n,o,l),O(o,i,l)},p(o,l){l&2&&n!==(n=o[10].html+"")&&t.p(n)},d(o){o&&W(i),o&&t.d()}}}function ul(e){let t,n=e[10].text+"",i;return{c(){t=s("p"),i=z(n)},m(o,l){O(o,t,l),r(t,i)},p(o,l){l&2&&n!==(n=o[10].text+"")&&G(i,n)},d(o){o&&W(t)}}}function Uo(e){let t;function n(l,u){return l[10].text?ul:ll}let i=n(e),o=i(e);return{c(){o.c(),t=Ji()},m(l,u){o.m(l,u),O(l,t,u)},p(l,u){i===(i=n(l))&&o?o.p(l,u):(o.d(1),o=i(l),o&&(o.c(),o.m(t.parentNode,t)))},d(l){o.d(l),l&&W(t)}}}function sl(e){let t,n,i,o,l,u,c,p,h,f,M,m,d,b,k,y,P,S,j,F,U,L,H=e[2],N=[];for(let R=0;RDocumentation
    + Github + Source`,c=v(),p=s("div"),h=s("div");for(let R=0;R{Qi(D,1)}),Vo()}tt?(m=new tt(st(R)),Ki(m.$$.fragment),$i(m.$$.fragment,1),Xi(m,M,null)):m=null}if(nt&2){K=R[1];let D;for(D=0;D{Ko(al,()=>{me("menu_toggle")})});const o=[{label:"Welcome",component:xo},{label:"Messages",component:rr},{label:"CLI",component:nr},{label:"Dialog",component:yr},{label:"File system",component:Cr},{label:"HTTP",component:Pr},{label:"HTTP Form",component:rl},{label:"Notifications",component:Er},{label:"Window",component:Hr},{label:"Shortcuts",component:Gr},{label:"Shell",component:Kr},{label:"Updater",component:$r},{label:"Clipboard",component:xr},{label:"WebRTC",component:nl}];let l=o[0],u=Vi([]);Gi(e,u,d=>n(1,i=d));function c(d){n(0,l=d)}function p(d){u.update(b=>[{text:`[${new Date().toLocaleTimeString()}]: `+(typeof d=="string"?d:JSON.stringify(d))},...b])}function h(d){u.update(b=>[{html:d},...b])}function f(){u.update(()=>[])}function M(){An("https://tauri.studio/")}return[l,i,o,u,c,p,h,f,M,d=>c(d)]}class dl extends X{constructor(t){super();Y(this,t,cl,sl,$,{})}}new dl({target:document.body}); diff --git a/examples/api/dist/assets/index.ab727ab4.js b/examples/api/dist/assets/index.ab727ab4.js deleted file mode 100644 index b56112855..000000000 --- a/examples/api/dist/assets/index.ab727ab4.js +++ /dev/null @@ -1,25 +0,0 @@ -var Yl=Object.defineProperty,Ql=Object.defineProperties;var Zl=Object.getOwnPropertyDescriptors;var gl=Object.getOwnPropertySymbols;var $l=Object.prototype.hasOwnProperty,xl=Object.prototype.propertyIsEnumerable;var ml=(n,t,i)=>t in n?Yl(n,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):n[t]=i,vl=(n,t)=>{for(var i in t||(t={}))$l.call(t,i)&&ml(n,i,t[i]);if(gl)for(var i of gl(t))xl.call(t,i)&&ml(n,i,t[i]);return n},_l=(n,t)=>Ql(n,Zl(t));import{S as G,i as V,s as J,e as a,a as g,t as M,b as u,c as S,d as e,l as y,f as R,n as N,g as L,r as Y,h as ei,j as ti,o as ni,k as li,m as bl,p as ii,q as it,u as wl,v as gn,w as mn,x as si,y as O,z as kl,A as yl,B as oi,C as Nt,D as It,E as Cl,F as ai,G as ui,H as ri,I as Ml,J as ae,K as qt,L as ci,M as Tl,N as Sl,O as F,P as Ll,_ as El,Q as vn,R as _n,T as zl,U as Ol,V as pi,W as di,X as Pl,Y as fi,Z as hi,$ as gi,a0 as mi,a1 as vi,a2 as _i,a3 as bi,a4 as wi,a5 as Al,a6 as Ul,a7 as Wl,a8 as ki,a9 as Nl,aa as Il,ab as yi,ac as Ci,ad as Mi}from"./vendor.32016365.js";const Ti=function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))l(s);new MutationObserver(s=>{for(const o of s)if(o.type==="childList")for(const c of o.addedNodes)c.tagName==="LINK"&&c.rel==="modulepreload"&&l(c)}).observe(document,{childList:!0,subtree:!0});function i(s){const o={};return s.integrity&&(o.integrity=s.integrity),s.referrerpolicy&&(o.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?o.credentials="include":s.crossorigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function l(s){if(s.ep)return;s.ep=!0;const o=i(s);fetch(s.href,o)}};Ti();function Si(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_,T,C,P,W,A;return{c(){t=a("h1"),t.textContent="Welcome",i=g(),l=a("p"),l.textContent="Tauri's API capabilities using the ` @tauri-apps/api ` package. It's used as\n the main validation app, serving as the testbed of our development process. In\n the future, this app will be used on Tauri's integration tests.",s=g(),o=a("p"),c=M("Current App version: "),r=M(n[0]),m=g(),h=a("p"),w=M("Current Tauri version: "),v=M(n[1]),d=g(),p=a("p"),f=M("Current App name: "),k=M(n[2]),_=g(),T=a("button"),T.textContent="Close application",C=g(),P=a("button"),P.textContent="Relaunch application",u(T,"class","button"),u(P,"class","button")},m(E,I){S(E,t,I),S(E,i,I),S(E,l,I),S(E,s,I),S(E,o,I),e(o,c),e(o,r),S(E,m,I),S(E,h,I),e(h,w),e(h,v),S(E,d,I),S(E,p,I),e(p,f),e(p,k),S(E,_,I),S(E,T,I),S(E,C,I),S(E,P,I),W||(A=[y(T,"click",n[3]),y(P,"click",n[4])],W=!0)},p(E,[I]){I&1&&R(r,E[0]),I&2&&R(v,E[1]),I&4&&R(k,E[2])},i:N,o:N,d(E){E&&L(t),E&&L(i),E&&L(l),E&&L(s),E&&L(o),E&&L(m),E&&L(h),E&&L(d),E&&L(p),E&&L(_),E&&L(T),E&&L(C),E&&L(P),W=!1,Y(A)}}}function Li(n,t,i){let l=0,s=0,o="Unknown";ei().then(m=>{i(2,o=m)}),ti().then(m=>{i(0,l=m)}),ni().then(m=>{i(1,s=m)});async function c(){await li()}async function r(){await bl()}return[l,s,o,c,r]}class Ei extends G{constructor(t){super();V(this,t,Li,Si,J,{})}}function zi(n){let t,i,l,s,o,c,r,m,h,w,v;return{c(){t=a("div"),i=M(`This binary can be run on the terminal and takes the following arguments: - `),l=a("ul"),l.innerHTML=`
  • --config PATH
  • -
  • --theme light|dark|system
  • -
  • --verbose
  • `,s=M(` - Additionally, it has a `),o=a("i"),o.textContent="update --background",c=M(` subcommand. - Note that the arguments are only parsed, not implemented. - `),r=a("br"),m=g(),h=a("button"),h.textContent="Get matches",u(h,"class","button"),u(h,"id","cli-matches")},m(d,p){S(d,t,p),e(t,i),e(t,l),e(t,s),e(t,o),e(t,c),e(t,r),e(t,m),e(t,h),w||(v=y(h,"click",n[0]),w=!0)},p:N,i:N,o:N,d(d){d&&L(t),w=!1,v()}}}function Oi(n,t,i){let{onMessage:l}=t;function s(){ii().then(l).catch(l)}return n.$$set=o=>{"onMessage"in o&&i(1,l=o.onMessage)},[s,l]}class Pi extends G{constructor(t){super();V(this,t,Oi,zi,J,{onMessage:1})}}function Ai(n){let t,i,l,s,o,c,r,m;return{c(){t=a("div"),i=a("button"),i.textContent="Call Log API",l=g(),s=a("button"),s.textContent="Call Request (async) API",o=g(),c=a("button"),c.textContent="Send event to Rust",u(i,"class","button"),u(i,"id","log"),u(s,"class","button"),u(s,"id","request"),u(c,"class","button"),u(c,"id","event")},m(h,w){S(h,t,w),e(t,i),e(t,l),e(t,s),e(t,o),e(t,c),r||(m=[y(i,"click",n[0]),y(s,"click",n[1]),y(c,"click",n[2])],r=!0)},p:N,i:N,o:N,d(h){h&&L(t),r=!1,Y(m)}}}function Ui(n,t,i){let{onMessage:l}=t,s;it(async()=>{s=await wl("rust-event",l)}),gn(()=>{s&&s()});function o(){mn("log_operation",{event:"tauri-click",payload:"this payload is optional because we used Option in Rust"})}function c(){mn("perform_request",{endpoint:"dummy endpoint arg",body:{id:5,name:"test"}}).then(l).catch(l)}function r(){si("js-event","this is the payload string")}return n.$$set=m=>{"onMessage"in m&&i(3,l=m.onMessage)},[o,c,r,l]}class Wi extends G{constructor(t){super();V(this,t,Ui,Ai,J,{onMessage:3})}}function Ni(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_,T,C,P,W;return{c(){t=a("div"),i=a("input"),l=g(),s=a("input"),o=g(),c=a("div"),r=a("input"),m=g(),h=a("label"),h.textContent="Multiple",w=g(),v=a("div"),d=a("input"),p=g(),f=a("label"),f.textContent="Directory",k=g(),_=a("button"),_.textContent="Open dialog",T=g(),C=a("button"),C.textContent="Open save dialog",u(i,"id","dialog-default-path"),u(i,"placeholder","Default path"),u(s,"id","dialog-filter"),u(s,"placeholder","Extensions filter, comma-separated"),u(s,"class","svelte-1eg58yg"),u(r,"type","checkbox"),u(r,"id","dialog-multiple"),u(h,"for","dialog-multiple"),u(d,"type","checkbox"),u(d,"id","dialog-directory"),u(f,"for","dialog-directory"),u(_,"class","button"),u(_,"id","open-dialog"),u(C,"class","button"),u(C,"id","save-dialog")},m(A,E){S(A,t,E),e(t,i),O(i,n[0]),e(t,l),e(t,s),O(s,n[1]),e(t,o),e(t,c),e(c,r),r.checked=n[2],e(c,m),e(c,h),e(t,w),e(t,v),e(v,d),d.checked=n[3],e(v,p),e(v,f),e(t,k),e(t,_),e(t,T),e(t,C),P||(W=[y(i,"input",n[7]),y(s,"input",n[8]),y(r,"change",n[9]),y(d,"change",n[10]),y(_,"click",n[4]),y(C,"click",n[5])],P=!0)},p(A,[E]){E&1&&i.value!==A[0]&&O(i,A[0]),E&2&&s.value!==A[1]&&O(s,A[1]),E&4&&(r.checked=A[2]),E&8&&(d.checked=A[3])},i:N,o:N,d(A){A&&L(t),P=!1,Y(W)}}}function Ii(n,t){var i=new Blob([n],{type:"application/octet-binary"}),l=new FileReader;l.onload=function(s){var o=s.target.result;t(o.substr(o.indexOf(",")+1))},l.readAsDataURL(i)}function qi(n,t,i){let{onMessage:l}=t,s=null,o=null,c=!1,r=!1;function m(){kl({defaultPath:s,filters:o?[{name:"Tauri Example",extensions:o.split(",").map(f=>f.trim())}]:[],multiple:c,directory:r}).then(function(f){if(Array.isArray(f))l(f);else{var k=f,_=k.match(/\S+\.\S+$/g);yl(k).then(function(T){_&&(k.includes(".png")||k.includes(".jpg"))?Ii(new Uint8Array(T),function(C){var P="data:image/png;base64,"+C;l('')}):l(f)}).catch(l(f))}}).catch(l)}function h(){oi({defaultPath:s,filters:o?[{name:"Tauri Example",extensions:o.split(",").map(f=>f.trim())}]:[]}).then(l).catch(l)}function w(){s=this.value,i(0,s)}function v(){o=this.value,i(1,o)}function d(){c=this.checked,i(2,c)}function p(){r=this.checked,i(3,r)}return n.$$set=f=>{"onMessage"in f&&i(6,l=f.onMessage)},[s,o,c,r,m,h,l,w,v,d,p]}class Hi extends G{constructor(t){super();V(this,t,qi,Ni,J,{onMessage:6})}}function ql(n,t,i){const l=n.slice();return l[8]=t[i],l}function Hl(n){let t,i=n[8][0]+"",l,s;return{c(){t=a("option"),l=M(i),t.__value=s=n[8][1],t.value=t.__value},m(o,c){S(o,t,c),e(t,l)},p:N,d(o){o&&L(t)}}}function Ri(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f=n[2],k=[];for(let _=0;_isNaN(parseInt(v))).map(v=>[v,Cl[v]]);function r(){const v=s.match(/\S+\.\S+$/g),d={dir:Rl()};(v?yl(s,d):ai(s,d)).then(function(f){if(v)if(s.includes(".png")||s.includes(".jpg"))Di(new Uint8Array(f),function(k){const _="data:image/png;base64,"+k;l('')});else{const k=String.fromCharCode.apply(null,f);l(''),setTimeout(()=>{const _=document.getElementById("file-response");_.value=k,document.getElementById("file-save").addEventListener("click",function(){writeFile({file:s,contents:_.value},{dir:Rl()}).catch(l)})})}else l(f)}).catch(l)}function m(){i(1,o.src=ui(s),o)}function h(){s=this.value,i(0,s)}function w(v){ri[v?"unshift":"push"](()=>{o=v,i(1,o)})}return n.$$set=v=>{"onMessage"in v&&i(5,l=v.onMessage)},[s,o,c,r,m,l,h,w]}class Bi extends G{constructor(t){super();V(this,t,ji,Ri,J,{onMessage:5})}}function Fi(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_,T;return{c(){t=a("form"),i=a("select"),l=a("option"),l.textContent="GET",s=a("option"),s.textContent="POST",o=a("option"),o.textContent="PUT",c=a("option"),c.textContent="PATCH",r=a("option"),r.textContent="DELETE",m=g(),h=a("input"),w=g(),v=a("br"),d=g(),p=a("textarea"),f=g(),k=a("button"),k.textContent="Make request",l.__value="GET",l.value=l.__value,s.__value="POST",s.value=s.__value,o.__value="PUT",o.value=o.__value,c.__value="PATCH",c.value=c.__value,r.__value="DELETE",r.value=r.__value,u(i,"class","button"),u(i,"id","request-method"),n[0]===void 0&&Ml(()=>n[5].call(i)),u(h,"id","request-url"),u(h,"placeholder","Type the request URL..."),u(p,"id","request-body"),u(p,"placeholder","Request body"),u(p,"rows","5"),ae(p,"width","100%"),ae(p,"margin-right","10px"),ae(p,"font-size","12px"),u(k,"class","button"),u(k,"id","make-request")},m(C,P){S(C,t,P),e(t,i),e(i,l),e(i,s),e(i,o),e(i,c),e(i,r),qt(i,n[0]),e(t,m),e(t,h),O(h,n[1]),e(t,w),e(t,v),e(t,d),e(t,p),O(p,n[2]),e(t,f),e(t,k),_||(T=[y(i,"change",n[5]),y(h,"input",n[6]),y(p,"input",n[7]),y(t,"submit",Nt(n[3]))],_=!0)},p(C,[P]){P&1&&qt(i,C[0]),P&2&&h.value!==C[1]&&O(h,C[1]),P&4&&O(p,C[2])},i:N,o:N,d(C){C&&L(t),_=!1,Y(T)}}}function Gi(n,t,i){let l="GET",s="https://jsonplaceholder.typicode.com/todos/1",o="",{onMessage:c}=t;async function r(){const v=await ci(),f={url:s||""||"",method:l||"GET"||"GET"};o.startsWith("{")&&o.endsWith("}")||o.startsWith("[")&&o.endsWith("]")?f.body=Tl.json(JSON.parse(o)):o!==""&&(f.body=Tl.text(o)),v.request(f).then(c).catch(c)}function m(){l=Sl(this),i(0,l)}function h(){s=this.value,i(1,s)}function w(){o=this.value,i(2,o)}return n.$$set=v=>{"onMessage"in v&&i(4,c=v.onMessage)},[l,s,o,r,c,m,h,w]}class Vi extends G{constructor(t){super();V(this,t,Gi,Fi,J,{onMessage:4})}}function Ji(n){let t,i,l;return{c(){t=a("button"),t.textContent="Send test notification",u(t,"class","button"),u(t,"id","notification")},m(s,o){S(s,t,o),i||(l=y(t,"click",n[0]),i=!0)},p:N,i:N,o:N,d(s){s&&L(t),i=!1,l()}}}function Dl(){new Notification("Notification title",{body:"This is the notification body"})}function Ki(n,t,i){let{onMessage:l}=t;function s(){Notification.permission==="default"?Notification.requestPermission().then(function(o){o==="granted"?Dl():l("Permission is "+o)}).catch(l):Notification.permission==="granted"?Dl():l("Permission is denied")}return n.$$set=o=>{"onMessage"in o&&i(1,l=o.onMessage)},[s,l]}class Xi extends G{constructor(t){super();V(this,t,Ki,Ji,J,{onMessage:1})}}function jl(n,t,i){const l=n.slice();return l[54]=t[i],l}function Bl(n){let t,i=n[54]+"",l,s;return{c(){t=a("option"),l=M(i),t.__value=s=n[54],t.value=t.__value},m(o,c){S(o,t,c),e(t,l)},p(o,c){c[0]&2&&i!==(i=o[54]+"")&&R(l,i),c[0]&2&&s!==(s=o[54])&&(t.__value=s,t.value=t.__value)},d(o){o&&L(t)}}}function Yi(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_,T,C,P,W,A,E,I,j,D,X,Z,U,ne,H,ie,ue,st,ot,Le,at,Re,Q,re,Ee,ut,$,rt,ze,ct,x,pt,ce,Oe,dt,ee,ft,Pe,ht,te,gt,q,Ce,bn,pe,wn,mt,kn,de,yn,Ae,vt,Cn,se,Mn,_t,Tn,oe,Ht,le,Ue,fe,Rt,Sn,De,Ln,bt=n[20].width+"",Dt,En,je,zn,wt=n[20].height+"",jt,On,he,Bt,Pn,Be,An,kt=n[21].width+"",Ft,Un,Fe,Wn,yt=n[21].height+"",Gt,Nn,We,ge,Vt,In,Ge,qn,Ct=n[20].toLogical(n[17]).width+"",Jt,Hn,Ve,Rn,Mt=n[20].toLogical(n[17]).height+"",Kt,Dn,me,Xt,jn,Je,Bn,Tt=n[21].toLogical(n[17]).width+"",Yt,Fn,Ke,Gn,St=n[21].toLogical(n[17]).height+"",Qt,Vn,Ne,ve,Zt,Jn,Xe,Kn,Lt=n[18].x+"",$t,Xn,Ye,Yn,Et=n[18].y+"",xt,Qn,_e,en,Zn,Qe,$n,zt=n[19].x+"",tn,xn,Ze,el,Ot=n[19].y+"",nn,tl,Ie,be,ln,nl,$e,ll,Pt=n[18].toLogical(n[17]).x+"",sn,il,xe,sl,At=n[18].toLogical(n[17]).y+"",on,ol,we,an,al,et,ul,Ut=n[19].toLogical(n[17]).x+"",un,rl,tt,cl,Wt=n[19].toLogical(n[17]).y+"",rn,cn,ke,Me,pl,nt,pn,ye,Te,dl,lt,dn,Se,fn,qe,hn,fl,He=Object.keys(n[1]),K=[];for(let b=0;bn[31].call(i)),u(c,"type","checkbox"),u(w,"type","checkbox"),u(p,"title","Unminimizes after 2 seconds"),u(k,"title","Unminimizes after 2 seconds"),u(T,"title","Visible again after 2 seconds"),u(W,"type","checkbox"),u(j,"type","checkbox"),u(U,"type","checkbox"),u(ue,"type","checkbox"),u($,"type","number"),u($,"min","0"),u($,"class","svelte-12ggtr4"),u(x,"type","number"),u(x,"min","0"),u(x,"class","svelte-12ggtr4"),u(re,"class","flex col grow svelte-12ggtr4"),u(ee,"type","number"),u(ee,"min","400"),u(ee,"class","svelte-12ggtr4"),u(te,"type","number"),u(te,"min","400"),u(te,"class","svelte-12ggtr4"),u(ce,"class","flex col grow svelte-12ggtr4"),u(pe,"type","number"),u(pe,"class","svelte-12ggtr4"),u(de,"type","number"),u(de,"class","svelte-12ggtr4"),u(q,"class","flex col grow svelte-12ggtr4"),u(se,"type","number"),u(se,"min","400"),u(se,"class","svelte-12ggtr4"),u(oe,"type","number"),u(oe,"min","400"),u(oe,"class","svelte-12ggtr4"),u(Ae,"class","flex col grow svelte-12ggtr4"),u(Q,"class","window-controls flex flex-row svelte-12ggtr4"),u(t,"class","flex col"),u(De,"class","svelte-12ggtr4"),u(je,"class","svelte-12ggtr4"),u(fe,"class","grow window-property svelte-12ggtr4"),u(Be,"class","svelte-12ggtr4"),u(Fe,"class","svelte-12ggtr4"),u(he,"class","grow window-property svelte-12ggtr4"),u(Ue,"class","flex"),u(Ge,"class","svelte-12ggtr4"),u(Ve,"class","svelte-12ggtr4"),u(ge,"class","grow window-property svelte-12ggtr4"),u(Je,"class","svelte-12ggtr4"),u(Ke,"class","svelte-12ggtr4"),u(me,"class","grow window-property svelte-12ggtr4"),u(We,"class","flex"),u(Xe,"class","svelte-12ggtr4"),u(Ye,"class","svelte-12ggtr4"),u(ve,"class","grow window-property svelte-12ggtr4"),u(Qe,"class","svelte-12ggtr4"),u(Ze,"class","svelte-12ggtr4"),u(_e,"class","grow window-property svelte-12ggtr4"),u(Ne,"class","flex"),u($e,"class","svelte-12ggtr4"),u(xe,"class","svelte-12ggtr4"),u(be,"class","grow window-property svelte-12ggtr4"),u(et,"class","svelte-12ggtr4"),u(tt,"class","svelte-12ggtr4"),u(we,"class","grow window-property svelte-12ggtr4"),u(Ie,"class","flex"),u(Me,"id","title"),u(nt,"class","button"),u(nt,"type","submit"),ae(ke,"margin-top","24px"),u(Te,"id","url"),u(lt,"class","button"),u(lt,"id","open-url"),ae(ye,"margin-top","24px"),u(Se,"class","button"),u(Se,"title","Minimizes the window, requests attention for 3s and then resets it"),u(qe,"class","button")},m(b,z){S(b,t,z),e(t,i);for(let B=0;B{i(20,j=q),i(7,p=j.width),i(8,f=j.height)}),s[l].outerSize().then(q=>{i(21,D=q)})}function at(){s[l].innerPosition().then(q=>{i(18,E=q)}),s[l].outerPosition().then(q=>{i(19,I=q),i(13,P=I.x),i(14,W=I.y)})}async function Re(q){X&&X(),Z&&Z(),Z=await q.listen("tauri://move",at),X=await q.listen("tauri://resize",Le)}async function Q(){await s[l].minimize(),await s[l].requestUserAttention(Ll.Critical),await new Promise(q=>setTimeout(q,3e3)),await s[l].requestUserAttention(null)}function re(){l=Sl(this),i(0,l),i(1,s)}function Ee(){r=this.checked,i(2,r)}function ut(){m=this.checked,i(3,m)}const $=()=>s[l].center();function rt(){h=this.checked,i(16,h)}function ze(){w=this.checked,i(4,w)}function ct(){v=this.checked,i(5,v)}function x(){d=this.checked,i(6,d)}function pt(){P=F(this.value),i(13,P)}function ce(){W=F(this.value),i(14,W)}function Oe(){p=F(this.value),i(7,p)}function dt(){f=F(this.value),i(8,f)}function ee(){k=F(this.value),i(9,k)}function ft(){_=F(this.value),i(10,_)}function Pe(){T=F(this.value),i(11,T)}function ht(){C=F(this.value),i(12,C)}function te(){U=this.value,i(22,U)}function gt(){c=this.value,i(15,c)}return n.$$set=q=>{"onMessage"in q&&i(30,o=q.onMessage)},n.$$.update=()=>{n.$$.dirty[0]&7&&s[l].setResizable(r),n.$$.dirty[0]&11&&(m?s[l].maximize():s[l].unmaximize()),n.$$.dirty[0]&19&&s[l].setDecorations(w),n.$$.dirty[0]&35&&s[l].setAlwaysOnTop(v),n.$$.dirty[0]&67&&s[l].setFullscreen(d),n.$$.dirty[0]&387&&s[l].setSize(new _n(p,f)),n.$$.dirty[0]&1539&&(k&&_?s[l].setMinSize(new zl(k,_)):s[l].setMinSize(null)),n.$$.dirty[0]&6147&&(T&&C?s[l].setMaxSize(new zl(T,C)):s[l].setMaxSize(null)),n.$$.dirty[0]&24579&&s[l].setPosition(new vn(P,W)),n.$$.dirty[0]&3&&s[l].scaleFactor().then(q=>i(17,A=q)),n.$$.dirty[0]&3&&Re(s[l])},[l,s,r,m,w,v,d,p,f,k,_,T,C,P,W,c,h,A,E,I,j,D,U,ne,H,ie,ue,st,ot,Q,o,re,Ee,ut,$,rt,ze,ct,x,pt,ce,Oe,dt,ee,ft,Pe,ht,te,gt]}class Zi extends G{constructor(t){super();V(this,t,Qi,Yi,J,{onMessage:30},[-1,-1])}}function Fl(n,t,i){const l=n.slice();return l[9]=t[i],l}function Gl(n){let t,i=n[9]+"",l,s,o,c,r;function m(){return n[8](n[9])}return{c(){t=a("div"),l=M(i),s=g(),o=a("button"),o.textContent="Unregister",u(o,"type","button")},m(h,w){S(h,t,w),e(t,l),e(t,s),e(t,o),c||(r=y(o,"click",m),c=!0)},p(h,w){n=h,w&2&&i!==(i=n[9]+"")&&R(l,i)},d(h){h&&L(t),c=!1,r()}}}function Vl(n){let t,i,l;return{c(){t=a("button"),t.textContent="Unregister all",u(t,"type","button")},m(s,o){S(s,t,o),i||(l=y(t,"click",n[5]),i=!0)},p:N,d(s){s&&L(t),i=!1,l()}}}function $i(n){let t,i,l,s,o,c,r,m,h,w,v=n[1],d=[];for(let f=0;fi(1,l=d));let c="CmdOrControl+X";function r(){const d=c;fi(d,()=>{s(`Shortcut ${d} triggered`)}).then(()=>{o.update(p=>[...p,d]),s(`Shortcut ${d} registered successfully`)}).catch(s)}function m(d){const p=d;hi(p).then(()=>{o.update(f=>f.filter(k=>k!==p)),s(`Shortcut ${p} unregistered`)}).catch(s)}function h(){gi().then(()=>{o.update(()=>[]),s("Unregistered all shortcuts")}).catch(s)}function w(){c=this.value,i(0,c)}const v=d=>m(d);return n.$$set=d=>{"onMessage"in d&&i(6,s=d.onMessage)},[c,l,o,r,m,h,s,w,v]}class es extends G{constructor(t){super();V(this,t,xi,$i,J,{onMessage:6})}}function Jl(n){let t,i,l,s,o;return{c(){t=a("input"),i=g(),l=a("button"),l.textContent="Write",u(t,"placeholder","write to stdin"),u(l,"class","button")},m(c,r){S(c,t,r),O(t,n[3]),S(c,i,r),S(c,l,r),s||(o=[y(t,"input",n[10]),y(l,"click",n[7])],s=!0)},p(c,r){r&8&&t.value!==c[3]&&O(t,c[3])},d(c){c&&L(t),c&&L(i),c&&L(l),s=!1,Y(o)}}}function ts(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_=n[4]&&Jl(n);return{c(){t=a("div"),i=a("div"),l=a("input"),s=g(),o=a("button"),o.textContent="Run",c=g(),r=a("button"),r.textContent="Kill",m=g(),_&&_.c(),h=g(),w=a("div"),v=a("input"),d=g(),p=a("input"),u(o,"class","button"),u(r,"class","button"),u(v,"placeholder","Working directory"),u(p,"placeholder","Environment variables"),ae(p,"width","300px")},m(T,C){S(T,t,C),e(t,i),e(i,l),O(l,n[0]),e(i,s),e(i,o),e(i,c),e(i,r),e(i,m),_&&_.m(i,null),e(t,h),e(t,w),e(w,v),O(v,n[1]),e(w,d),e(w,p),O(p,n[2]),f||(k=[y(l,"input",n[9]),y(o,"click",n[5]),y(r,"click",n[6]),y(v,"input",n[11]),y(p,"input",n[12])],f=!0)},p(T,[C]){C&1&&l.value!==T[0]&&O(l,T[0]),T[4]?_?_.p(T,C):(_=Jl(T),_.c(),_.m(i,null)):_&&(_.d(1),_=null),C&2&&v.value!==T[1]&&O(v,T[1]),C&4&&p.value!==T[2]&&O(p,T[2])},i:N,o:N,d(T){T&&L(t),_&&_.d(),f=!1,Y(k)}}}function ns(n,t,i){const l=navigator.userAgent.includes("Windows");let s=l?"cmd":"sh",o=l?["/C"]:["-c"],{onMessage:c}=t,r='echo "hello world"',m=null,h="SOMETHING=value ANOTHER=2",w="",v;function d(){return h.split(" ").reduce((W,A)=>{let[E,I]=A.split("=");return _l(vl({},W),{[E]:I})},{})}function p(){i(4,v=null);const W=new mi(s,[...o,r],{cwd:m||null,env:d()});W.on("close",A=>{c(`command finished with code ${A.code} and signal ${A.signal}`),i(4,v=null)}),W.on("error",A=>c(`command error: "${A}"`)),W.stdout.on("data",A=>c(`command stdout: "${A}"`)),W.stderr.on("data",A=>c(`command stderr: "${A}"`)),W.spawn().then(A=>{i(4,v=A)}).catch(c)}function f(){v.kill().then(()=>c("killed child process")).catch(c)}function k(){v.write(w).catch(c)}function _(){r=this.value,i(0,r)}function T(){w=this.value,i(3,w)}function C(){m=this.value,i(1,m)}function P(){h=this.value,i(2,h)}return n.$$set=W=>{"onMessage"in W&&i(8,c=W.onMessage)},[r,m,h,w,v,p,f,k,c,_,T,C,P]}class ls extends G{constructor(t){super();V(this,t,ns,ts,J,{onMessage:8})}}function is(n){let t,i,l,s,o,c;return{c(){t=a("div"),i=a("button"),i.textContent="Check update",l=g(),s=a("button"),s.textContent="Install update",u(i,"class","button"),u(i,"id","check_update"),u(s,"class","button hidden"),u(s,"id","start_update")},m(r,m){S(r,t,m),e(t,i),e(t,l),e(t,s),o||(c=[y(i,"click",n[0]),y(s,"click",n[1])],o=!0)},p:N,i:N,o:N,d(r){r&&L(t),o=!1,Y(c)}}}function ss(n,t,i){let{onMessage:l}=t,s;it(async()=>{s=await wl("tauri://update-status",l)}),gn(()=>{s&&s()});async function o(){try{document.getElementById("check_update").classList.add("hidden");const{shouldUpdate:r,manifest:m}=await vi();l(`Should update: ${r}`),l(m),r&&document.getElementById("start_update").classList.remove("hidden")}catch(r){l(r)}}async function c(){try{document.getElementById("start_update").classList.add("hidden"),await _i(),l("Installation complete, restart required."),await bl()}catch(r){l(r)}}return n.$$set=r=>{"onMessage"in r&&i(2,l=r.onMessage)},[o,c,l]}class os extends G{constructor(t){super();V(this,t,ss,is,J,{onMessage:2})}}function as(n){let t,i,l,s,o,c,r,m,h;return{c(){t=a("div"),i=a("div"),l=a("input"),s=g(),o=a("button"),o.textContent="Write",c=g(),r=a("button"),r.textContent="Read",u(l,"placeholder","Text to write to the clipboard"),u(o,"type","button"),u(r,"type","button")},m(w,v){S(w,t,v),e(t,i),e(i,l),O(l,n[0]),e(i,s),e(i,o),e(t,c),e(t,r),m||(h=[y(l,"input",n[4]),y(o,"click",n[1]),y(r,"click",n[2])],m=!0)},p(w,[v]){v&1&&l.value!==w[0]&&O(l,w[0])},i:N,o:N,d(w){w&&L(t),m=!1,Y(h)}}}function us(n,t,i){let{onMessage:l}=t,s="clipboard message";function o(){bi(s).then(()=>{l("Wrote to the clipboard")}).catch(l)}function c(){wi().then(m=>{l(`Clipboard contents: ${m}`)}).catch(l)}function r(){s=this.value,i(0,s)}return n.$$set=m=>{"onMessage"in m&&i(3,l=m.onMessage)},[s,o,c,l,r]}class rs extends G{constructor(t){super();V(this,t,us,as,J,{onMessage:3})}}function cs(n){let t;return{c(){t=a("div"),t.innerHTML=`

    Not available for Linux

    - `},m(i,l){S(i,t,l)},p:N,i:N,o:N,d(i){i&&L(t)}}}function ps(n,t,i){let{onMessage:l}=t;const s=window.constraints={audio:!0,video:!0};function o(r){const m=document.querySelector("video"),h=r.getVideoTracks();l("Got stream with constraints:",s),l(`Using video device: ${h[0].label}`),window.stream=r,m.srcObject=r}function c(r){if(r.name==="ConstraintNotSatisfiedError"){const m=s.video;l(`The resolution ${m.width.exact}x${m.height.exact} px is not supported by your device.`)}else r.name==="PermissionDeniedError"&&l("Permissions have not been granted to use your camera and microphone, you need to allow the page access to your devices in order for the demo to work.");l(`getUserMedia error: ${r.name}`,r)}return it(async()=>{try{const r=await navigator.mediaDevices.getUserMedia(s);o(r)}catch(r){c(r)}}),gn(()=>{window.stream.getTracks().forEach(function(r){r.stop()})}),n.$$set=r=>{"onMessage"in r&&i(0,l=r.onMessage)},[l]}class ds extends G{constructor(t){super();V(this,t,ps,cs,J,{onMessage:0})}}function fs(n){let t,i,l,s,o,c,r,m,h,w,v,d;return{c(){t=a("input"),i=g(),l=a("input"),s=g(),o=a("button"),o.textContent="Post it.",c=g(),r=a("p"),r.textContent="Result:",m=g(),h=a("pre"),w=M(n[2]),u(o,"type","button")},m(p,f){S(p,t,f),O(t,n[0]),S(p,i,f),S(p,l,f),O(l,n[1]),S(p,s,f),S(p,o,f),S(p,c,f),S(p,r,f),S(p,m,f),S(p,h,f),e(h,w),v||(d=[y(t,"input",n[4]),y(l,"input",n[5]),y(o,"click",n[3])],v=!0)},p(p,[f]){f&1&&t.value!==p[0]&&O(t,p[0]),f&2&&l.value!==p[1]&&O(l,p[1]),f&4&&R(w,p[2])},i:N,o:N,d(p){p&&L(t),p&&L(i),p&&L(l),p&&L(s),p&&L(o),p&&L(c),p&&L(r),p&&L(m),p&&L(h),v=!1,Y(d)}}}function hs(n,t,i){let l="baz",s="qux",o=null;async function c(){let h=navigator.userAgent.includes("Windows")?"https://customprotocol.test/example.html":"customprotocol://test/example.html";const v=await(await fetch(h,{method:"POST",body:JSON.stringify({foo:l,bar:s})})).json();i(2,o=JSON.stringify(v))}function r(){l=this.value,i(0,l)}function m(){s=this.value,i(1,s)}return[l,s,o,c,r,m]}class gs extends G{constructor(t){super();V(this,t,hs,fs,J,{})}}function Kl(n,t,i){const l=n.slice();return l[9]=t[i],l}function Xl(n){let t,i=n[9].label+"",l,s,o,c,r;function m(){return n[7](n[9])}return{c(){t=a("p"),l=M(i),s=g(),u(t,"class",o="nv noselect "+(n[0]===n[9]?"nv_selected":""))},m(h,w){S(h,t,w),e(t,l),e(t,s),c||(r=y(t,"click",m),c=!0)},p(h,w){n=h,w&1&&o!==(o="nv noselect "+(n[0]===n[9]?"nv_selected":""))&&u(t,"class",o)},d(h){h&&L(t),c=!1,r()}}}function ms(n){let t,i,l,s,o,c,r,m,h,w,v,d,p,f,k,_,T,C,P,W,A,E,I,j=n[2],D=[];for(let U=0;UDocumentation - Github - Source`,r=g(),m=a("div"),h=a("div");for(let U=0;U{Il(H,1)}),ki()}X?(d=new X(Z(U)),Al(d.$$.fragment),Nl(d.$$.fragment,1),Ul(d,v,null)):d=null}(!A||ne&2)&&W.p(U[1])},i(U){A||(d&&Nl(d.$$.fragment,U),A=!0)},o(U){d&&Wl(d.$$.fragment,U),A=!1},d(U){U&&L(t),It(D,U),d&&Il(d),E=!1,Y(I)}}}const vs="ctrl+b";function _s(n,t,i){it(()=>{Mi(vs,()=>{mn("menu_toggle")})});const l=[{label:"Welcome",component:Ei},{label:"Messages",component:Wi},{label:"CLI",component:Pi},{label:"Dialog",component:Hi},{label:"File system",component:Bi},{label:"HTTP",component:Vi},{label:"HTTP Form",component:gs},{label:"Notifications",component:Xi},{label:"Window",component:Zi},{label:"Shortcuts",component:es},{label:"Shell",component:ls},{label:"Updater",component:os},{label:"Clipboard",component:rs},{label:"WebRTC",component:ds}];let s=l[0],o=Pl([]),c="";function r(d){i(0,s=d)}function m(d){o.update(p=>[`[${new Date().toLocaleTimeString()}]: `+(typeof d=="string"?d:JSON.stringify(d)),...p])}function h(){Ol("https://tauri.studio/")}return it(()=>{o.subscribe(d=>{i(1,c=d.join(` -`))})}),[s,c,l,o,r,m,h,d=>r(d),()=>{o.update(()=>[])}]}class bs extends G{constructor(t){super();V(this,t,_s,ms,J,{})}}new bs({target:document.body}); diff --git a/examples/api/dist/assets/vendor.32016365.js b/examples/api/dist/assets/vendor.32016365.js deleted file mode 100644 index 50e024d49..000000000 --- a/examples/api/dist/assets/vendor.32016365.js +++ /dev/null @@ -1,24 +0,0 @@ -function P(){}function rt(t){return t()}function ot(){return Object.create(null)}function z(t){t.forEach(rt)}function kt(t){return typeof t=="function"}function Dt(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function Lt(t){return Object.keys(t).length===0}function Ft(t,...e){if(t==null)return P;const n=t.subscribe(...e);return n.unsubscribe?()=>n.unsubscribe():n}function Ie(t,e,n){t.$$.on_destroy.push(Ft(e,n))}function Ge(t,e){t.appendChild(e)}function Kt(t,e,n){t.insertBefore(e,n||null)}function ut(t){t.parentNode.removeChild(t)}function Je(t,e){for(let n=0;nt.removeEventListener(e,n,i)}function Qe(t){return function(e){return e.preventDefault(),t.call(this,e)}}function Ze(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function tn(t){return t===""?null:+t}function Bt(t){return Array.from(t.childNodes)}function en(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function nn(t,e){t.value=e==null?"":e}function rn(t,e,n,i){t.style.setProperty(e,n,i?"important":"")}function on(t,e){for(let n=0;n{D.delete(t),i&&(n&&t.d(1),i())}),t.o(e)}}function hn(t){t&&t.c()}function It(t,e,n,i){const{fragment:r,on_mount:o,on_destroy:c,after_update:f}=t.$$;r&&r.m(e,n),i||N(()=>{const d=o.map(rt).filter(kt);c?c.push(...d):z(d),t.$$.on_mount=[]}),f.forEach(N)}function Gt(t,e){const n=t.$$;n.fragment!==null&&(z(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function Jt(t,e){t.$$.dirty[0]===-1&&(E.push(t),qt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const g=_.length?_[0]:v;return d.ctx&&r(d.ctx[l],d.ctx[l]=g)&&(!d.skip_bound&&d.bound[l]&&d.bound[l](g),h&&Jt(t,l)),v}):[],d.update(),h=!0,z(d.before_update),d.fragment=i?i(d.ctx):!1,e.target){if(e.hydrate){const l=Bt(e.target);d.fragment&&d.fragment.l(l),l.forEach(ut)}else d.fragment&&d.fragment.c();e.intro&&Ht(t.$$.fragment),It(t,e.target,e.anchor,e.customElement),lt()}C(f)}class mn{$destroy(){Gt(this,1),this.$destroy=P}$on(e,n){const i=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return i.push(n),()=>{const r=i.indexOf(n);r!==-1&&i.splice(r,1)}}$set(e){this.$$set&&!Lt(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const S=[];function vn(t,e=P){let n;const i=[];function r(f){if(Dt(t,f)&&(t=f,n)){const d=!S.length;for(let h=0;h{const l=i.indexOf(h);l!==-1&&i.splice(l,1),i.length===0&&(n(),n=null)}}return{set:r,update:o,subscribe:c}}/*! - * hotkeys-js v3.8.5 - * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. - * - * Copyright (c) 2021 kenny wong - * http://jaywcjlove.github.io/hotkeys - * - * Licensed under the MIT license. - */var H=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function I(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),function(){n(window.event)})}function dt(t,e){for(var n=e.slice(0,e.length-1),i=0;i=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function Xt(t,e){for(var n=t.length>=e.length?t:e,i=t.length>=e.length?e:t,r=!0,o=0;o=0&&p.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&p.splice(0,p.length),(e===93||e===224)&&(e=91),e in y){y[e]=!1;for(var i in O)O[i]===e&&(M[i]=!1)}}function ne(t){if(!t)Object.keys(m).forEach(function(c){return delete m[c]});else if(Array.isArray(t))t.forEach(function(c){c.key&&G(c)});else if(typeof t=="object")t.key&&G(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),i=1;i1?dt(O,h):[];m[_]=m[_].map(function(b){var Ct=r?b.method===r:!0;return Ct&&b.scope===i&&Xt(b.mods,g)?{}:b})}})};function _t(t,e,n){var i;if(e.scope===n||e.scope==="all"){i=e.mods.length>0;for(var r in y)Object.prototype.hasOwnProperty.call(y,r)&&(!y[r]&&e.mods.indexOf(+r)>-1||y[r]&&e.mods.indexOf(+r)===-1)&&(i=!1);(e.mods.length===0&&!y[16]&&!y[18]&&!y[17]&&!y[91]||i||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function gt(t){var e=m["*"],n=t.keyCode||t.which||t.charCode;if(!!M.filter.call(this,t)){if((n===93||n===224)&&(n=91),p.indexOf(n)===-1&&n!==229&&p.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(g){var b=pt[g];t[g]&&p.indexOf(b)===-1?p.push(b):!t[g]&&p.indexOf(b)>-1?p.splice(p.indexOf(b),1):g==="metaKey"&&t[g]&&p.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(p=p.slice(p.indexOf(b))))}),n in y){y[n]=!0;for(var i in O)O[i]===n&&(M[i]=!0);if(!e)return}for(var r in y)Object.prototype.hasOwnProperty.call(y,r)&&(y[r]=t[pt[r]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(p.indexOf(17)===-1&&p.push(17),p.indexOf(18)===-1&&p.push(18),y[17]=!0,y[18]=!0);var o=T();if(e)for(var c=0;c-1}function M(t,e,n){p=[];var i=ft(t),r=[],o="all",c=document,f=0,d=!1,h=!0,l="+";for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(o=e.scope),e.element&&(c=e.element),e.keyup&&(d=e.keyup),e.keydown!==void 0&&(h=e.keydown),typeof e.splitKey=="string"&&(l=e.splitKey)),typeof e=="string"&&(o=e);f1&&(r=dt(O,t)),t=t[t.length-1],t=t==="*"?"*":F(t),t in m||(m[t]=[]),m[t].push({keyup:d,keydown:h,scope:o,mods:r,shortcut:i[f],method:n,key:i[f],splitKey:l});typeof c!="undefined"&&!ie(c)&&window&&(vt.push(c),I(c,"keydown",function(v){gt(v)}),I(window,"focus",function(){p=[]}),I(c,"keyup",function(v){gt(v),ee(v)}))}var J={setScope:yt,getScope:T,deleteScope:te,getPressedKeyCodes:Yt,isPressed:Zt,filter:Qt,unbind:ne};for(var X in J)Object.prototype.hasOwnProperty.call(J,X)&&(M[X]=J[X]);if(typeof window!="undefined"){var re=window.hotkeys;M.noConflict=function(t){return t&&window.hotkeys===M&&(window.hotkeys=re),M},window.hotkeys=M}/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */var bt=function(t,e){return(bt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var r in i)Object.prototype.hasOwnProperty.call(i,r)&&(n[r]=i[r])})(t,e)};function Y(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function n(){this.constructor=t}bt(t,e),t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var w=function(){return(w=Object.assign||function(t){for(var e,n=1,i=arguments.length;n0&&r[r.length-1])||l[0]!==6&&l[0]!==2)){c=0;continue}if(l[0]===3&&(!r||l[1]>r[0]&&l[1]=200&&this.status<300,this.headers=t.headers,this.data=t.data},Pt=function(){function t(e){this.id=e}return t.prototype.drop=function(){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"dropClient",client:this.id}})]})})},t.prototype.request=function(e){return u(this,void 0,void 0,function(){var n;return s(this,function(i){return(n=!e.responseType||e.responseType===A.JSON)&&(e.responseType=A.Text),[2,a({__tauriModule:"Http",message:{cmd:"httpRequest",client:this.id,options:e}}).then(function(r){var o=new $t(r);if(n){try{o.data=JSON.parse(o.data)}catch(c){if(o.ok&&o.data==="")o.data={};else if(o.ok)throw Error("Failed to parse response `".concat(o.data,"` as JSON: ").concat(c,";\n try setting the `responseType` option to `ResponseType.Text` or `ResponseType.Binary` if the API does not return a JSON response."))}return o}return o})]})})},t.prototype.get=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"GET",url:e},n))]})})},t.prototype.post=function(e,n,i){return u(this,void 0,void 0,function(){return s(this,function(r){return[2,this.request(w({method:"POST",url:e,body:n},i))]})})},t.prototype.put=function(e,n,i){return u(this,void 0,void 0,function(){return s(this,function(r){return[2,this.request(w({method:"PUT",url:e,body:n},i))]})})},t.prototype.patch=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"PATCH",url:e},n))]})})},t.prototype.delete=function(e,n){return u(this,void 0,void 0,function(){return s(this,function(i){return[2,this.request(w({method:"DELETE",url:e},n))]})})},t}();function St(t){return u(this,void 0,void 0,function(){return s(this,function(e){return[2,a({__tauriModule:"Http",message:{cmd:"createClient",options:t}}).then(function(n){return new Pt(n)})]})})}var et=null;function Ae(t,e){var n;return u(this,void 0,void 0,function(){return s(this,function(i){switch(i.label){case 0:return et!==null?[3,2]:[4,St()];case 1:et=i.sent(),i.label=2;case 2:return[2,et.request(w({url:t,method:(n=e==null?void 0:e.method)!==null&&n!==void 0?n:"GET"},e))]}})})}Object.freeze({__proto__:null,getClient:St,fetch:Ae,Body:je,Client:Pt,Response:$t,get ResponseType(){return A}});var R,zt=function(t,e){this.type="Logical",this.width=t,this.height=e},nt=function(){function t(e,n){this.type="Physical",this.width=e,this.height=n}return t.prototype.toLogical=function(e){return new zt(this.width/e,this.height/e)},t}(),Et=function(t,e){this.type="Logical",this.x=t,this.y=e},it=function(){function t(e,n){this.type="Physical",this.x=e,this.y=n}return t.prototype.toLogical=function(e){return new Et(this.x/e,this.y/e)},t}();function We(){return new U(window.__TAURI__.__currentWindow.label,{skip:!0})}function Tt(){return window.__TAURI__.__windows.map(function(t){return new U(t.label,{skip:!0})})}(function(t){t[t.Critical=1]="Critical",t[t.Informational=2]="Informational"})(R||(R={}));var jt=["tauri://created","tauri://error"],At=function(){function t(e){try{this.label=e!=null?e:window.__TAURI__.__currentWindow.label}catch{this.label=""}this.listeners=Object.create(null)}return t.prototype.listen=function(e,n){return u(this,void 0,void 0,function(){var i=this;return s(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,j(e,n)]})})},t.prototype.once=function(e,n){return u(this,void 0,void 0,function(){var i=this;return s(this,function(r){return this._handleTauriEvent(e,n)?[2,Promise.resolve(function(){var o=i.listeners[e];o.splice(o.indexOf(n),1)})]:[2,Z(e,n)]})})},t.prototype.emit=function(e,n){return u(this,void 0,void 0,function(){var i,r;return s(this,function(o){if(jt.includes(e)){for(i=0,r=this.listeners[e]||[];in.unsubscribe():n}function At(t,e,n){t.$$.on_destroy.push(at(e,n))}function St(t,e){t.appendChild(e)}function ut(t,e,n){t.insertBefore(e,n||null)}function F(t){t.parentNode.removeChild(t)}function jt(t,e){for(let n=0;nt.removeEventListener(e,n,r)}function Lt(t){return function(e){return e.preventDefault(),t.call(this,e)}}function Tt(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function Bt(t){return t===""?null:+t}function lt(t){return Array.from(t.childNodes)}function Dt(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Ht(t,e){t.value=e==null?"":e}function Nt(t,e,n,r){t.style.setProperty(e,n,r?"important":"")}function qt(t,e){for(let n=0;n{S.delete(t),r&&(n&&t.d(1),r())}),t.o(e)}}function Xt(t){t&&t.c()}function mt(t,e,n,r){const{fragment:i,on_mount:c,on_destroy:f,after_update:o}=t.$$;i&&i.m(e,n),r||M(()=>{const s=c.map(U).filter(st);f?f.push(...s):K(s),t.$$.on_mount=[]}),o.forEach(M)}function gt(t,e){const n=t.$$;n.fragment!==null&&(K(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function _t(t,e){t.$$.dirty[0]===-1&&(O.push(t),pt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<{const m=y.length?y[0]:h;return s.ctx&&i(s.ctx[a],s.ctx[a]=m)&&(!s.skip_bound&&s.bound[a]&&s.bound[a](m),l&&_t(t,a)),h}):[],s.update(),l=!0,K(s.before_update),s.fragment=r?r(s.ctx):!1,e.target){if(e.hydrate){const a=lt(e.target);s.fragment&&s.fragment.l(a),a.forEach(F)}else s.fragment&&s.fragment.c();e.intro&&yt(t.$$.fragment),mt(t,e.target,e.anchor,e.customElement),X()}C(o)}class Wt{$destroy(){gt(this,1),this.$destroy=w}$on(e,n){const r=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(e){this.$$set&&!ft(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const x=[];function Yt(t,e=w){let n;const r=[];function i(o){if(ot(t,o)&&(t=o,n)){const s=!x.length;for(let l=0;l{const a=r.indexOf(l);a!==-1&&r.splice(a,1),r.length===0&&(n(),n=null)}}return{set:i,update:c,subscribe:f}}/*! + * hotkeys-js v3.8.5 + * A simple micro-library for defining and dispatching keyboard shortcuts. It has no dependencies. + * + * Copyright (c) 2021 kenny wong + * http://jaywcjlove.github.io/hotkeys + * + * Licensed under the MIT license. + */var B=typeof navigator!="undefined"?navigator.userAgent.toLowerCase().indexOf("firefox")>0:!1;function D(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent&&t.attachEvent("on".concat(e),function(){n(window.event)})}function Q(t,e){for(var n=e.slice(0,e.length-1),r=0;r=0;)e[n-1]+=",",e.splice(n,1),n=e.lastIndexOf("");return e}function bt(t,e){for(var n=t.length>=e.length?t:e,r=t.length>=e.length?e:t,i=!0,c=0;c=0&&u.splice(n,1),t.key&&t.key.toLowerCase()==="meta"&&u.splice(0,u.length),(e===93||e===224)&&(e=91),e in p){p[e]=!1;for(var r in v)v[r]===e&&(_[r]=!1)}}function $t(t){if(!t)Object.keys(d).forEach(function(f){return delete d[f]});else if(Array.isArray(t))t.forEach(function(f){f.key&&H(f)});else if(typeof t=="object")t.key&&H(t);else if(typeof t=="string"){for(var e=arguments.length,n=new Array(e>1?e-1:0),r=1;r1?Q(v,l):[];d[y]=d[y].map(function(g){var it=i?g.method===i:!0;return it&&g.scope===r&&bt(g.mods,m)?{}:g})}})};function nt(t,e,n){var r;if(e.scope===n||e.scope==="all"){r=e.mods.length>0;for(var i in p)Object.prototype.hasOwnProperty.call(p,i)&&(!p[i]&&e.mods.indexOf(+i)>-1||p[i]&&e.mods.indexOf(+i)===-1)&&(r=!1);(e.mods.length===0&&!p[16]&&!p[18]&&!p[17]&&!p[91]||r||e.shortcut==="*")&&e.method(t,e)===!1&&(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation&&t.stopPropagation(),t.cancelBubble&&(t.cancelBubble=!0))}}function rt(t){var e=d["*"],n=t.keyCode||t.which||t.charCode;if(!!_.filter.call(this,t)){if((n===93||n===224)&&(n=91),u.indexOf(n)===-1&&n!==229&&u.push(n),["ctrlKey","altKey","shiftKey","metaKey"].forEach(function(m){var g=Z[m];t[m]&&u.indexOf(g)===-1?u.push(g):!t[m]&&u.indexOf(g)>-1?u.splice(u.indexOf(g),1):m==="metaKey"&&t[m]&&u.length===3&&(t.ctrlKey||t.shiftKey||t.altKey||(u=u.slice(u.indexOf(g))))}),n in p){p[n]=!0;for(var r in v)v[r]===n&&(_[r]=!0);if(!e)return}for(var i in p)Object.prototype.hasOwnProperty.call(p,i)&&(p[i]=t[Z[i]]);t.getModifierState&&!(t.altKey&&!t.ctrlKey)&&t.getModifierState("AltGraph")&&(u.indexOf(17)===-1&&u.push(17),u.indexOf(18)===-1&&u.push(18),p[17]=!0,p[18]=!0);var c=$();if(e)for(var f=0;f-1}function _(t,e,n){u=[];var r=W(t),i=[],c="all",f=document,o=0,s=!1,l=!0,a="+";for(n===void 0&&typeof e=="function"&&(n=e),Object.prototype.toString.call(e)==="[object Object]"&&(e.scope&&(c=e.scope),e.element&&(f=e.element),e.keyup&&(s=e.keyup),e.keydown!==void 0&&(l=e.keydown),typeof e.splitKey=="string"&&(a=e.splitKey)),typeof e=="string"&&(c=e);o1&&(i=Q(v,t)),t=t[t.length-1],t=t==="*"?"*":k(t),t in d||(d[t]=[]),d[t].push({keyup:s,keydown:l,scope:c,mods:i,shortcut:r[o],method:n,key:r[o],splitKey:a});typeof f!="undefined"&&!Et(f)&&window&&(tt.push(f),D(f,"keydown",function(h){rt(h)}),D(window,"focus",function(){u=[]}),D(f,"keyup",function(h){rt(h),Ot(h)}))}var N={setScope:et,getScope:$,deleteScope:Kt,getPressedKeyCodes:vt,isPressed:xt,filter:wt,unbind:$t};for(var q in N)Object.prototype.hasOwnProperty.call(N,q)&&(_[q]=N[q]);if(typeof window!="undefined"){var Ct=window.hotkeys;_.noConflict=function(t){return t&&window.hotkeys===_&&(window.hotkeys=Ct),_},window.hotkeys=_}export{Pt as A,Xt as B,mt as C,Vt as D,Rt as E,yt as F,gt as G,Jt as H,_ as I,zt as J,Wt as S,kt as a,Tt as b,ut as c,St as d,ct as e,Dt as f,F as g,Gt as h,Qt as i,Ht as j,jt as k,Mt as l,R as m,w as n,Ft as o,Lt as p,M as q,K as r,ot as s,G as t,Nt as u,qt as v,Ut as w,Bt as x,At as y,Yt as z}; diff --git a/examples/api/dist/index.html b/examples/api/dist/index.html index 111fd73dc..5ecf1459b 100644 --- a/examples/api/dist/index.html +++ b/examples/api/dist/index.html @@ -5,8 +5,8 @@ Svelte + Vite App - - + + diff --git a/examples/api/isolation-dist/index.html b/examples/api/isolation-dist/index.html new file mode 100644 index 000000000..1a12b0bc4 --- /dev/null +++ b/examples/api/isolation-dist/index.html @@ -0,0 +1,10 @@ + + + + + Isolation Secure Script + + + + + diff --git a/examples/api/isolation-dist/index.js b/examples/api/isolation-dist/index.js new file mode 100644 index 000000000..2acb850a5 --- /dev/null +++ b/examples/api/isolation-dist/index.js @@ -0,0 +1,4 @@ +window.__TAURI_ISOLATION_HOOK__= (payload) => { + console.log('hook', payload) + return payload +} diff --git a/examples/api/src-tauri/Cargo.lock b/examples/api/src-tauri/Cargo.lock index 521ba9767..ef7bc0978 100644 --- a/examples/api/src-tauri/Cargo.lock +++ b/examples/api/src-tauri/Cargo.lock @@ -14,6 +14,41 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -295,9 +330,9 @@ dependencies = [ [[package]] name = "cargo_toml" -version = "0.10.1" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6d613611c914a7db07f28526941ce1e956d2f977b0c5e2014fbfa42230d420f" +checksum = "363c7cfaa15f101415c4ac9e68706ca4a2277773932828b33f96e59d28c68e62" dependencies = [ "serde", "serde_derive", @@ -372,6 +407,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + [[package]] name = "clap" version = "3.0.4" @@ -418,16 +462,6 @@ dependencies = [ "objc", ] -[[package]] -name = "combine" -version = "4.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b2f5d0ee456f3928812dfc8c6d9a1d592b98678f6d56db9b0cd2b7bc6c8db5" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "1.2.2" @@ -629,6 +663,15 @@ dependencies = [ "syn", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + [[package]] name = "cty" version = "0.2.2" @@ -705,6 +748,15 @@ dependencies = [ "syn", ] +[[package]] +name = "data-url" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" +dependencies = [ + "matches", +] + [[package]] name = "deflate" version = "0.7.20" @@ -1156,6 +1208,16 @@ dependencies = [ "wasi 0.10.2+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug", + "polyval", +] + [[package]] name = "gio" version = "0.14.8" @@ -1527,15 +1589,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "kstring" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b310ccceade8121d7d77fee406160e457c2f4e7c7982d589da3499bc7ea4526" -dependencies = [ - "serde", -] - [[package]] name = "kuchiki" version = "0.8.1" @@ -2240,6 +2293,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -2548,6 +2613,21 @@ dependencies = [ "windows 0.29.0", ] +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + [[package]] name = "rust-argon2" version = "0.8.3" @@ -2765,6 +2845,26 @@ dependencies = [ "syn", ] +[[package]] +name = "serialize-to-javascript" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "servo_arc" version = "0.1.1" @@ -2849,6 +2949,12 @@ dependencies = [ "system-deps 5.0.0", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3054,6 +3160,7 @@ dependencies = [ "bincode", "cfg_aliases", "clap", + "data-url", "dirs-next", "either", "embed_plist", @@ -3080,6 +3187,7 @@ dependencies = [ "serde", "serde_json", "serde_repr", + "serialize-to-javascript", "shared_child", "state", "tar", @@ -3102,6 +3210,7 @@ dependencies = [ "anyhow", "cargo_toml", "serde_json", + "tauri-codegen", "tauri-utils", "winres", ] @@ -3112,7 +3221,6 @@ version = "1.0.0-beta.4" dependencies = [ "base64", "blake3", - "kuchiki", "proc-macro2", "quote", "regex", @@ -3121,6 +3229,7 @@ dependencies = [ "sha2", "tauri-utils", "thiserror", + "uuid", "walkdir", "zstd", ] @@ -3129,7 +3238,7 @@ dependencies = [ name = "tauri-macros" version = "1.0.0-beta.5" dependencies = [ - "heck", + "heck 0.3.3", "proc-macro2", "quote", "syn", @@ -3173,15 +3282,21 @@ dependencies = [ name = "tauri-utils" version = "1.0.0-beta.3" dependencies = [ + "aes-gcm", + "base64", "heck 0.4.0", "html5ever", "kuchiki", + "once_cell", "phf 0.10.1", "proc-macro2", "quote", + "ring", "serde", "serde_json", "serde_with", + "serialize-to-javascript", + "sha2", "thiserror", "url", "zstd", @@ -3320,18 +3435,6 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing" -version = "0.1.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" -dependencies = [ - "cfg-if 1.0.0", - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - [[package]] name = "tracing-attributes" version = "0.1.18" @@ -3420,6 +3523,22 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.2.2" diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index e9833bc78..221b47424 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -3,16 +3,16 @@ name = "api" version = "0.1.0" description = "An example Tauri Application showcasing the api" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" license = "Apache-2.0 OR MIT" [build-dependencies] -tauri-build = { path = "../../../core/tauri-build" } +tauri-build = { path = "../../../core/tauri-build", features = ["isolation"] } [dependencies] serde_json = "1.0" serde = { version = "1.0", features = [ "derive" ] } -tauri = { path = "../../../core/tauri", features = ["api-all", "cli", "macos-private-api", "system-tray", "updater"] } +tauri = { path = "../../../core/tauri", features = ["api-all", "cli", "isolation", "macos-private-api", "system-tray", "updater"] } [features] default = [ "custom-protocol" ] diff --git a/examples/api/src-tauri/tauri.conf.json b/examples/api/src-tauri/tauri.conf.json index 6a5979744..08843511b 100644 --- a/examples/api/src-tauri/tauri.conf.json +++ b/examples/api/src-tauri/tauri.conf.json @@ -10,6 +10,12 @@ "version": "../package.json" }, "tauri": { + "pattern": { + "use": "isolation", + "options": { + "dir": "../isolation-dist/" + } + }, "macOSPrivateApi": true, "cli": { "description": "Tauri API example", diff --git a/examples/commands/src-tauri/Cargo.toml b/examples/commands/src-tauri/Cargo.toml index cfd09d887..09d5d20e4 100644 --- a/examples/commands/src-tauri/Cargo.toml +++ b/examples/commands/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "commands" version = "0.1.0" description = "A simple Tauri Application showcasing the commands API" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/helloworld/src-tauri/Cargo.toml b/examples/helloworld/src-tauri/Cargo.toml index 8a59ba3ab..d611b4d87 100644 --- a/examples/helloworld/src-tauri/Cargo.toml +++ b/examples/helloworld/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "helloworld" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/helloworld/src-tauri/tauri.conf.json b/examples/helloworld/src-tauri/tauri.conf.json index 4137b946c..b59986109 100644 --- a/examples/helloworld/src-tauri/tauri.conf.json +++ b/examples/helloworld/src-tauri/tauri.conf.json @@ -48,9 +48,6 @@ ], "security": { "csp": "default-src 'self'" - }, - "updater": { - "active": false } } } diff --git a/examples/isolation/dist/index.html b/examples/isolation/dist/index.html new file mode 100644 index 000000000..523b0edde --- /dev/null +++ b/examples/isolation/dist/index.html @@ -0,0 +1,84 @@ + + + + + + + Hello Tauri! + + + + + +
    +

    Hello, Tauri!

    +
    +
    + +
    +
    + + + + + + diff --git a/examples/isolation/dist/linked.js b/examples/isolation/dist/linked.js new file mode 100644 index 000000000..7f6523131 --- /dev/null +++ b/examples/isolation/dist/linked.js @@ -0,0 +1 @@ +console.log("linked", window.__TAURI_PATTERN__); diff --git a/examples/isolation/isolation-dist/index.html b/examples/isolation/isolation-dist/index.html new file mode 100644 index 000000000..1a12b0bc4 --- /dev/null +++ b/examples/isolation/isolation-dist/index.html @@ -0,0 +1,10 @@ + + + + + Isolation Secure Script + + + + + diff --git a/examples/isolation/isolation-dist/index.js b/examples/isolation/isolation-dist/index.js new file mode 100644 index 000000000..2acb850a5 --- /dev/null +++ b/examples/isolation/isolation-dist/index.js @@ -0,0 +1,4 @@ +window.__TAURI_ISOLATION_HOOK__= (payload) => { + console.log('hook', payload) + return payload +} diff --git a/examples/isolation/package.json b/examples/isolation/package.json new file mode 100644 index 000000000..022f42425 --- /dev/null +++ b/examples/isolation/package.json @@ -0,0 +1,10 @@ +{ + "name": "isolation", + "license": "Apache-2.0 OR MIT", + "scripts": { + "tauri": "node ../../tooling/cli.js/bin/tauri" + }, + "dependencies": { + "@tauri-apps/api": "../../tooling/api/dist" + } +} diff --git a/examples/isolation/src-tauri/.gitignore b/examples/isolation/src-tauri/.gitignore new file mode 100644 index 000000000..1320e8c0a --- /dev/null +++ b/examples/isolation/src-tauri/.gitignore @@ -0,0 +1,5 @@ +# Generated by Cargo +# will have compiled files and executables +/target/ +WixTools +.cargo diff --git a/examples/isolation/src-tauri/.license_template b/examples/isolation/src-tauri/.license_template new file mode 120000 index 000000000..860f08256 --- /dev/null +++ b/examples/isolation/src-tauri/.license_template @@ -0,0 +1 @@ +../../../.license_template \ No newline at end of file diff --git a/examples/isolation/src-tauri/Cargo.lock b/examples/isolation/src-tauri/Cargo.lock new file mode 100644 index 000000000..81bd3a697 --- /dev/null +++ b/examples/isolation/src-tauri/Cargo.lock @@ -0,0 +1,3448 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "adler32" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" + +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug", +] + +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + +[[package]] +name = "ansi_term" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" +dependencies = [ + "winapi", +] + +[[package]] +name = "anyhow" +version = "1.0.51" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b26702f315f53b6071259e15dd9d64528213b44d61de1ec926eca7715d62203" + +[[package]] +name = "app" +version = "0.1.0" +dependencies = [ + "serde", + "serde_json", + "tauri", + "tauri-build", +] + +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + +[[package]] +name = "arrayvec" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" + +[[package]] +name = "atk" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a83b21d2aa75e464db56225e1bda2dd5993311ba1095acaa8fa03d1ae67026ba" +dependencies = [ + "atk-sys", + "bitflags", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "badcf670157c84bb8b1cf6b5f70b650fed78da2033c9eed84c4e49b11cbe83ea" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "autocfg" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" + +[[package]] +name = "base64" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "blake3" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if 1.0.0", + "constant_time_eq", + "digest", + "rayon", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223" +dependencies = [ + "memchr", +] + +[[package]] +name = "bumpalo" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "bytes" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4872d67bab6358e59559027aa3b9157c53d9358c51423c17554809a8858e0f8" + +[[package]] +name = "bzip2" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +dependencies = [ + "bzip2-sys", + "libc", +] + +[[package]] +name = "bzip2-sys" +version = "0.1.11+1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +dependencies = [ + "cc", + "libc", + "pkg-config", +] + +[[package]] +name = "cairo-rs" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b5725979db0c586d98abad2193cdb612dd40ef95cd26bd99851bf93b3cb482" +dependencies = [ + "bitflags", + "cairo-sys-rs", + "glib", + "libc", + "thiserror", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b448b876970834fda82ba3aeaccadbd760206b75388fc5c1b02f1e343b697570" +dependencies = [ + "glib-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "cargo_toml" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67110a7844b75a4dda12f4dca5a731c961750d6c8fa3cb6a41ab67411be05d3a" +dependencies = [ + "serde", + "serde_derive", + "toml", +] + +[[package]] +name = "cc" +version = "1.0.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" +dependencies = [ + "jobserver", +] + +[[package]] +name = "cfb" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca453e8624711b2f0f4eb47076a318feda166252a827ee25d067b43de83dcba0" +dependencies = [ + "byteorder", + "uuid", +] + +[[package]] +name = "cfg-expr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b412e83326147c2bb881f8b40edfbf9905b9b8abaebd0e47ca190ba62fda8f0e" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-expr" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edae0b9625d1fce32f7d64b71784d9b1bf8469ec1a9c417e44aaf16a9cbd7571" +dependencies = [ + "smallvec", +] + +[[package]] +name = "cfg-if" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" + +[[package]] +name = "cipher" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" +dependencies = [ + "generic-array", +] + +[[package]] +name = "cocoa" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63902e9223530efb4e26ccd0cf55ec30d592d3b42e21a28defc42a9586e832" +dependencies = [ + "bitflags", + "block", + "cocoa-foundation", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "cocoa-foundation" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" +dependencies = [ + "bitflags", + "block", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc", + "objc", +] + +[[package]] +name = "const-sha1" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb58b6451e8c2a812ad979ed1d83378caa5e927eef2622017a45f251457c2c9d" + +[[package]] +name = "constant_time_eq" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + +[[package]] +name = "core-foundation" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57d24c7a13c43e870e37c1556b74555437870a04514f7685f5b354e090567171" +dependencies = [ + "core-foundation-sys 0.7.0", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6888e10551bb93e424d8df1d07f1a8b4fceb0001a3a4b048bfc47554946f47b3" +dependencies = [ + "core-foundation-sys 0.8.3", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a71ab494c0b5b860bdc8407ae08978052417070c2ced38573a9157ad75b8ac" + +[[package]] +name = "core-foundation-sys" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" + +[[package]] +name = "core-graphics" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3889374e6ea6ab25dba90bb5d96202f61108058361f6dc72e8b03e6f8bbe923" +dependencies = [ + "bitflags", + "core-foundation 0.7.0", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics" +version = "0.22.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" +dependencies = [ + "bitflags", + "core-foundation 0.9.2", + "core-graphics-types", + "foreign-types", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a68b68b3446082644c91ac778bf50cd4104bfb002b5a6a7c44cca5a2c70788b" +dependencies = [ + "bitflags", + "core-foundation 0.9.2", + "foreign-types", + "libc", +] + +[[package]] +name = "core-video-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34ecad23610ad9757664d644e369246edde1803fcb43ed72876565098a5d3828" +dependencies = [ + "cfg-if 0.1.10", + "core-foundation-sys 0.7.0", + "core-graphics 0.19.2", + "libc", + "objc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd" +dependencies = [ + "cfg-if 1.0.0", + "crossbeam-utils", + "lazy_static", + "memoffset", + "scopeguard", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db" +dependencies = [ + "cfg-if 1.0.0", + "lazy_static", +] + +[[package]] +name = "cssparser" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "754b69d351cdc2d8ee09ae203db831e005560fc6030da058f86ad60c92a9cb0a" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa 0.4.8", + "matches", + "phf 0.8.0", + "proc-macro2", + "quote", + "smallvec", + "syn", +] + +[[package]] +name = "cssparser-macros" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfae75de57f2b2e85e8768c3ea840fd159c8f33e2b6522c7835b7abac81be16e" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + +[[package]] +name = "cty" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" + +[[package]] +name = "darling" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" +dependencies = [ + "darling_core 0.10.2", + "darling_macro 0.10.2", +] + +[[package]] +name = "darling" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4" +dependencies = [ + "darling_core 0.13.1", + "darling_macro 0.13.1", +] + +[[package]] +name = "darling_core" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.9.3", + "syn", +] + +[[package]] +name = "darling_core" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.10.0", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" +dependencies = [ + "darling_core 0.10.2", + "quote", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b" +dependencies = [ + "darling_core 0.13.1", + "quote", + "syn", +] + +[[package]] +name = "data-url" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a30bfce702bcfa94e906ef82421f2c0e61c076ad76030c16ee5d2e9a32fe193" +dependencies = [ + "matches", +] + +[[package]] +name = "deflate" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707b6a7b384888a70c8d2e8650b3e60170dfc6a67bb4aa67b6dfca57af4bedb4" +dependencies = [ + "adler32", + "byteorder", +] + +[[package]] +name = "deflate" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174" +dependencies = [ + "adler32", + "byteorder", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version 0.4.0", + "syn", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + +[[package]] +name = "dispatch" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" + +[[package]] +name = "dtoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56899898ce76aaf4a0f24d914c97ea6ed976d42fec6ad33fcbb0a1103e07b2b0" + +[[package]] +name = "dtoa-short" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bde03329ae10e79ede66c9ce4dc930aa8599043b0743008548680f25b91502d6" +dependencies = [ + "dtoa", +] + +[[package]] +name = "either" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" + +[[package]] +name = "embed_plist" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53dd2e43a7d32952a6054141ee0d75183958620e84e5eab045de362dff13dc99" + +[[package]] +name = "fastrand" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +dependencies = [ + "instant", +] + +[[package]] +name = "field-offset" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e1c54951450cbd39f3dbcf1005ac413b49487dabf18a720ad2383eccfeffb92" +dependencies = [ + "memoffset", + "rustc_version 0.3.3", +] + +[[package]] +name = "filetime" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "975ccf83d8d9d0d84682850a38c8169027be83368805971cc4f238c2b245bc98" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall", + "winapi", +] + +[[package]] +name = "flate2" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f" +dependencies = [ + "cfg-if 1.0.0", + "crc32fast", + "libc", + "miniz_oxide 0.4.4", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" +dependencies = [ + "matches", + "percent-encoding", +] + +[[package]] +name = "futf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c9c1ce3fa9336301af935ab852c437817d14cd33690446569392e65170aac3b" +dependencies = [ + "mac", + "new_debug_unreachable", +] + +[[package]] +name = "futures" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28560757fe2bb34e79f907794bb6b22ae8b0e5c669b638a1132f2592b19035b4" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3dda0b6588335f360afc675d0564c17a77a2bda81ca178a4b6081bd86c7f0b" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0c8ff0461b82559810cdccfde3215c3f373807f5e5232b71479bff7bb2583d7" + +[[package]] +name = "futures-executor" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29d6d2ff5bb10fb95c85b8ce46538a2e5f5e7fdc755623a7d4529ab8a4ed9d2a" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9d34af5a1aac6fb380f735fe510746c38067c5bf16c7fd250280503c971b2" + +[[package]] +name = "futures-lite" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694489acd39452c77daa48516b894c153f192c3578d5a839b62c58099fcbf48" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + +[[package]] +name = "futures-macro" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbd947adfffb0efc70599b3ddcf7b5597bb5fa9e245eb99f62b3a5f7bb8bd3c" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "futures-sink" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3055baccb68d74ff6480350f8d6eb8fcfa3aa11bdc1a1ae3afdd0514617d508" + +[[package]] +name = "futures-task" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ee7c6485c30167ce4dfb83ac568a849fe53274c831081476ee13e0dce1aad72" + +[[package]] +name = "futures-util" +version = "0.3.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b5cf40b47a271f77a8b1bec03ca09044d99d2372c0de244e66430761127164" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "fxhash" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c" +dependencies = [ + "byteorder", +] + +[[package]] +name = "gdk" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d749dcfc00d8de0d7c3a289e04a04293eb5ba3d8a4e64d64911d481fa9933b" +dependencies = [ + "bitflags", + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590" +dependencies = [ + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "gdk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e091b3d3d6696949ac3b3fb3c62090e5bfd7bd6850bef5c3c5ea701de1b1f1e" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "pango-sys", + "pkg-config", + "system-deps 3.2.0", +] + +[[package]] +name = "generator" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1d9279ca822891c1a4dae06d185612cf8fc6acfe5dff37781b41297811b12ee" +dependencies = [ + "cc", + "libc", + "log", + "rustversion", + "winapi", +] + +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", +] + +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug", + "polyval", +] + +[[package]] +name = "gio" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-io", + "gio-sys 0.14.0", + "glib", + "libc", + "once_cell", + "thiserror", +] + +[[package]] +name = "gio-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e24fb752f8f5d2cf6bbc2c606fd2bc989c81c5e2fe321ab974d54f8b6344eac" +dependencies = [ + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "system-deps 1.3.2", + "winapi", +] + +[[package]] +name = "gio-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", + "winapi", +] + +[[package]] +name = "glib" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c515f1e62bf151ef6635f528d05b02c11506de986e43b34a5c920ef0b3796a4" +dependencies = [ + "bitflags", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "glib-macros", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "once_cell", + "smallvec", +] + +[[package]] +name = "glib-macros" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518" +dependencies = [ + "anyhow", + "heck", + "proc-macro-crate 1.1.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "glib-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e9b997a66e9a23d073f2b1abb4dbfc3925e0b8952f67efd8d9b6e168e4cdc1" +dependencies = [ + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "glib-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae" +dependencies = [ + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "glob" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" + +[[package]] +name = "globset" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10463d9ff00a2a068db14231982f5132edebad0d7660cd956a1c30292dbcbfbd" +dependencies = [ + "aho-corasick", + "bstr", + "fnv", + "log", + "regex", +] + +[[package]] +name = "gobject-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "952133b60c318a62bf82ee75b93acc7e84028a093e06b9e27981c2b6fe68218c" +dependencies = [ + "glib-sys 0.10.1", + "libc", + "system-deps 1.3.2", +] + +[[package]] +name = "gobject-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5" +dependencies = [ + "glib-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "gtk" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eb51122dd3317e9327ec1e4faa151d1fa0d95664cd8fb8dcfacf4d4d29ac70c" +dependencies = [ + "atk", + "bitflags", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "once_cell", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c14c8d3da0545785a7c5a120345b3abb534010fb8ae0f2ef3f47c027fba303e" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "pango-sys", + "system-deps 3.2.0", +] + +[[package]] +name = "gtk3-macros" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21de1da96dc117443fb03c2e270b2d34b7de98d0a79a19bbb689476173745b79" +dependencies = [ + "anyhow", + "heck", + "proc-macro-crate 1.1.0", + "proc-macro-error", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "heck" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" +dependencies = [ + "unicode-segmentation", +] + +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + +[[package]] +name = "html5ever" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aafcf38a1a36118242d29b92e1b08ef84e67e4a5ed06e0a80be20e6a32bfed6b" +dependencies = [ + "log", + "mac", + "markup5ever", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "http" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1323096b05d41827dadeaee54c9981958c0f94e670bc94ed80037d1a7b8b186b" +dependencies = [ + "bytes", + "fnv", + "itoa 0.4.8", +] + +[[package]] +name = "http-range" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eee9694f83d9b7c09682fdb32213682939507884e5bcf227be9aff5d644b90dc" + +[[package]] +name = "ico" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a4b3331534254a9b64095ae60d3dc2a8225a7a70229cd5888be127cdc1f6804" +dependencies = [ + "byteorder", + "png 0.11.0", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" +dependencies = [ + "matches", + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "ignore" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d" +dependencies = [ + "crossbeam-utils", + "globset", + "lazy_static", + "log", + "memchr", + "regex", + "same-file", + "thread_local", + "walkdir", + "winapi-util", +] + +[[package]] +name = "infer" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f92b41dab759f9e8427c03f519c344a14655490b8db548dac1e57a75b3258391" +dependencies = [ + "cfb", +] + +[[package]] +name = "inflate" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f5f9f47468e9a76a6452271efadc88fe865a82be91fe75e6c0c57b87ccea59d4" +dependencies = [ + "adler32", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "itertools" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9a9d19fa1e79b6215ff29b9d6880b706147f16e9b1dbb1e4e5947b5b02bc5e3" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" + +[[package]] +name = "itoa" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" + +[[package]] +name = "javascriptcore-rs" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e207780c1d1cd3c36056695e44010a19dd481574a2106cd2540edda4128a9794" +dependencies = [ + "bitflags", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2adf2de824b178d76c6017da59f4e7e95de49a766b584c59d47821a6c3dce9e2" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 5.0.0", +] + +[[package]] +name = "jni-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" + +[[package]] +name = "jobserver" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" +dependencies = [ + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc9ffccd38c451a86bf13657df244e9c3f37493cce8e5e21e940963777acc84" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "kuchiki" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ea8e9c6e031377cff82ee3001dc8026cdf431ed4e2e6b51f98ab8c73484a358" +dependencies = [ + "cssparser", + "html5ever", + "matches", + "selectors", +] + +[[package]] +name = "lazy_static" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" + +[[package]] +name = "libc" +version = "0.2.112" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" + +[[package]] +name = "lock_api" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712a4d093c9976e24e7dbca41db895dabcbac38eb5f4045393d17a95bdfb1109" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +dependencies = [ + "cfg-if 1.0.0", +] + +[[package]] +name = "loom" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edc5c7d328e32cc4954e8e01193d7f0ef5ab257b5090b70a964e099a36034309" +dependencies = [ + "cfg-if 1.0.0", + "generator", + "scoped-tls", + "serde", + "serde_json", + "tracing", + "tracing-subscriber", +] + +[[package]] +name = "mac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c41e0c4fef86961ac6d6f8a82609f55f31b05e4fce149ac5710e439df7619ba4" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "markup5ever" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a24f40fb03852d1cdd84330cddcaf98e9ec08a7b7768e952fad3b4cf048ec8fd" +dependencies = [ + "log", + "phf 0.8.0", + "phf_codegen", + "string_cache", + "string_cache_codegen", + "tendril", +] + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matches" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" + +[[package]] +name = "memchr" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" + +[[package]] +name = "memoffset" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +dependencies = [ + "autocfg", +] + +[[package]] +name = "miniz_oxide" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791daaae1ed6889560f8c4359194f56648355540573244a5448a83ba1ecc7435" +dependencies = [ + "adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b" +dependencies = [ + "adler", + "autocfg", +] + +[[package]] +name = "ndk" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d64d6af06fde0e527b1ba5c7b79a6cc89cfc46325b0b2887dffe8f70197e0c3c" +dependencies = [ + "bitflags", + "jni-sys", + "ndk-sys", + "num_enum", + "thiserror", +] + +[[package]] +name = "ndk-glue" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e9e94628f24e7a3cb5b96a2dc5683acd9230bf11991c2a1677b87695138420" +dependencies = [ + "lazy_static", + "libc", + "log", + "ndk", + "ndk-macro", + "ndk-sys", +] + +[[package]] +name = "ndk-macro" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d1c6307dc424d0f65b9b06e94f88248e6305726b14729fd67a5e47b2dc481d" +dependencies = [ + "darling 0.10.2", + "proc-macro-crate 0.1.5", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "ndk-sys" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1bcdd74c20ad5d95aacd60ef9ba40fdf77f767051040541df557b7a9b2a2121" + +[[package]] +name = "new_debug_unreachable" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" + +[[package]] +name = "nodrop" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72ef4a56884ca558e5ddb05a1d1e7e1bfd9a68d9ed024c21704cc98872dae1bb" + +[[package]] +name = "num-integer" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.42" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2021c8337a54d21aca0d59a92577a029af9431cb59b909b03252b9c164fad59" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_cpus" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "085fe377a4b2805c0fbc09484415ec261174614b7f080b0e0d520456ac421a67" +dependencies = [ + "derivative", + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5249369707a1e07b39f78d98c8f34e00aca7dcb053812fdbb5ad7be82c1bba38" +dependencies = [ + "proc-macro-crate 1.1.0", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", + "objc_exception", +] + +[[package]] +name = "objc_exception" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" +dependencies = [ + "cc", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + +[[package]] +name = "once_cell" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "pango" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "546fd59801e5ca735af82839007edd226fe7d3bb06433ec48072be4439c28581" +dependencies = [ + "bitflags", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe" +dependencies = [ + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "libc", + "system-deps 3.2.0", +] + +[[package]] +name = "parking" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72" + +[[package]] +name = "parking_lot" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d17b78036a60663b797adeaee46f5c9dfebb86948d1255007a1d6be0271ff99" +dependencies = [ + "instant", + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d76e8e1493bcac0d2766c42737f34458f1c8c50c0d23bcb24ea953affb273216" +dependencies = [ + "cfg-if 1.0.0", + "instant", + "libc", + "redox_syscall", + "smallvec", + "winapi", +] + +[[package]] +name = "percent-encoding" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" + +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "phf" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12" +dependencies = [ + "phf_macros 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", +] + +[[package]] +name = "phf" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" +dependencies = [ + "phf_macros 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", +] + +[[package]] +name = "phf_codegen" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbffee61585b0411840d3ece935cce9cb6321f01c45477d30066498cd5e1a815" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", +] + +[[package]] +name = "phf_generator" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17367f0cc86f2d25802b2c26ee58a7b23faeccf78a396094c13dced0d0182526" +dependencies = [ + "phf_shared 0.8.0", + "rand 0.7.3", +] + +[[package]] +name = "phf_generator" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d5285893bb5eb82e6aaf5d59ee909a06a16737a8970984dd7746ba9283498d6" +dependencies = [ + "phf_shared 0.10.0", + "rand 0.8.4", +] + +[[package]] +name = "phf_macros" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f6fde18ff429ffc8fe78e2bf7f8b7a5a5a6e2a8b58bc5a9ac69198bbda9189c" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fdf3184dd560f160dd73922bea2d5cd6e8f064bf4b13110abd81b03697b4e0" +dependencies = [ + "phf_generator 0.10.0", + "phf_shared 0.10.0", + "proc-macro-hack", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "phf_shared" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d31d11c69a6b52a174b42bdc0c30e5e11670f90788b2c471c31c1d17d449443" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkg-config" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" + +[[package]] +name = "png" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0b0cabbbd20c2d7f06dbf015e06aad59b6ca3d9ed14848783e98af9aaf19925" +dependencies = [ + "bitflags", + "deflate 0.7.20", + "inflate", + "num-iter", +] + +[[package]] +name = "png" +version = "0.16.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6" +dependencies = [ + "bitflags", + "crc32fast", + "deflate 0.8.6", + "miniz_oxide 0.3.7", +] + +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug", + "universal-hash", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6ea3c4595b96363c13943497db34af4460fb474a95c43f4446ad341b8c9785" +dependencies = [ + "toml", +] + +[[package]] +name = "proc-macro-crate" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebace6889caf889b4d3f76becee12e90353f2b8c7d875534a71e5742f8f6f83" +dependencies = [ + "thiserror", + "toml", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-hack" +version = "0.5.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" + +[[package]] +name = "proc-macro2" +version = "1.0.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f84e92c0f7c9d58328b85a78557813e4bd845130db68d7184635344399423b1" +dependencies = [ + "unicode-xid", +] + +[[package]] +name = "quote" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" +dependencies = [ + "getrandom 0.1.16", + "libc", + "rand_chacha 0.2.2", + "rand_core 0.5.1", + "rand_hc 0.2.0", + "rand_pcg", +] + +[[package]] +name = "rand" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.3", + "rand_hc 0.3.1", +] + +[[package]] +name = "rand_chacha" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" +dependencies = [ + "ppv-lite86", + "rand_core 0.5.1", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.3", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" +dependencies = [ + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" +dependencies = [ + "getrandom 0.2.3", +] + +[[package]] +name = "rand_hc" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "rand_hc" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" +dependencies = [ + "rand_core 0.6.3", +] + +[[package]] +name = "rand_pcg" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" +dependencies = [ + "rand_core 0.5.1", +] + +[[package]] +name = "raw-window-handle" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e28f55143d0548dad60bb4fbdc835a3d7ac6acc3324506450c5fdd6e42903a76" +dependencies = [ + "libc", + "raw-window-handle 0.4.2", +] + +[[package]] +name = "raw-window-handle" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fba75eee94a9d5273a68c9e1e105d9cffe1ef700532325788389e5a83e2522b7" +dependencies = [ + "cty", +] + +[[package]] +name = "rayon" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" +dependencies = [ + "autocfg", + "crossbeam-deque", + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" +dependencies = [ + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-utils", + "lazy_static", + "num_cpus", +] + +[[package]] +name = "redox_syscall" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8383f39639269cde97d255a32bdb68c047337295414940c68bdd30c2e13203ff" +dependencies = [ + "bitflags", +] + +[[package]] +name = "redox_users" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" +dependencies = [ + "getrandom 0.2.3", + "redox_syscall", +] + +[[package]] +name = "regex" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "remove_dir_all" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" +dependencies = [ + "winapi", +] + +[[package]] +name = "ring" +version = "0.16.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver 1.0.4", +] + +[[package]] +name = "rustversion" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f" + +[[package]] +name = "ryu" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scoped-tls" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea6a9290e3c9cf0f18145ef7ffa62d68ee0bf5fcd651017e586dc7fd5da448c2" + +[[package]] +name = "scopeguard" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" + +[[package]] +name = "selectors" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df320f1889ac4ba6bc0cdc9c9af7af4bd64bb927bccdf32d81140dc1f9be12fe" +dependencies = [ + "bitflags", + "cssparser", + "derive_more", + "fxhash", + "log", + "matches", + "phf 0.8.0", + "phf_codegen", + "precomputed-hash", + "servo_arc", + "smallvec", + "thin-slice", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012" + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5" +dependencies = [ + "itoa 1.0.1", + "ryu", + "serde", +] + +[[package]] +name = "serde_repr" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98d0516900518c29efa217c298fa1f4e6c6ffc85ae29fd7f4ee48f176e1a9ed5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_with" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3" +dependencies = [ + "rustversion", + "serde", + "serde_with_macros", +] + +[[package]] +name = "serde_with_macros" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e" +dependencies = [ + "darling 0.13.1", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "servo_arc" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d98238b800e0d1576d8b6e3de32827c2d74bee68bb97748dcf5071fb53965432" +dependencies = [ + "nodrop", + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b69f9a4c9740d74c5baa3fd2e547f9525fa8088a8a958e0ca2409a514e33f5fa" +dependencies = [ + "block-buffer", + "cfg-if 1.0.0", + "cpufeatures", + "digest", + "opaque-debug", +] + +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "siphasher" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b" + +[[package]] +name = "slab" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9def91fd1e018fe007022791f865d0ccc9b3a0d5001e01aabb8b40e46000afb5" + +[[package]] +name = "smallvec" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ecab6c735a6bb4139c0caafd0cc3635748bbb3acf4550e8138122099251f309" + +[[package]] +name = "soup-sys" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3c7adf08565630bbb71f955f11f8a68464817ded2703a3549747c235b58a13e" +dependencies = [ + "bitflags", + "gio-sys 0.10.1", + "glib-sys 0.10.1", + "gobject-sys 0.10.0", + "libc", + "pkg-config", + "system-deps 1.3.2", +] + +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "state" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87cf4f5369e6d3044b5e365c9690f451516ac8f0954084622b49ea3fde2f6de5" +dependencies = [ + "loom", +] + +[[package]] +name = "string_cache" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "923f0f39b6267d37d23ce71ae7235602134b250ace715dd2c90421998ddac0c6" +dependencies = [ + "lazy_static", + "new_debug_unreachable", + "parking_lot", + "phf_shared 0.8.0", + "precomputed-hash", + "serde", +] + +[[package]] +name = "string_cache_codegen" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f24c8e5e19d22a726626f1a5e16fe15b132dcf21d10177fa5a45ce7962996b97" +dependencies = [ + "phf_generator 0.8.0", + "phf_shared 0.8.0", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" + +[[package]] +name = "strsim" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" + +[[package]] +name = "strum" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bd81eb48f4c437cadc685403cad539345bf703d78e63707418431cecd4522b" + +[[package]] +name = "strum" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf86bbcfd1fa9670b7a129f64fc0c9fcbbfe4f1bc4210e9e98fe71ffc12cde2" + +[[package]] +name = "strum_macros" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87c85aa3f8ea653bfd3ddf25f7ee357ee4d204731f6aa9ad04002306f6e2774c" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "strum_macros" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.82" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "system-deps" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3ecc17269a19353b3558b313bba738b25d82993e30d62a18406a24aba4649b" +dependencies = [ + "heck", + "pkg-config", + "strum 0.18.0", + "strum_macros 0.18.0", + "thiserror", + "toml", + "version-compare 0.0.10", +] + +[[package]] +name = "system-deps" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6" +dependencies = [ + "anyhow", + "cfg-expr 0.8.1", + "heck", + "itertools", + "pkg-config", + "strum 0.21.0", + "strum_macros 0.21.1", + "thiserror", + "toml", + "version-compare 0.0.11", +] + +[[package]] +name = "system-deps" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e" +dependencies = [ + "cfg-expr 0.9.0", + "heck", + "pkg-config", + "toml", + "version-compare 0.0.11", +] + +[[package]] +name = "tao" +version = "0.5.2" +source = "git+https://github.com/tauri-apps/tao?rev=2294e312b7c0d422968be3b1406eaa4fe83bc96d#2294e312b7c0d422968be3b1406eaa4fe83bc96d" +dependencies = [ + "bitflags", + "cairo-rs", + "cc", + "cocoa", + "core-foundation 0.9.2", + "core-graphics 0.22.3", + "core-video-sys", + "crossbeam-channel", + "dispatch", + "gdk", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "glib-sys 0.14.0", + "gtk", + "instant", + "lazy_static", + "libc", + "log", + "ndk", + "ndk-glue", + "ndk-sys", + "objc", + "parking_lot", + "raw-window-handle 0.3.4", + "scopeguard", + "serde", + "unicode-segmentation", + "webview2-com-sys", + "windows", + "x11-dl", +] + +[[package]] +name = "tar" +version = "0.4.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "tauri" +version = "1.0.0-beta.8" +dependencies = [ + "bincode", + "cfg_aliases", + "data-url", + "dirs-next", + "either", + "embed_plist", + "flate2", + "futures", + "futures-lite", + "glib", + "glob", + "gtk", + "http", + "ignore", + "once_cell", + "percent-encoding", + "rand 0.8.4", + "raw-window-handle 0.3.4", + "regex", + "semver 1.0.4", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "state", + "tar", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "tempfile", + "thiserror", + "tokio", + "url", + "uuid", + "zip", +] + +[[package]] +name = "tauri-build" +version = "1.0.0-beta.4" +dependencies = [ + "anyhow", + "cargo_toml", + "serde_json", + "tauri-codegen", + "tauri-utils", + "winres", +] + +[[package]] +name = "tauri-codegen" +version = "1.0.0-beta.4" +dependencies = [ + "base64", + "blake3", + "proc-macro2", + "quote", + "regex", + "serde", + "serde_json", + "sha2", + "tauri-utils", + "thiserror", + "uuid", + "walkdir", + "zstd", +] + +[[package]] +name = "tauri-macros" +version = "1.0.0-beta.5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", + "tauri-codegen", +] + +[[package]] +name = "tauri-runtime" +version = "0.2.1" +dependencies = [ + "gtk", + "http", + "http-range", + "infer", + "serde", + "serde_json", + "tauri-utils", + "thiserror", + "uuid", + "webview2-com-sys", +] + +[[package]] +name = "tauri-runtime-wry" +version = "0.2.1" +dependencies = [ + "gtk", + "ico", + "infer", + "png 0.16.8", + "tauri-runtime", + "tauri-utils", + "uuid", + "webview2-com", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "1.0.0-beta.3" +dependencies = [ + "aes-gcm", + "base64", + "heck", + "html5ever", + "kuchiki", + "once_cell", + "phf 0.10.1", + "proc-macro2", + "quote", + "ring", + "serde", + "serde_json", + "serde_with", + "serialize-to-javascript", + "sha2", + "thiserror", + "url", + "zstd", +] + +[[package]] +name = "tempfile" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "rand 0.8.4", + "redox_syscall", + "remove_dir_all", + "winapi", +] + +[[package]] +name = "tendril" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9ef557cb397a4f0a5a3a628f06515f78563f2209e64d47055d9dc6052bf5e33" +dependencies = [ + "futf", + "mac", + "utf-8", +] + +[[package]] +name = "thin-slice" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" + +[[package]] +name = "thiserror" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "thread_local" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +dependencies = [ + "once_cell", +] + +[[package]] +name = "time" +version = "0.1.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca8a50ef2360fbd1eeb0ecd46795a87a19024eb4b53c5dc916ca1fd95fe62438" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "tinyvec" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" + +[[package]] +name = "tokio" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" +dependencies = [ + "bytes", + "memchr", + "num_cpus", + "pin-project-lite", +] + +[[package]] +name = "toml" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +dependencies = [ + "serde", +] + +[[package]] +name = "tracing" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "375a639232caf30edfc78e8d89b2d4c375515393e7af7e16f01cd96917fb2105" +dependencies = [ + "cfg-if 1.0.0", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f4ed65637b8390770814083d20756f87bfa2c21bf2f110babdc5438351746e4" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "tracing-log" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6923477a48e41c1951f1999ef8bb5a3023eb723ceadafe78ffb65dc366761e3" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245da694cc7fc4729f3f418b304cb57789f1bed2a78c575407ab8a23f53cb4d3" +dependencies = [ + "ansi_term", + "lazy_static", + "matchers", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "typenum" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63708a265f51345575b27fe43f9500ad611579e764c79edbc2037b1121959ec" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + +[[package]] +name = "unicode-bidi" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" + +[[package]] +name = "unicode-normalization" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-segmentation" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8895849a949e7845e06bd6dc1aa51731a103c42707010a5b591c0038fb73385b" + +[[package]] +name = "unicode-xid" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" + +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + +[[package]] +name = "url" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" +dependencies = [ + "form_urlencoded", + "idna", + "matches", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf-8" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" + +[[package]] +name = "uuid" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +dependencies = [ + "getrandom 0.2.3", +] + +[[package]] +name = "version-compare" +version = "0.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" + +[[package]] +name = "version-compare" +version = "0.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b" + +[[package]] +name = "version_check" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fecdca9a5291cc2b8dcf7dc02453fee791a280f3743cb0905f8822ae463b3fe" + +[[package]] +name = "waker-fn" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" + +[[package]] +name = "walkdir" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +dependencies = [ + "same-file", + "winapi", + "winapi-util", +] + +[[package]] +name = "wasi" +version = "0.9.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + +[[package]] +name = "wasm-bindgen" +version = "0.2.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632f73e236b219150ea279196e54e610f5dbafa5d61786303d4da54f84e47fce" +dependencies = [ + "cfg-if 1.0.0", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a317bf8f9fba2476b4b2c85ef4c4af8ff39c3c7f0cdfeed4f82c34a880aa837b" +dependencies = [ + "bumpalo", + "lazy_static", + "log", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d56146e7c495528bf6587663bea13a8eb588d39b36b679d83972e1a2dbbdacf9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7803e0eea25835f8abdc585cd3021b3deb11543c6fe226dcd30b228857c5c5ab" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.78" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0237232789cf037d5480773fe568aac745bfe2afbc11a863e97901780a6b47cc" + +[[package]] +name = "web-sys" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38eb105f1c59d9eaa6b5cdc92b859d85b926e82cb2e0945cd0c9259faa6fe9fb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webkit2gtk" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5725e8ede878b7c00419066868085b83fb7d01eea904c1a0bd0159ad3ce0ba3" +dependencies = [ + "bitflags", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys 0.14.0", + "glib", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "0.15.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34314407e381b88a72610d0f4eeff1552cbf8ee5420dbe84749fa26aa11b4e3" +dependencies = [ + "atk-sys", + "bitflags", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys 0.14.0", + "glib-sys 0.14.0", + "gobject-sys 0.14.0", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pango-sys", + "pkg-config", + "soup-sys", + "system-deps 5.0.0", +] + +[[package]] +name = "webview2-com" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2294dee38668da0d71019097dddc6cef525fde7aa4784243dd83f0752e08aa5" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows", +] + +[[package]] +name = "webview2-com-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2eba35fdbb8fbc8de7e7479532a356dbbf2754d8a6e9c9fbfa430896cbb1ca89" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "webview2-com-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14690dcb8b57c5238c4502cfc321f858fa1306edd4109e8e1d7ddee0c29b06a5" +dependencies = [ + "regex", + "serde", + "serde_json", + "thiserror", + "windows", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +dependencies = [ + "winapi", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef84dd25f4c69a271b1bba394532bf400523b43169de21dfc715e8f8e491053d" +dependencies = [ + "const-sha1", + "windows_gen", + "windows_macros", +] + +[[package]] +name = "windows_gen" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac7bb21b8ff5e801232b72a6ff554b4cc0cef9ed9238188c3ca78fe3968a7e5d" +dependencies = [ + "windows_quote", + "windows_reader", +] + +[[package]] +name = "windows_macros" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5566b8c51118769e4a9094a688bf1233a3f36aacbfc78f3b15817fe0b6e0442f" +dependencies = [ + "syn", + "windows_gen", + "windows_quote", + "windows_reader", +] + +[[package]] +name = "windows_quote" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4af8236a9493c38855f95cdd11b38b342512a5df4ee7473cffa828b5ebb0e39c" + +[[package]] +name = "windows_reader" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c8d5cf83fb08083438c5c46723e6206b2970da57ce314f80b57724439aaacab" + +[[package]] +name = "winres" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +dependencies = [ + "toml", +] + +[[package]] +name = "wry" +version = "0.12.2" +dependencies = [ + "cocoa", + "core-graphics 0.22.3", + "gdk", + "gio", + "glib", + "gtk", + "http", + "libc", + "log", + "objc", + "objc_id", + "once_cell", + "serde", + "serde_json", + "tao", + "thiserror", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows", +] + +[[package]] +name = "x11-dl" +version = "2.19.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea26926b4ce81a6f5d9d0f3a0bc401e5a37c6ae14a1bfaa8ff6099ca80038c59" +dependencies = [ + "lazy_static", + "libc", + "pkg-config", +] + +[[package]] +name = "xattr" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" +dependencies = [ + "libc", +] + +[[package]] +name = "zip" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ab48844d61251bb3835145c521d88aa4031d7139e8485990f60ca911fa0815" +dependencies = [ + "byteorder", + "bzip2", + "crc32fast", + "flate2", + "thiserror", + "time", +] + +[[package]] +name = "zstd" +version = "0.9.0+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07749a5dc2cb6b36661290245e350f15ec3bbb304e493db54a1d354480522ccd" +dependencies = [ + "zstd-safe", +] + +[[package]] +name = "zstd-safe" +version = "4.1.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91c90f2c593b003603e5e0493c837088df4469da25aafff8bce42ba48caf079" +dependencies = [ + "libc", + "zstd-sys", +] + +[[package]] +name = "zstd-sys" +version = "1.6.1+zstd.1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "615120c7a2431d16cf1cf979e7fc31ba7a5b5e5707b29c8a99e5dbf8a8392a33" +dependencies = [ + "cc", + "libc", +] diff --git a/examples/isolation/src-tauri/Cargo.toml b/examples/isolation/src-tauri/Cargo.toml new file mode 100644 index 000000000..4ae9cea0d --- /dev/null +++ b/examples/isolation/src-tauri/Cargo.toml @@ -0,0 +1,21 @@ +[package] +name = "app" +version = "0.1.0" +description = "An example Tauri Application showcasing the isolation pattern" +edition = "2021" +license = "Apache-2.0 OR MIT" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[build-dependencies] +tauri-build = { path = "../../../core/tauri-build", features = [ "isolation" ] } + +[dependencies] +serde_json = "1.0" +serde = { version = "1.0", features = ["derive"] } +tauri = { path = "../../../core/tauri", features = [ "isolation" ] } + +[features] +default = [ "custom-protocol", "isolation" ] +isolation = [ "tauri/isolation", "tauri-build/isolation" ] +custom-protocol = [ "tauri/custom-protocol" ] diff --git a/examples/isolation/src-tauri/LICENSE_APACHE-2.0 b/examples/isolation/src-tauri/LICENSE_APACHE-2.0 new file mode 120000 index 000000000..5ee573597 --- /dev/null +++ b/examples/isolation/src-tauri/LICENSE_APACHE-2.0 @@ -0,0 +1 @@ +../../../LICENSE_APACHE-2.0 \ No newline at end of file diff --git a/examples/isolation/src-tauri/LICENSE_MIT b/examples/isolation/src-tauri/LICENSE_MIT new file mode 120000 index 000000000..71b666341 --- /dev/null +++ b/examples/isolation/src-tauri/LICENSE_MIT @@ -0,0 +1 @@ +../../../LICENSE_MIT \ No newline at end of file diff --git a/examples/isolation/src-tauri/build.rs b/examples/isolation/src-tauri/build.rs new file mode 100644 index 000000000..68540db55 --- /dev/null +++ b/examples/isolation/src-tauri/build.rs @@ -0,0 +1,13 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +use tauri_build::{try_build, Attributes, WindowsAttributes}; + +fn main() { + try_build( + Attributes::new() + .windows_attributes(WindowsAttributes::new().window_icon_path("../../.icons/icon.ico")), + ) + .expect("could not build tauri application"); +} diff --git a/examples/isolation/src-tauri/src/main.rs b/examples/isolation/src-tauri/src/main.rs new file mode 100644 index 000000000..317c015b1 --- /dev/null +++ b/examples/isolation/src-tauri/src/main.rs @@ -0,0 +1,30 @@ +// Copyright 2019-2021 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +#![cfg_attr( + all(not(debug_assertions), target_os = "windows"), + windows_subsystem = "windows" +)] + +use std::time::Instant; + +#[tauri::command] +fn ping() { + dbg!(format!("ping: {:?}", Instant::now())); +} + +#[cfg(not(feature = "isolation"))] +fn main() { + compile_error!("Feature `isolation` is required to run this example"); +} + +#[cfg(feature = "isolation")] +fn main() { + tauri::Builder::default() + .invoke_handler(tauri::generate_handler![ping]) + .run(tauri::generate_context!( + "../../examples/isolation/src-tauri/tauri.conf.json" + )) + .expect("error while running tauri application"); +} diff --git a/examples/isolation/src-tauri/tauri.conf.json b/examples/isolation/src-tauri/tauri.conf.json new file mode 100644 index 000000000..3a14c8eea --- /dev/null +++ b/examples/isolation/src-tauri/tauri.conf.json @@ -0,0 +1,71 @@ +{ + "package": { + "productName": "isolation", + "version": "0.1.0" + }, + "build": { + "distDir": "../dist", + "devPath": "../dist", + "beforeDevCommand": "", + "beforeBuildCommand": "", + "withGlobalTauri": true + }, + "tauri": { + "pattern": { + "use": "isolation", + "options": { + "dir": "../isolation-dist" + } + }, + "bundle": { + "active": true, + "targets": "all", + "identifier": "com.tauri.isolation", + "icon": [ + "../../.icons/32x32.png", + "../../.icons/128x128.png", + "../../.icons/128x128@2x.png", + "../../.icons/icon.icns", + "../../.icons/icon.ico" + ], + "resources": [], + "externalBin": [], + "copyright": "", + "category": "DeveloperTool", + "shortDescription": "", + "longDescription": "", + "deb": { + "depends": [], + "useBootstrapper": false + }, + "macOS": { + "frameworks": [], + "minimumSystemVersion": "", + "useBootstrapper": false, + "exceptionDomain": "", + "signingIdentity": null, + "entitlements": null + }, + "windows": { + "certificateThumbprint": null, + "digestAlgorithm": "sha256", + "timestampUrl": "" + } + }, + "updater": { + "active": false + }, + "windows": [ + { + "title": "Isolation", + "width": 800, + "height": 600, + "resizable": true, + "fullscreen": false + } + ], + "security": { + "csp": "default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'" + } + } +} diff --git a/examples/isolation/yarn.lock b/examples/isolation/yarn.lock new file mode 100644 index 000000000..39b685a5a --- /dev/null +++ b/examples/isolation/yarn.lock @@ -0,0 +1,13 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +"@tauri-apps/api@../../tooling/api/dist": + version "1.0.0-beta.8" + dependencies: + type-fest "2.5.1" + +type-fest@2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.5.1.tgz#17ba4f36a6abfabf0a92005d045dca77564607b0" + integrity sha512-JDcsxbLR6Z6OcL7TnGAAAGQrY4g7Q4EEALMT4Kp6FQuIc0JLQvOF3l7ejFvx8o5GmLlfMseTWUL++sYFP+o8kw== diff --git a/examples/multiwindow/src-tauri/Cargo.toml b/examples/multiwindow/src-tauri/Cargo.toml index d129e21d2..7c84ef894 100644 --- a/examples/multiwindow/src-tauri/Cargo.toml +++ b/examples/multiwindow/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "multiwindow" version = "0.1.0" description = "An example Tauri Multi-Window Application" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" license = "Apache-2.0 OR MIT" [build-dependencies] diff --git a/examples/navigation/src-tauri/Cargo.toml b/examples/navigation/src-tauri/Cargo.toml index 0216a11fb..b0b733d19 100644 --- a/examples/navigation/src-tauri/Cargo.toml +++ b/examples/navigation/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "navigation" version = "0.1.0" description = "A very simple Tauri Appplication with navigation" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/resources/src-tauri/Cargo.toml b/examples/resources/src-tauri/Cargo.toml index 87dc31cee..c193cbed4 100644 --- a/examples/resources/src-tauri/Cargo.toml +++ b/examples/resources/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "resources" version = "0.1.0" description = "A Tauri application that uses Node.js with app resources" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/sidecar/src-tauri/Cargo.toml b/examples/sidecar/src-tauri/Cargo.toml index 1c1ca34e6..5ce2dfbd9 100644 --- a/examples/sidecar/src-tauri/Cargo.toml +++ b/examples/sidecar/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "sidecar" version = "0.1.0" description = "A Tauri application with a sidecar binary" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/splashscreen/src-tauri/Cargo.toml b/examples/splashscreen/src-tauri/Cargo.toml index f6ff9c516..724de997d 100644 --- a/examples/splashscreen/src-tauri/Cargo.toml +++ b/examples/splashscreen/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "splashscreen" version = "0.1.0" description = "An example Tauri Application with a splashscreen" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" license = "Apache-2.0 OR MIT" [build-dependencies] diff --git a/examples/state/src-tauri/Cargo.toml b/examples/state/src-tauri/Cargo.toml index 151312878..e07a128d9 100644 --- a/examples/state/src-tauri/Cargo.toml +++ b/examples/state/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "state" version = "0.1.0" description = "A simple Tauri Appplication showcase the state functionality" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/streaming/src-tauri/Cargo.toml b/examples/streaming/src-tauri/Cargo.toml index 2a8e49928..e16469f5e 100644 --- a/examples/streaming/src-tauri/Cargo.toml +++ b/examples/streaming/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "streaming" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../core/tauri-build", features = [ "codegen" ] } diff --git a/examples/updater/src-tauri/Cargo.toml b/examples/updater/src-tauri/Cargo.toml index c6fc4921d..5bba5d300 100644 --- a/examples/updater/src-tauri/Cargo.toml +++ b/examples/updater/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "updater-example" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" license = "Apache-2.0 OR MIT" [build-dependencies] diff --git a/package.json b/package.json index 9817cff6d..9dd91bb71 100644 --- a/package.json +++ b/package.json @@ -19,5 +19,8 @@ "covector": "^0.5.3", "husky": "^6.0.0", "prettier": "^2.2.1" + }, + "dependencies": { + "typescript": "^4.5.4" } } diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index b40984d62..e6326b948 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -13,17 +13,13 @@ declare global { // eslint-disable-next-line @typescript-eslint/no-unused-vars interface Window { - __TAURI_POST_MESSAGE__: ( - command: string, - args?: { [key: string]: unknown } - ) => void + __TAURI_IPC__: (message: any) => void, + ipc: { + postMessage: (args: string) => void + } } } -// the `__TAURI_INVOKE_KEY__` variable is injected at runtime by Tauri -// eslint-disable-next-line @typescript-eslint/naming-convention -declare let __TAURI_INVOKE_KEY__: number - /** @ignore */ function uid(): number { return window.crypto.getRandomValues(new Uint32Array(1))[0] @@ -80,12 +76,14 @@ async function invoke(cmd: string, args: InvokeArgs = {}): Promise { Reflect.deleteProperty(window, callback) }, true) - window.__TAURI_POST_MESSAGE__(cmd, { - __invokeKey: __TAURI_INVOKE_KEY__, - callback, - error, - ...args - }) + window.__TAURI_IPC__( + { + cmd, + callback, + error, + ...args + } + ) }) } diff --git a/tooling/bench/Cargo.toml b/tooling/bench/Cargo.toml index e61cad8f7..ca65f2a03 100644 --- a/tooling/bench/Cargo.toml +++ b/tooling/bench/Cargo.toml @@ -5,7 +5,7 @@ name = "tauri_bench" version = "0.1.0" authors = [ "Tauri Programme within The Commons Conservancy" ] edition = "2021" -rust-version = "1.56" +rust-version = "1.57" license = "Apache-2.0 OR MIT" description = "Cross-platform WebView rendering library" repository = "https://github.com/tauri-apps/wry" diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml b/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml index 5ecafa616..9e0e991b0 100644 --- a/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml +++ b/tooling/bench/tests/cpu_intensive/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "bench_cpu_intensive" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] } diff --git a/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml b/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml index 7fbbb8546..1e7a4954f 100644 --- a/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml +++ b/tooling/bench/tests/files_transfer/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "bench_files_transfer" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] } diff --git a/tooling/bench/tests/helloworld/src-tauri/Cargo.toml b/tooling/bench/tests/helloworld/src-tauri/Cargo.toml index 143ba5b19..4fcff3628 100644 --- a/tooling/bench/tests/helloworld/src-tauri/Cargo.toml +++ b/tooling/bench/tests/helloworld/src-tauri/Cargo.toml @@ -3,7 +3,7 @@ name = "bench_helloworld" version = "0.1.0" description = "A very simple Tauri Appplication" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [build-dependencies] tauri-build = { path = "../../../../../core/tauri-build", features = [ "codegen" ] } diff --git a/tooling/bundler/Cargo.toml b/tooling/bundler/Cargo.toml index 772757bc3..a8a0e076b 100644 --- a/tooling/bundler/Cargo.toml +++ b/tooling/bundler/Cargo.toml @@ -13,7 +13,7 @@ keywords = [ "bundle", "cargo", "tauri" ] repository = "https://github.com/tauri-apps/tauri" description = "Wrap rust executables in OS-specific app bundles for Tauri" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = [ ".license_template", "CHANGELOG.md", diff --git a/tooling/cli.js/test/jest/fixtures/app/src-tauri/Cargo.toml b/tooling/cli.js/test/jest/fixtures/app/src-tauri/Cargo.toml index 145ead545..41a44858e 100644 --- a/tooling/cli.js/test/jest/fixtures/app/src-tauri/Cargo.toml +++ b/tooling/cli.js/test/jest/fixtures/app/src-tauri/Cargo.toml @@ -8,7 +8,7 @@ authors = [ "Tauri Programme within The Commons Conservancy" ] license = "" repository = "" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [package.metadata.bundle] identifier = "com.tauri.dev" diff --git a/tooling/cli.rs/Cargo.lock b/tooling/cli.rs/Cargo.lock index 69182de28..ad2e9c35e 100644 --- a/tooling/cli.rs/Cargo.lock +++ b/tooling/cli.rs/Cargo.lock @@ -14,6 +14,41 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" +[[package]] +name = "aead" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" +dependencies = [ + "generic-array 0.14.4", +] + +[[package]] +name = "aes" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" +dependencies = [ + "cfg-if 1.0.0", + "cipher", + "cpufeatures", + "opaque-debug 0.3.0", +] + +[[package]] +name = "aes-gcm" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" +dependencies = [ + "aead", + "aes", + "cipher", + "ctr", + "ghash", + "subtle", +] + [[package]] name = "aho-corasick" version = "0.7.18" @@ -112,6 +147,15 @@ dependencies = [ "generic-array 0.14.5", ] +[[package]] +name = "block-buffer" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95" +dependencies = [ + "generic-array 0.14.4", +] + [[package]] name = "block-padding" version = "0.1.5" @@ -410,6 +454,15 @@ dependencies = [ "syn", ] +[[package]] +name = "ctr" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" +dependencies = [ + "cipher", +] + [[package]] name = "darling" version = "0.13.1" @@ -501,6 +554,18 @@ dependencies = [ "subtle", ] +[[package]] +name = "digest" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b" +dependencies = [ + "block-buffer 0.10.0", + "crypto-common", + "generic-array 0.14.4", + "subtle", +] + [[package]] name = "dirs-next" version = "2.0.0" @@ -720,6 +785,16 @@ dependencies = [ "wasi 0.10.2+wasi-snapshot-preview1", ] +[[package]] +name = "ghash" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" +dependencies = [ + "opaque-debug 0.3.0", + "polyval", +] + [[package]] name = "gif" version = "0.11.3" @@ -1586,6 +1661,18 @@ dependencies = [ "miniz_oxide 0.3.7", ] +[[package]] +name = "polyval" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "opaque-debug 0.3.0", + "universal-hash", +] + [[package]] name = "ppv-lite86" version = "0.2.16" @@ -1961,7 +2048,7 @@ dependencies = [ "hmac", "pbkdf2", "salsa20", - "sha2", + "sha2 0.10.0", ] [[package]] @@ -2088,6 +2175,26 @@ dependencies = [ "syn", ] +[[package]] +name = "serialize-to-javascript" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.0" +source = "git+https://github.com/chippers/serialize-to-javascript#38d5026f371bfba4f5197ed143a6667a09375fbd" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "servo_arc" version = "0.1.1" @@ -2127,6 +2234,17 @@ dependencies = [ "digest 0.10.1", ] +[[package]] +name = "sha2" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900d964dd36bb15bcf2f2b35694c072feab74969a54f2bbeec7a2d725d2bdcb6" +dependencies = [ + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.10.1", +] + [[package]] name = "shared_child" version = "1.0.0" @@ -2261,7 +2379,7 @@ dependencies = [ "regex", "serde", "serde_json", - "sha2", + "sha2 0.9.8", "strsim", "tar", "tempfile", @@ -2320,6 +2438,8 @@ dependencies = [ name = "tauri-utils" version = "1.0.0-beta.3" dependencies = [ + "aes-gcm", + "base64", "heck", "html5ever", "kuchiki", @@ -2328,6 +2448,8 @@ dependencies = [ "serde", "serde_json", "serde_with", + "serialize-to-javascript", + "sha2 0.9.8", "thiserror", "url", ] @@ -2522,6 +2644,16 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" +[[package]] +name = "universal-hash" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" +dependencies = [ + "generic-array 0.14.4", + "subtle", +] + [[package]] name = "untrusted" version = "0.7.1" diff --git a/tooling/cli.rs/Cargo.toml b/tooling/cli.rs/Cargo.toml index 854fab540..cc9c4eec0 100644 --- a/tooling/cli.rs/Cargo.toml +++ b/tooling/cli.rs/Cargo.toml @@ -5,7 +5,7 @@ name = "tauri-cli" version = "1.0.0-beta.7" authors = [ "Tauri Programme within The Commons Conservancy" ] edition = "2021" -rust-version = "1.56" +rust-version = "1.57" categories = [ "gui", "web-programming" ] license = "Apache-2.0 OR MIT" homepage = "https://tauri.studio" @@ -63,7 +63,7 @@ humansize = "1.1" heck = "0.4" [build-dependencies] -tauri-utils = { version = "1.0.0-beta.3", features = ["schema"], path = "../../core/tauri-utils" } +tauri-utils = { version = "1.0.0-beta.3", features = ["schema", "isolation"], path = "../../core/tauri-utils" } schemars = { version = "0.8", features = ["url"] } serde = { version = "1.0", features = [ "derive" ] } serde_json = "1.0" diff --git a/tooling/cli.rs/schema.json b/tooling/cli.rs/schema.json index 1abcc281b..0768283ae 100644 --- a/tooling/cli.rs/schema.json +++ b/tooling/cli.rs/schema.json @@ -156,7 +156,12 @@ } }, "macOSPrivateApi": false, - "security": {}, + "pattern": { + "use": "brownfield" + }, + "security": { + "freezePrototype": true + }, "updater": { "active": false, "dialog": true, @@ -1187,6 +1192,54 @@ }, "additionalProperties": false }, + "PatternKind": { + "description": "The application pattern.", + "oneOf": [ + { + "description": "Brownfield pattern.", + "type": "object", + "required": [ + "use" + ], + "properties": { + "use": { + "type": "string", + "enum": [ + "brownfield" + ] + } + } + }, + { + "description": "Isolation pattern. Recommended for security purposes.", + "type": "object", + "required": [ + "options", + "use" + ], + "properties": { + "options": { + "type": "object", + "required": [ + "dir" + ], + "properties": { + "dir": { + "description": "The dir containing the index.html file that contains the secure isolation application.", + "type": "string" + } + } + }, + "use": { + "type": "string", + "enum": [ + "isolation" + ] + } + } + } + ] + }, "PluginConfig": { "description": "The plugin configs holds a HashMap mapping a plugin name to its configuration object.", "type": "object", @@ -1259,6 +1312,11 @@ "string", "null" ] + }, + "freezePrototype": { + "description": "Freeze the `Object.prototype` when using the custom protocol.", + "default": true, + "type": "boolean" } }, "additionalProperties": false @@ -1470,9 +1528,22 @@ "default": false, "type": "boolean" }, + "pattern": { + "description": "The pattern to use.", + "default": { + "use": "brownfield" + }, + "allOf": [ + { + "$ref": "#/definitions/PatternKind" + } + ] + }, "security": { "description": "Security configuration.", - "default": {}, + "default": { + "freezePrototype": true + }, "allOf": [ { "$ref": "#/definitions/SecurityConfig" diff --git a/tooling/cli.rs/src/helpers/manifest.rs b/tooling/cli.rs/src/helpers/manifest.rs index a283ac76e..cdbd908ae 100644 --- a/tooling/cli.rs/src/helpers/manifest.rs +++ b/tooling/cli.rs/src/helpers/manifest.rs @@ -2,10 +2,12 @@ // SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: MIT -use super::{app_paths::tauri_dir, config::ConfigHandle}; +use super::{ + app_paths::tauri_dir, + config::{ConfigHandle, PatternKind}, +}; use anyhow::Context; -use tauri_utils::config::Allowlist; use toml_edit::{Array, Document, InlineTable, Item, Table, Value}; use std::{ @@ -45,46 +47,35 @@ fn toml_array(features: &HashSet) -> Array { f } -pub fn rewrite_manifest(config: ConfigHandle) -> crate::Result { - let manifest_path = tauri_dir().join("Cargo.toml"); - let mut manifest = read_manifest(&manifest_path)?; - let dependencies = manifest - .as_table_mut() - .entry("dependencies") - .or_insert(Item::Table(Table::new())) - .as_table_mut() - .expect("manifest dependencies isn't a table"); +fn write_features( + dependencies: &mut Table, + dependency_name: &str, + all_features: Vec<&str>, + features: &mut HashSet, +) -> crate::Result { + let item = dependencies.entry(dependency_name).or_insert(Item::None); - let tauri_item = dependencies.entry("tauri").or_insert(Item::None); - - let config_guard = config.lock().unwrap(); - let config = config_guard.as_ref().unwrap(); - - let mut features = HashSet::from_iter(config.tauri.features().into_iter().map(|f| f.to_string())); - - let mut cli_managed_features = super::config::AllowlistConfig::all_features(); - cli_managed_features.extend(vec!["cli", "updater", "system-tray"]); - - if let Some(tauri) = tauri_item.as_table_mut() { - let manifest_features = tauri.entry("features").or_insert(Item::None); + if let Some(dep) = item.as_table_mut() { + let manifest_features = dep.entry("features").or_insert(Item::None); if let Item::Value(Value::Array(f)) = &manifest_features { for feat in f.iter() { if let Value::String(feature) = feat { - if !cli_managed_features.contains(&feature.value().as_str()) { + if !all_features.contains(&feature.value().as_str()) { features.insert(feature.value().to_string()); } } } } *manifest_features = Item::Value(Value::Array(toml_array(&features))); - } else if let Some(tauri) = tauri_item.as_value_mut() { - match tauri { + Ok(true) + } else if let Some(dep) = item.as_value_mut() { + match dep { Value::InlineTable(table) => { let manifest_features = table.get_or_insert("features", Value::Array(Default::default())); if let Value::Array(f) = &manifest_features { for feat in f.iter() { if let Value::String(feature) = feat { - if !cli_managed_features.contains(&feature.value().as_str()) { + if !all_features.contains(&feature.value().as_str()) { features.insert(feature.value().to_string()); } } @@ -99,33 +90,88 @@ pub fn rewrite_manifest(config: ConfigHandle) -> crate::Result { version.to_string().replace('\"', "").replace(' ', ""), ); def.get_or_insert("features", Value::Array(toml_array(&features))); - *tauri = Value::InlineTable(def); + *dep = Value::InlineTable(def); } _ => { return Err(anyhow::anyhow!( - "Unsupported tauri dependency format on Cargo.toml" + "Unsupported {} dependency format on Cargo.toml", + dependency_name )) } } + Ok(true) } else { - return Ok(Manifest { features }); + Ok(false) } +} - let mut manifest_file = - File::create(&manifest_path).with_context(|| "failed to open Cargo.toml for rewrite")?; - manifest_file.write_all( +pub fn rewrite_manifest(config: ConfigHandle) -> crate::Result { + let manifest_path = tauri_dir().join("Cargo.toml"); + let mut manifest = read_manifest(&manifest_path)?; + + let config_guard = config.lock().unwrap(); + let config = config_guard.as_ref().unwrap(); + + let mut tauri_build_features = HashSet::new(); + if let PatternKind::Isolation { .. } = config.tauri.pattern { + tauri_build_features.insert("isolation".to_string()); + } + let resp = write_features( manifest - .to_string() - // apply some formatting fixes - .replace(r#"" ,features =["#, r#"", features = ["#) - .replace("]}", "] }") - .replace("={", "= {") - .replace("=[", "= [") - .as_bytes(), + .as_table_mut() + .entry("build-dependencies") + .or_insert(Item::Table(Table::new())) + .as_table_mut() + .expect("manifest build-dependencies isn't a table"), + "tauri-build", + vec!["isolation"], + &mut tauri_build_features, )?; - manifest_file.flush()?; - Ok(Manifest { features }) + let mut tauri_features = + HashSet::from_iter(config.tauri.features().into_iter().map(|f| f.to_string())); + let cli_managed_tauri_features = super::config::TauriConfig::all_features(); + let res = match write_features( + manifest + .as_table_mut() + .entry("dependencies") + .or_insert(Item::Table(Table::new())) + .as_table_mut() + .expect("manifest dependencies isn't a table"), + "tauri", + cli_managed_tauri_features, + &mut tauri_features, + ) { + Err(e) => Err(e), + Ok(t) if !resp => Ok(t), + _ => Ok(true), + }; + + match res { + Ok(true) => { + let mut manifest_file = + File::create(&manifest_path).with_context(|| "failed to open Cargo.toml for rewrite")?; + manifest_file.write_all( + manifest + .to_string() + // apply some formatting fixes + .replace(r#"" ,features =["#, r#"", features = ["#) + .replace(r#"" , features"#, r#"", features"#) + .replace("]}", "] }") + .replace("={", "= {") + .replace("=[", "= [") + .as_bytes(), + )?; + manifest_file.flush()?; + Ok(Manifest { + features: tauri_features, + }) + } + Ok(false) => Ok(Manifest { + features: tauri_features, + }), + Err(e) => Err(e), + } } pub fn get_workspace_members() -> crate::Result> { diff --git a/tooling/cli.rs/templates/app/src-tauri/Cargo.crate-manifest b/tooling/cli.rs/templates/app/src-tauri/Cargo.crate-manifest index a706c365e..af7a0e643 100755 --- a/tooling/cli.rs/templates/app/src-tauri/Cargo.crate-manifest +++ b/tooling/cli.rs/templates/app/src-tauri/Cargo.crate-manifest @@ -7,7 +7,7 @@ license = "" repository = "" default-run = "app" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/tooling/cli.rs/templates/plugin/backend/Cargo.crate-manifest b/tooling/cli.rs/templates/plugin/backend/Cargo.crate-manifest index 8066a2b13..08963b9c9 100755 --- a/tooling/cli.rs/templates/plugin/backend/Cargo.crate-manifest +++ b/tooling/cli.rs/templates/plugin/backend/Cargo.crate-manifest @@ -4,7 +4,7 @@ version = "0.0.0" authors = [ "{{ author }}" ] description = "" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = ["/examples"] [dependencies] diff --git a/tooling/cli.rs/templates/plugin/backend/examples/vanilla/src-tauri/Cargo.crate-manifest b/tooling/cli.rs/templates/plugin/backend/examples/vanilla/src-tauri/Cargo.crate-manifest index 942f67f17..4d1f62dcf 100644 --- a/tooling/cli.rs/templates/plugin/backend/examples/vanilla/src-tauri/Cargo.crate-manifest +++ b/tooling/cli.rs/templates/plugin/backend/examples/vanilla/src-tauri/Cargo.crate-manifest @@ -5,7 +5,7 @@ description = "A Tauri App" authors = [ "{{ author }}" ] repository = "" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [dependencies] serde_json = "1.0" diff --git a/tooling/cli.rs/templates/plugin/with-api/Cargo.crate-manifest b/tooling/cli.rs/templates/plugin/with-api/Cargo.crate-manifest index 889c1d266..5ef4b0fff 100644 --- a/tooling/cli.rs/templates/plugin/with-api/Cargo.crate-manifest +++ b/tooling/cli.rs/templates/plugin/with-api/Cargo.crate-manifest @@ -4,7 +4,7 @@ version = "0.0.0" authors = [ "{{ author }}" ] description = "" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" exclude = ["/examples", "/webview-dist", "/webview-src", "node_modules"] [dependencies] diff --git a/tooling/cli.rs/templates/plugin/with-api/examples/svelte-app/src-tauri/Cargo.crate-manifest b/tooling/cli.rs/templates/plugin/with-api/examples/svelte-app/src-tauri/Cargo.crate-manifest index 942f67f17..4d1f62dcf 100644 --- a/tooling/cli.rs/templates/plugin/with-api/examples/svelte-app/src-tauri/Cargo.crate-manifest +++ b/tooling/cli.rs/templates/plugin/with-api/examples/svelte-app/src-tauri/Cargo.crate-manifest @@ -5,7 +5,7 @@ description = "A Tauri App" authors = [ "{{ author }}" ] repository = "" edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [dependencies] serde_json = "1.0" diff --git a/tooling/create-tauri-app/src/templates/dominator/_Cargo.toml b/tooling/create-tauri-app/src/templates/dominator/_Cargo.toml index c12cae2b8..f9e45337e 100644 --- a/tooling/create-tauri-app/src/templates/dominator/_Cargo.toml +++ b/tooling/create-tauri-app/src/templates/dominator/_Cargo.toml @@ -3,7 +3,7 @@ name = "<%= name %>" version = "1.0.0" categories = ["wasm"] edition = "2021" -rust-version = "1.56" +rust-version = "1.57" description = "" [profile.release] diff --git a/tooling/webdriver/Cargo.toml b/tooling/webdriver/Cargo.toml index f550b2b07..7c5089409 100644 --- a/tooling/webdriver/Cargo.toml +++ b/tooling/webdriver/Cargo.toml @@ -12,7 +12,7 @@ description = "Webdriver server for Tauri applications" readme = "README.md" exclude = [ ".license_template", "/target" ] edition = "2021" -rust-version = "1.56" +rust-version = "1.57" [dependencies] anyhow = "1"