Skip to content

Commit

Permalink
Merge branch '1.x' into feat/notification-sound
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Jul 27, 2023
2 parents 2303e91 + e374bc1 commit 6c4dee9
Show file tree
Hide file tree
Showing 84 changed files with 1,921 additions and 969 deletions.
5 changes: 5 additions & 0 deletions .changes/api-formAsync.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tauri-apps/api': 'patch:bug'
---

Fix `Body.form` static not reading and sending entries of type `Blob` (including subclasses such as `File`)
5 changes: 5 additions & 0 deletions .changes/bundler-bundle-order.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

Fix bundler skipping updater artifacts if `updater` target shows before other updater-enabled targets in the list, see [#7349](https://github.com/tauri-apps/tauri/issues/7349).
5 changes: 5 additions & 0 deletions .changes/bundler-macos-updater-dmg-only-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

Fix bundler skipping updater artifacts if only a macOS DMG bundle target is specified.
5 changes: 5 additions & 0 deletions .changes/bundler-nsis-sign-uninstaller.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'minor:enhance'
---

Sign NSIS uninstaller as well.
6 changes: 6 additions & 0 deletions .changes/cli-disable-version-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'tauri-cli': 'patch:bug'
'@tauri-apps/cli': 'patch:bug'
---

Removed the automatic version check of the CLI that ran after `tauri` commands which caused various issues.
5 changes: 5 additions & 0 deletions .changes/core-base-links-target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:enhance'
---

Open links externally when `<base target="_blank" />` exists
5 changes: 5 additions & 0 deletions .changes/enhance-read-dir-error.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch:enhance
---

Enhance `readDir` API error with path information.
5 changes: 5 additions & 0 deletions .changes/fix-nsis-legal-copyright.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, fix installation packages not showing correct copyright information.
5 changes: 5 additions & 0 deletions .changes/fix-nsis-previous-installation-method.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, fix NSIS installer identifying a previous NSIS-installed app as WiX-installed app and then fails to uninstall it.
5 changes: 5 additions & 0 deletions .changes/fix-nsis-uninstall-previous-version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, fix NSIS installer showing an error dialog even when the previous version was uninstalled sucessfully.
5 changes: 5 additions & 0 deletions .changes/fix-nsis-webview2-installer-use-tempdir.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:enhance'
---

On Windows, NSIS installer will write webview2 installer file to the well-known temp dir instead of the install dir, so we don't pollute the install dir.
5 changes: 5 additions & 0 deletions .changes/kuchikiki.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-utils": patch:sec
---

Changed HTML implementation from unmaintained `kuchiki` to `kuchikiki`.
5 changes: 5 additions & 0 deletions .changes/nsis-start-menu-shortcut.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:bug'
---

On Windows, fix NSIS uninstaller failing to remove Start Menu shortcut if `perMachine` mode is used.
5 changes: 5 additions & 0 deletions .changes/plugin-custom-protocol.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'minor:feat'
---

Add `tauri::plugin::Builder::register_uri_scheme_protocol`
5 changes: 5 additions & 0 deletions .changes/remove-bitness.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-bundler': 'patch:deps'
---

Removed the `bitness` dependency to speed up compile time.
5 changes: 5 additions & 0 deletions .changes/resources-map-bundler.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-bundler": minor:feat
---

Allow using a resource map instead of a simple array in `BundleSettings::resources_map`.
5 changes: 5 additions & 0 deletions .changes/resources-map.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-utils": minor:feat
---

Allow specifying resources as a map specifying source and target paths.
5 changes: 5 additions & 0 deletions .changes/tauri-build-copy-webview2-runtime.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri-build': 'patch:bug'
---

Correctly copy the WebView2 runtime in development when `webviewInstallMode` is used instead of `webviewFixedRuntimePath`.
5 changes: 5 additions & 0 deletions .changes/updater-redirect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'tauri': 'patch:bug'
---

Fix updater not following endpoint redirects.
8 changes: 7 additions & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- cron: '0 0 * * *'
push:
paths:
- '.github/workflows/audit.yml'
- '**/Cargo.lock'
- '**/Cargo.toml'
- '**/package.json'
Expand All @@ -33,6 +34,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: yarn audit
- name: audit workspace
run: yarn audit
- name: audit @tauri-apps/api
working-directory: tooling/api
run: yarn audit
- name: audit @tauri-apps/cli
working-directory: tooling/cli/node
run: yarn audit
8 changes: 7 additions & 1 deletion .github/workflows/test-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
- name: Downgrade crates with MSRV conflict
# The --precise flag can only be used once per invocation.
run: |
cargo update -p toml:0.7.4 --precise 0.7.3
cargo update -p toml:0.7.6 --precise 0.7.3
cargo update -p toml_edit --precise 0.19.8
cargo update -p toml_datetime --precise 0.6.1
cargo update -p serde_spanned --precise 0.6.1
Expand All @@ -94,6 +94,12 @@ jobs:
cargo update -p ignore --precise 0.4.18
cargo update -p raw-window-handle --precise 0.5.0
cargo update -p cargo_toml:0.15.3 --precise 0.15.2
cargo update -p zbus --precise 3.13.0
cargo update -p zbus_names --precise 2.5.0
cargo update -p is-terminal --precise 0.4.7
cargo update -p colored --precise 2.0.2
cargo update -p tempfile --precise 3.6.0
cargo update -p serde_with:3.1.0 --precise 3.0.0
- name: test
run: cargo test --target ${{ matrix.platform.target }} ${{ matrix.features.args }}
35 changes: 25 additions & 10 deletions core/tauri-build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use cargo_toml::Manifest;
use heck::AsShoutySnakeCase;

use tauri_utils::{
config::Config,
resources::{external_binaries, resource_relpath, ResourcePaths},
config::{BundleResources, Config, WebviewInstallMode},
resources::{external_binaries, ResourcePaths},
};

use std::path::{Path, PathBuf};
Expand Down Expand Up @@ -72,11 +72,10 @@ fn copy_binaries(

/// Copies resources to a path.
fn copy_resources(resources: ResourcePaths<'_>, path: &Path) -> Result<()> {
for src in resources {
let src = src?;
println!("cargo:rerun-if-changed={}", src.display());
let dest = path.join(resource_relpath(&src));
copy_file(&src, dest)?;
for resource in resources.iter() {
let resource = resource?;
println!("cargo:rerun-if-changed={}", resource.path().display());
copy_file(resource.path(), path.join(resource.target()))?;
}
Ok(())
}
Expand Down Expand Up @@ -344,15 +343,31 @@ pub fn try_build(attributes: Attributes) -> Result<()> {
}

#[allow(unused_mut, clippy::redundant_clone)]
let mut resources = config.tauri.bundle.resources.clone().unwrap_or_default();
let mut resources = config
.tauri
.bundle
.resources
.clone()
.unwrap_or_else(|| BundleResources::List(Vec::new()));
if target_triple.contains("windows") {
if let Some(fixed_webview2_runtime_path) =
&config.tauri.bundle.windows.webview_fixed_runtime_path
match &config.tauri.bundle.windows.webview_fixed_runtime_path {
Some(path) => Some(path),
None => match &config.tauri.bundle.windows.webview_install_mode {
WebviewInstallMode::FixedRuntime { path } => Some(path),
_ => None,
},
}
{
resources.push(fixed_webview2_runtime_path.display().to_string());
}
}
copy_resources(ResourcePaths::new(resources.as_slice(), true), target_dir)?;
match resources {
BundleResources::List(res) => {
copy_resources(ResourcePaths::new(res.as_slice(), true), target_dir)?
}
BundleResources::Map(map) => copy_resources(ResourcePaths::from_map(&map, true), target_dir)?,
}

if target_triple.contains("darwin") {
if let Some(version) = &config.tauri.bundle.macos.minimum_system_version {
Expand Down
34 changes: 27 additions & 7 deletions core/tauri-config-schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1074,13 +1074,14 @@
},
"resources": {
"description": "App resources to bundle. Each resource is a path to a file or directory. Glob patterns are supported.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
"anyOf": [
{
"$ref": "#/definitions/BundleResources"
},
{
"type": "null"
}
]
},
"copyright": {
"description": "A copyright string associated with your application.",
Expand Down Expand Up @@ -1258,6 +1259,25 @@
}
]
},
"BundleResources": {
"description": "Definition for bundle resources. Can be either a list of paths to include or a map of source to target paths.",
"anyOf": [
{
"description": "A list of paths to include.",
"type": "array",
"items": {
"type": "string"
}
},
{
"description": "A map of source to target paths.",
"type": "object",
"additionalProperties": {
"type": "string"
}
}
]
},
"AppImageConfig": {
"description": "Configuration for AppImage bundles.\n\nSee more: https://tauri.app/v1/api/config#appimageconfig",
"type": "object",
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3045,7 +3045,7 @@ fn on_close_requested<'a, T: UserEvent>(
}

fn on_window_close(window_id: WebviewId, windows: Arc<RefCell<HashMap<WebviewId, WindowWrapper>>>) {
if let Some(mut window_wrapper) = windows.borrow_mut().get_mut(&window_id) {
if let Some(window_wrapper) = windows.borrow_mut().get_mut(&window_id) {
window_wrapper.inner = None;
}
}
Expand Down
4 changes: 2 additions & 2 deletions core/tauri-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ thiserror = "1"
phf = { version = "0.10", features = [ "macros" ] }
brotli = { version = "3", optional = true, default-features = false, features = [ "std" ] }
url = { version = "2", features = [ "serde" ] }
kuchiki = "0.8"
html5ever = "0.25"
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
proc-macro2 = { version = "1", optional = true }
quote = { version = "1", optional = true }
schemars = { version = "0.8", features = [ "url" ], optional = true }
Expand Down
27 changes: 26 additions & 1 deletion core/tauri-utils/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,31 @@ impl Default for WindowsConfig {
}
}

/// Definition for bundle resources.
/// Can be either a list of paths to include or a map of source to target paths.
#[derive(Debug, PartialEq, Eq, Clone, Deserialize, Serialize)]
#[cfg_attr(feature = "schema", derive(JsonSchema))]
#[serde(rename_all = "camelCase", deny_unknown_fields, untagged)]
pub enum BundleResources {
/// A list of paths to include.
List(Vec<String>),
/// A map of source to target paths.
Map(HashMap<String, String>),
}

impl BundleResources {
/// Adds a path to the resource collection.
pub fn push(&mut self, path: impl Into<String>) {
match self {
Self::List(l) => l.push(path.into()),
Self::Map(l) => {
let path = path.into();
l.insert(path.clone(), path);
}
}
}
}

/// Configuration for tauri-bundler.
///
/// See more: https://tauri.app/v1/api/config#bundleconfig
Expand Down Expand Up @@ -653,7 +678,7 @@ pub struct BundleConfig {
/// App resources to bundle.
/// Each resource is a path to a file or directory.
/// Glob patterns are supported.
pub resources: Option<Vec<String>>,
pub resources: Option<BundleResources>,
/// A copyright string associated with your application.
pub copyright: Option<String>,
/// The application kind.
Expand Down
2 changes: 1 addition & 1 deletion core/tauri-utils/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ mod tests {
assert_eq!(
document.to_string(),
format!(
r#"<html><head><meta content="{}" http-equiv="Content-Security-Policy"></head><body></body></html>"#,
r#"<html><head><meta http-equiv="Content-Security-Policy" content="{}"></head><body></body></html>"#,
super::CSP_TOKEN
)
);
Expand Down
Loading

0 comments on commit 6c4dee9

Please sign in to comment.