Merge branch 'dev' into refactor/bundle-file-names-consistency

This commit is contained in:
Lucas Fernandes Nogueira 2024-08-13 07:40:59 -03:00 committed by GitHub
commit a9af8cc13c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 741 additions and 476 deletions

View File

@ -0,0 +1,6 @@
---
"tauri-cli": patch:changes
"@tauri-apps/cli": patch:changes
---
Change iOS template default export method from deprecated `development` to `debugging`.

View File

@ -0,0 +1,5 @@
---
"tauri": patch:bug
---
Fix IPC fallback (postMessage implementation when custom protocol fails) hanging when sending responses.

View File

@ -0,0 +1,5 @@
---
"tauri-utils": patch:bug
---
Fix plugin permissions documentation heading for permissions table.

View File

@ -242,7 +242,7 @@ pub fn generate_docs(
) -> Result<(), Error> {
let mut permission_table = "".to_string();
let permission_table_header =
"### Permission Table \n\n<table>\n<tr>\n<th>Identifier</th>\n<th>Description</th>\n</tr>\n"
"## Permission Table \n\n<table>\n<tr>\n<th>Identifier</th>\n<th>Description</th>\n</tr>\n"
.to_string();
let mut default_permission = "## Default Permission\n\n".to_string();

View File

@ -6,7 +6,7 @@ Default permissions for the plugin.
- `allow-name`
- `allow-tauri-version`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -7,7 +7,7 @@ Default permissions for the plugin.
- `allow-emit`
- `allow-emit-to`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -8,7 +8,7 @@ Default permissions for the plugin.
- `allow-rgba`
- `allow-size`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -25,7 +25,7 @@ Default permissions for the plugin.
- `allow-set-checked`
- `allow-set-icon`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -11,7 +11,7 @@ Default permissions for the plugin.
- `allow-basename`
- `allow-is-absolute`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -4,7 +4,7 @@ Default permissions for the plugin.
- `allow-close`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -14,7 +14,7 @@ Default permissions for the plugin.
- `allow-set-icon-as-template`
- `allow-set-show-menu-on-left-click`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -6,7 +6,7 @@ Default permissions for the plugin.
- `allow-webview-size`
- `allow-internal-toggle-devtools`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -26,7 +26,7 @@ Default permissions for the plugin.
- `allow-theme`
- `allow-internal-toggle-maximize`
### Permission Table
## Permission Table
<table>
<tr>

View File

@ -62,7 +62,11 @@
)
}
})
.catch(() => {
.catch((e) => {
console.warn(
'IPC custom protocol failed, Tauri will now use the postMessage interface instead',
e
)
// failed to use the custom protocol IPC (either the webview blocked a custom protocol or it was a CSP error)
// so we need to fallback to the postMessage interface
customProtocolIpcFailed = true
@ -74,7 +78,10 @@
cmd,
callback,
error,
options,
options: {
...options,
customProtocolIpcBlocked: customProtocolIpcFailed
},
payload,
__TAURI_INVOKE_KEY__
})

View File

@ -174,6 +174,7 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
use serde::{Deserialize, Deserializer};
#[derive(Default)]
pub(crate) struct HeaderMap(http::HeaderMap);
impl<'de> Deserialize<'de> for HeaderMap {
@ -199,9 +200,13 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
}
}
#[derive(Deserialize)]
#[derive(Deserialize, Default)]
#[serde(rename_all = "camelCase")]
struct RequestOptions {
#[serde(default)]
headers: HeaderMap,
#[serde(default)]
custom_protocol_ipc_blocked: bool,
}
#[derive(Deserialize)]
@ -260,13 +265,15 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
match message {
Ok(message) => {
let options = message.options.unwrap_or_default();
let request = InvokeRequest {
cmd: message.cmd,
callback: message.callback,
error: message.error,
url: Url::parse(&request.uri().to_string()).expect("invalid IPC request URL"),
body: message.payload.into(),
headers: message.options.map(|o| o.headers.0).unwrap_or_default(),
headers: options.headers.0,
invoke_key: message.invoke_key,
};
@ -293,9 +300,7 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
.entered();
// the channel data command is the only command that uses a custom protocol on Linux
if webview.manager().webview.invoke_responder.is_none()
&& cmd != crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND
{
if webview.manager().webview.invoke_responder.is_none() {
fn responder_eval<R: Runtime>(
webview: &crate::Webview<R>,
js: crate::Result<String>,
@ -310,6 +315,10 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
let _ = webview.eval(&eval_js);
}
let can_use_channel_for_response = cmd
!= crate::ipc::channel::FETCH_CHANNEL_DATA_COMMAND
&& !options.custom_protocol_ipc_blocked;
#[cfg(feature = "tracing")]
let _response_span = tracing::trace_span!(
"ipc::request::response",
@ -327,6 +336,7 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
InvokeResponse::Ok(InvokeBody::Json(v)) => {
if !(cfg!(target_os = "macos") || cfg!(target_os = "ios"))
&& matches!(v, JsonValue::Object(_) | JsonValue::Array(_))
&& can_use_channel_for_response
{
let _ = Channel::from_callback_fn(webview, callback).send(v);
} else {
@ -338,7 +348,10 @@ fn handle_ipc_message<R: Runtime>(request: Request<String>, manager: &AppManager
}
}
InvokeResponse::Ok(InvokeBody::Raw(v)) => {
if cfg!(target_os = "macos") || cfg!(target_os = "ios") {
if cfg!(target_os = "macos")
|| cfg!(target_os = "ios")
|| !can_use_channel_for_response
{
responder_eval(
&webview,
format_callback_result(Result::<_, ()>::Ok(v), callback, error),

View File

@ -18,7 +18,7 @@ exclude = [ "CHANGELOG.md", "/target", "rustfmt.toml" ]
[dependencies]
tauri-utils = { version = "2.0.0-rc.2", path = "../../core/tauri-utils", features = [ "resources" ] }
image = "0.24.9"
image = "0.25.0"
flate2 = "1.0"
anyhow = "1.0"
thiserror = "1.0"
@ -44,11 +44,11 @@ dunce = "1"
[target."cfg(target_os = \"windows\")".dependencies]
uuid = { version = "1", features = [ "v4", "v5" ] }
bitness = "0.4"
windows-registry = "0.1.1"
windows-registry = "0.2.0"
glob = "0.3"
[target."cfg(target_os = \"windows\")".dependencies.windows-sys]
version = "0.52"
version = "0.59"
features = [
"Win32_System_SystemInformation",
"Win32_System_Diagnostics_Debug"
@ -67,7 +67,7 @@ regex = "1"
heck = "0.5"
ar = "0.9.0"
md5 = "0.7.0"
rpm = "0.14.0"
rpm = "0.15.0"
[lib]
name = "tauri_bundler"

View File

@ -18,6 +18,7 @@
use std::collections::BTreeMap;
use std::ffi::OsStr;
use std::fs::{read_to_string, File};
use std::io::BufReader;
use std::path::{Path, PathBuf};
use anyhow::Context;
@ -60,7 +61,7 @@ pub fn list_icon_files(
}
// Put file in scope so that it's closed when copying it
let icon = {
let decoder = PngDecoder::new(File::open(&icon_path)?)?;
let decoder = PngDecoder::new(BufReader::new(File::open(&icon_path)?))?;
let width = decoder.dimensions().0;
let height = decoder.dimensions().1;
let is_high_density = common::is_retina(&icon_path);

View File

@ -22,7 +22,7 @@ use std::{
collections::BTreeSet,
ffi::OsStr,
fs::{self, File},
io::Write,
io::{BufReader, Write},
path::{Path, PathBuf},
};
@ -90,7 +90,7 @@ fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> crate::Result<
if icon_path.extension() != Some(OsStr::new("png")) {
continue;
}
let decoder = PngDecoder::new(File::open(&icon_path)?)?;
let decoder = PngDecoder::new(BufReader::new(File::open(&icon_path)?))?;
let width = decoder.dimensions().0;
let height = decoder.dimensions().1;
let is_retina = common::is_retina(&icon_path);
@ -127,7 +127,7 @@ fn generate_icon_files(bundle_dir: &Path, settings: &Settings) -> crate::Result<
let dest_path = get_dest_path(width, height, is_retina);
icon.write_to(
&mut common::create_file(&dest_path)?,
image::ImageOutputFormat::Png,
image::ImageFormat::Png,
)?;
}
}

1089
tooling/cli/Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -40,10 +40,10 @@ path = "src/main.rs"
[dependencies]
cargo-mobile2 = { version = "0.13.1", default-features = false }
jsonrpsee = { version = "0.22", features = [ "server" ] }
jsonrpsee-core = "0.22"
jsonrpsee-client-transport = { version = "0.22", features = [ "ws" ] }
jsonrpsee-ws-client = { version = "0.22", default-features = false }
jsonrpsee = { version = "0.24", features = [ "server" ] }
jsonrpsee-core = "0.24"
jsonrpsee-client-transport = { version = "0.24", features = [ "ws" ] }
jsonrpsee-ws-client = { version = "0.24", default-features = false }
sublime_fuzzy = "0.7"
clap_complete = "4"
clap = { version = "4.5", features = [ "derive", "env" ] }
@ -61,7 +61,7 @@ json-patch = "2.0"
tauri-utils = { version = "2.0.0-rc.2", path = "../../core/tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] }
tauri-utils-v1 = { version = "1", package = "tauri-utils", features = [ "isolation", "schema", "config-json5", "config-toml" ] }
toml = "0.8"
jsonschema = "0.17"
jsonschema = "0.18"
handlebars = "6.0"
include_dir = "0.7"
minisign = "=0.7.3"
@ -79,23 +79,23 @@ ctrlc = "3.4"
log = { version = "0.4.21", features = [ "kv", "kv_std" ] }
env_logger = "0.11.3"
icns = { package = "tauri-icns", version = "0.1" }
image = { version = "0.24", default-features = false, features = [ "ico" ] }
image = { version = "0.25", default-features = false, features = [ "ico" ] }
axum = { version = "0.7.4", features = [ "ws" ] }
html5ever = "0.26"
kuchiki = { package = "kuchikiki", version = "0.8" }
tokio = { version = "1", features = [ "macros", "sync" ] }
common-path = "1"
serde-value = "0.7.0"
itertools = "0.12"
itertools = "0.13"
local-ip-address = "0.6"
css-color = "0.2"
resvg = "0.42.0"
dunce = "1"
glob = "0.3"
oxc_parser = "0.16"
oxc_span = "0.16"
oxc_allocator = "0.16"
oxc_ast = "0.16"
oxc_parser = "0.20"
oxc_span = "0.20"
oxc_allocator = "0.20"
oxc_ast = "0.20"
magic_string = "0.3"
phf = { version = "0.11", features = ["macros"] }
walkdir = "2"

View File

@ -22,7 +22,7 @@ use image::{
png::{CompressionType, FilterType as PngFilterType, PngEncoder},
},
imageops::FilterType,
open, ColorType, DynamicImage, ImageBuffer, ImageEncoder, Rgba,
open, DynamicImage, ExtendedColorType, ImageBuffer, ImageEncoder, Rgba,
};
use resvg::{tiny_skia, usvg};
use serde::Deserialize;
@ -243,13 +243,18 @@ fn ico(source: &Source, out_dir: &Path) -> Result<()> {
write_png(image.as_bytes(), &mut buf, size)?;
frames.push(IcoFrame::with_encoded(buf, size, size, ColorType::Rgba8)?)
frames.push(IcoFrame::with_encoded(
buf,
size,
size,
ExtendedColorType::Rgba8,
)?)
} else {
frames.push(IcoFrame::as_png(
image.as_bytes(),
size,
size,
ColorType::Rgba8,
ExtendedColorType::Rgba8,
)?);
}
}
@ -485,6 +490,6 @@ fn resize_and_save_png(
// Encode image data as png with compression.
fn write_png<W: Write>(image_data: &[u8], w: W, size: u32) -> Result<()> {
let encoder = PngEncoder::new_with_quality(w, CompressionType::Best, PngFilterType::Adaptive);
encoder.write_image(image_data, size, size, ColorType::Rgba8)?;
encoder.write_image(image_data, size, size, ExtendedColorType::Rgba8)?;
Ok(())
}

View File

@ -191,7 +191,7 @@ pub fn write_options(identifier: &str, mut options: CliOptions) -> crate::Result
let addr = server.local_addr()?;
let mut module = RpcModule::new(());
module.register_method("options", move |_, _| Some(options.clone()))?;
module.register_method("options", move |_, _, _| Some(options.clone()))?;
let handle = server.start(module);

View File

@ -3,6 +3,6 @@
<plist version="1.0">
<dict>
<key>method</key>
<string>development</string>
<string>debugging</string>
</dict>
</plist>