diff --git a/.github/workflows/lint-fmt-cli.yml b/.github/workflows/lint-fmt-cli.yml index 74d5b83f4..b672e170b 100644 --- a/.github/workflows/lint-fmt-cli.yml +++ b/.github/workflows/lint-fmt-cli.yml @@ -33,7 +33,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt diff --git a/.github/workflows/lint-fmt-core.yml b/.github/workflows/lint-fmt-core.yml index c492a54a0..15998979a 100644 --- a/.github/workflows/lint-fmt-core.yml +++ b/.github/workflows/lint-fmt-core.yml @@ -34,7 +34,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt diff --git a/.github/workflows/test-bundler.yml b/.github/workflows/test-bundler.yml index e497603e2..4524c24eb 100644 --- a/.github/workflows/test-bundler.yml +++ b/.github/workflows/test-bundler.yml @@ -92,7 +92,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt diff --git a/.license_template b/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-build/.license_template b/core/tauri-build/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-build/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-codegen/.license_template b/core/tauri-codegen/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-codegen/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-macros/.license_template b/core/tauri-macros/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-macros/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-runtime-wry/.license_template b/core/tauri-runtime-wry/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-runtime-wry/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-runtime-wry/src/lib.rs b/core/tauri-runtime-wry/src/lib.rs index 171f7f067..452563b93 100644 --- a/core/tauri-runtime-wry/src/lib.rs +++ b/core/tauri-runtime-wry/src/lib.rs @@ -100,6 +100,8 @@ use std::{ }; pub type WebviewId = u64; +type IpcHandler = dyn Fn(&Window, String) + 'static; +type FileDropHandler = dyn Fn(&Window, WryFileDropEvent) -> bool + 'static; mod webview; pub use webview::Webview; @@ -3067,7 +3069,7 @@ fn create_ipc_handler( menu_ids: Arc>>, js_event_listeners: Arc>>>, handler: WebviewIpcHandler>, -) -> Box { +) -> Box { Box::new(move |window, request| { let window_id = context.webview_id_map.get(&window.id()); handler( @@ -3086,9 +3088,7 @@ fn create_ipc_handler( } /// Create a wry file drop handler. -fn create_file_drop_handler( - context: &Context, -) -> Box bool + 'static> { +fn create_file_drop_handler(context: &Context) -> Box { let window_event_listeners = context.window_event_listeners.clone(); let webview_id_map = context.webview_id_map.clone(); Box::new(move |window, event| { diff --git a/core/tauri-runtime/.license_template b/core/tauri-runtime/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-runtime/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri-utils/.license_template b/core/tauri-utils/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri-utils/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri/.license_template b/core/tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/core/tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 72035a1da..340a12d09 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -25,7 +25,6 @@ use tauri_utils::{ html::{SCRIPT_NONCE_TOKEN, STYLE_NONCE_TOKEN}, }; -use crate::app::{GlobalMenuEventListener, WindowMenuEvent}; use crate::hooks::IpcJavascript; #[cfg(feature = "isolation")] use crate::hooks::IsolationJavascript; @@ -51,6 +50,10 @@ use crate::{ Context, EventLoopMessage, Icon, Invoke, Manager, Pattern, Runtime, Scopes, StateManager, Window, WindowEvent, }; +use crate::{ + app::{GlobalMenuEventListener, WindowMenuEvent}, + window::WebResourceRequestHandler, +}; #[cfg(any(target_os = "linux", target_os = "windows"))] use crate::api::path::{resolve_path, BaseDirectory}; @@ -390,9 +393,7 @@ impl WindowManager { label: &str, window_labels: &[String], app_handle: AppHandle, - web_resource_request_handler: Option< - Box, - >, + web_resource_request_handler: Option>, ) -> crate::Result> { let is_init_global = self.inner.config.build.with_global_tauri; let plugin_init = self @@ -1045,9 +1046,7 @@ impl WindowManager { app_handle: AppHandle, mut pending: PendingWindow, window_labels: &[String], - web_resource_request_handler: Option< - Box, - >, + web_resource_request_handler: Option>, ) -> crate::Result> { if self.windows_lock().contains_key(&pending.label) { return Err(crate::Error::WindowLabelAlreadyExists(pending.label)); diff --git a/core/tauri/src/updater/core.rs b/core/tauri/src/updater/core.rs index f7fbd625a..96e9127d4 100644 --- a/core/tauri/src/updater/core.rs +++ b/core/tauri/src/updater/core.rs @@ -46,6 +46,8 @@ use std::{ process::{exit, Command}, }; +type ShouldInstall = dyn FnOnce(&Version, &RemoteRelease) -> bool + Send; + #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum RemoteReleaseInner { @@ -209,7 +211,7 @@ pub struct UpdateBuilder { pub target: Option, /// The current executable path. Default is automatically extracted. pub executable_path: Option, - should_install: Option bool + Send>>, + should_install: Option>, timeout: Option, headers: HeaderMap, } diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index d7171e2d1..dae3239a3 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -45,6 +45,8 @@ use std::{ sync::Arc, }; +pub(crate) type WebResourceRequestHandler = dyn Fn(&HttpRequest, &mut HttpResponse) + Send + Sync; + #[derive(Clone, Serialize)] struct WindowCreatedEvent { label: String, @@ -103,7 +105,7 @@ pub struct WindowBuilder<'a, R: Runtime> { label: String, pub(crate) window_builder: >::WindowBuilder, pub(crate) webview_attributes: WebviewAttributes, - web_resource_request_handler: Option>, + web_resource_request_handler: Option>, } impl<'a, R: Runtime> fmt::Debug for WindowBuilder<'a, R> { diff --git a/core/tests/restart/.license_template b/core/tests/restart/.license_template deleted file mode 120000 index d1662c6c9..000000000 --- a/core/tests/restart/.license_template +++ /dev/null @@ -1 +0,0 @@ -../../../../.license_template \ No newline at end of file diff --git a/examples/api/src-tauri/.license_template b/examples/api/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/api/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/resources/src-tauri/.license_template b/examples/resources/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/resources/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/sidecar/src-tauri/.license_template b/examples/sidecar/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/sidecar/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/tauri-dynamic-lib/src-app1/.license_template b/examples/tauri-dynamic-lib/src-app1/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/tauri-dynamic-lib/src-app1/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/tauri-dynamic-lib/src-tauri/.license_template b/examples/tauri-dynamic-lib/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/tauri-dynamic-lib/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/examples/updater/src-tauri/.license_template b/examples/updater/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/examples/updater/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/rustfmt.toml b/rustfmt.toml index b0094a065..cb7457be1 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -14,4 +14,3 @@ force_explicit_abi = true # normalize_comments = true normalize_doc_attributes = true # wrap_comments = true -license_template_path = ".license_template" diff --git a/tooling/bench/tests/cpu_intensive/src-tauri/.license_template b/tooling/bench/tests/cpu_intensive/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/tooling/bench/tests/cpu_intensive/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/tooling/bench/tests/files_transfer/src-tauri/.license_template b/tooling/bench/tests/files_transfer/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/tooling/bench/tests/files_transfer/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/tooling/bench/tests/helloworld/src-tauri/.license_template b/tooling/bench/tests/helloworld/src-tauri/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/tooling/bench/tests/helloworld/src-tauri/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/tooling/bundler/.license_template b/tooling/bundler/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/tooling/bundler/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/tooling/cli/.license_template b/tooling/cli/.license_template deleted file mode 100644 index 9601f8a1b..000000000 --- a/tooling/cli/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT \ No newline at end of file diff --git a/tooling/cli/templates/plugin/backend/.github/workflows/format.yml b/tooling/cli/templates/plugin/backend/.github/workflows/format.yml index 2474d1612..25ac12af6 100644 --- a/tooling/cli/templates/plugin/backend/.github/workflows/format.yml +++ b/tooling/cli/templates/plugin/backend/.github/workflows/format.yml @@ -18,11 +18,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install rustfmt with nightly toolchain + - name: Install rustfmt with stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt - uses: actions-rs/cargo@v1 diff --git a/tooling/cli/templates/plugin/backend/.license_template b/tooling/cli/templates/plugin/backend/.license_template deleted file mode 100644 index ca31e10b5..000000000 --- a/tooling/cli/templates/plugin/backend/.license_template +++ /dev/null @@ -1 +0,0 @@ -{{ license_template }} \ No newline at end of file diff --git a/tooling/cli/templates/plugin/with-api/.github/workflows/format.yml b/tooling/cli/templates/plugin/with-api/.github/workflows/format.yml index 2474d1612..25ac12af6 100644 --- a/tooling/cli/templates/plugin/with-api/.github/workflows/format.yml +++ b/tooling/cli/templates/plugin/with-api/.github/workflows/format.yml @@ -18,11 +18,11 @@ jobs: steps: - uses: actions/checkout@v2 - - name: Install rustfmt with nightly toolchain + - name: Install rustfmt with stable toolchain uses: actions-rs/toolchain@v1 with: profile: minimal - toolchain: nightly + toolchain: stable override: true components: rustfmt - uses: actions-rs/cargo@v1 diff --git a/tooling/cli/templates/plugin/with-api/.license_template b/tooling/cli/templates/plugin/with-api/.license_template deleted file mode 100644 index ca31e10b5..000000000 --- a/tooling/cli/templates/plugin/with-api/.license_template +++ /dev/null @@ -1 +0,0 @@ -{{ license_template }} \ No newline at end of file diff --git a/tooling/webdriver/.license_template b/tooling/webdriver/.license_template deleted file mode 100644 index ef4038304..000000000 --- a/tooling/webdriver/.license_template +++ /dev/null @@ -1,3 +0,0 @@ -// Copyright {20\d{2}(-20\d{2})?} Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT