Skip to content

Commit 02cd31f

Browse files
Merge remote-tracking branch 'origin' into error-handling-for-channels-callback
2 parents 98eb9ed + 527bf00 commit 02cd31f

File tree

18 files changed

+292
-134
lines changed

18 files changed

+292
-134
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"tauri": "minor:feat"
3+
"@tauri-apps/api": "minor:feat"
4+
---
5+
6+
Expose the `setAutoResize` API for webviews in `@tauri-apps/api`.
7+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri-cli": "patch:bug"
3+
"@tauri-apps/cli": "patch:bug"
4+
---
5+
6+
fix: allow the target directory to be inside frontendDir as long as it is not the Rust target directory inside frontendDir.

.changes/fix-path-join-error.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"tauri": "minor:bug"
3+
"@tauri-apps/api": "minor:bug"
4+
---
5+
6+
Fixed path joining behavior where `path.join('', 'a')` incorrectly returns "/a" instead of "a".

.changes/fix-tray-get-by-id.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch:bug
3+
---
4+
5+
Fix `TrayIcon.getById` returning a new resource ID instead of reusing a previously created id from `TrayIcon.new`.

crates/tauri-bundler/src/bundle/windows/nsis/languages/Hebrew.nsh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ LangString chooseMaintenanceOption ${LANG_HEBREW} "בחר את פעולת התח
77
LangString choowHowToInstall ${LANG_HEBREW} "בחר איך תרצה להתקין את ${PRODUCTNAME}."
88
LangString createDesktop ${LANG_HEBREW} "צור קיצור דרך בשולחן העבודה"
99
LangString dontUninstall ${LANG_HEBREW} "אל תסיר"
10-
LangString dontUninstallDowngrade ${LANG_HEBREW} "אל תסיר (התקנת גרסה ישנה ללא הסרת הגרסה הנוכחית מושעית עבור מותג זה)"
10+
LangString dontUninstallDowngrade ${LANG_HEBREW} "אל תסיר (התקנת גרסה ישנה ללא הסרת הגרסה הנוכחית מושעית עבור התקנה זו)"
1111
LangString failedToKillApp ${LANG_HEBREW} "עצירת ${PRODUCTNAME} נכשלה. נא לסגור את היישום ולנסות שוב."
1212
LangString installingWebview2 ${LANG_HEBREW} "מתקין את WebView2..."
13-
LangString newerVersionInstalled ${LANG_HEBREW} "גרסה חדשה יותר של ${PRODUCTNAME} כבר מותקנת! לא מומלץ להתקין גרסה ישנה. אם בכל זאת תרצה להתקין את הגרסה הזו, מומלץ קודם להסיר את הגרסה הנוכחית. בחר את הפעולה שברוצנך לבצע ולחץ הבא להמשך."
13+
LangString newerVersionInstalled ${LANG_HEBREW} "גרסה חדשה יותר של ${PRODUCTNAME} כבר מותקנת! לא מומלץ להתקין גרסה ישנה. אם בכל זאת תרצה להתקין את הגרסה הזו, מומלץ קודם להסיר את הגרסה הנוכחית. בחר את הפעולה שברצונך לבצע ולחץ הבא להמשך."
1414
LangString older ${LANG_HEBREW} "ישנה"
15-
LangString olderOrUnknownVersionInstalled ${LANG_HEBREW} "גרסה $R4 של ${PRODUCTNAME} מותקנת במערכת שלך. מומלץ להסיר את הגרסה הנוכחית לפני ההתקנה. בחר את הפעולה שברוצנך לבצע ולחץ הבא להמשך."
15+
LangString olderOrUnknownVersionInstalled ${LANG_HEBREW} "גרסה $R4 של ${PRODUCTNAME} מותקנת במערכת שלך. מומלץ להסיר את הגרסה הנוכחית לפני ההתקנה. בחר את הפעולה שברצונך לבצע ולחץ הבא להמשך."
1616
LangString silentDowngrades ${LANG_HEBREW} "התקנת גרסה ישנה לא נתמכת בהתקנה זו, אין אפשרות להמשיך עם ההתקנה השקטה, נא להמשיך עם ההתקנה בממשק הגרפי.$\n"
1717
LangString unableToUninstall ${LANG_HEBREW} "לא ניתן להסיר!"
1818
LangString uninstallApp ${LANG_HEBREW} "הסר את ${PRODUCTNAME}"

crates/tauri-cli/src/build.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ use crate::{
99
app_paths::tauri_dir,
1010
config::{get as get_config, ConfigHandle, FrontendDist},
1111
},
12-
interface::{AppInterface, Interface},
12+
interface::{rust::get_cargo_target_dir, AppInterface, Interface},
1313
ConfigValue, Result,
1414
};
1515
use anyhow::Context;
1616
use clap::{ArgAction, Parser};
17-
use std::env::set_current_dir;
17+
use std::{env::set_current_dir, fs};
1818
use tauri_utils::platform::Target;
1919

2020
#[derive(Debug, Clone, Parser)]
@@ -172,19 +172,32 @@ pub fn setup(
172172
));
173173
}
174174

175+
// Issue #13287 - Allow the use of target dir inside frontendDist/distDir
176+
// https://github.com/tauri-apps/tauri/issues/13287
177+
let target_path = fs::canonicalize(get_cargo_target_dir(&options.args)?)?;
175178
let mut out_folders = Vec::new();
176-
for folder in &["node_modules", "src-tauri", "target"] {
177-
if web_asset_path.join(folder).is_dir() {
178-
out_folders.push(folder.to_string());
179+
if let Ok(web_asset_canonical) = web_asset_path.canonicalize() {
180+
if let Ok(relative_path) = target_path.strip_prefix(&web_asset_canonical) {
181+
let relative_str = relative_path.to_string_lossy();
182+
if !relative_str.is_empty() {
183+
out_folders.push(relative_str.to_string());
184+
}
185+
}
186+
187+
for folder in &["node_modules", "src-tauri"] {
188+
let sub_path = web_asset_canonical.join(folder);
189+
if sub_path.is_dir() {
190+
out_folders.push(folder.to_string());
191+
}
179192
}
180193
}
194+
181195
if !out_folders.is_empty() {
182196
return Err(anyhow::anyhow!(
183-
"The configured frontendDist includes the `{:?}` {}. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",
184-
out_folders,
185-
if out_folders.len() == 1 { "folder" } else { "folders" }
186-
)
187-
);
197+
"The configured frontendDist includes the `{:?}` {}. Please isolate your web assets on a separate folder and update `tauri.conf.json > build > frontendDist`.",
198+
out_folders,
199+
if out_folders.len() == 1 { "folder" } else { "folders" }
200+
));
188201
}
189202
}
190203

crates/tauri-cli/src/interface/rust.rs

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,22 +1148,29 @@ pub(crate) fn get_cargo_metadata() -> crate::Result<CargoMetadata> {
11481148
Ok(serde_json::from_slice(&output.stdout)?)
11491149
}
11501150

1151-
/// This function determines the 'target' directory and suffixes it with the profile
1152-
/// to determine where the compiled binary will be located.
1153-
fn get_target_dir(triple: Option<&str>, options: &Options) -> crate::Result<PathBuf> {
1154-
let mut path = if let Some(target) = get_cargo_option(&options.args, "--target-dir") {
1151+
/// Get the cargo target directory based on the provided arguments.
1152+
/// If "--target-dir" is specified in args, use it as the target directory (relative to current directory).
1153+
/// Otherwise, use the target directory from cargo metadata.
1154+
pub(crate) fn get_cargo_target_dir(args: &[String]) -> crate::Result<PathBuf> {
1155+
let path = if let Some(target) = get_cargo_option(args, "--target-dir") {
11551156
std::env::current_dir()?.join(target)
11561157
} else {
1157-
let mut path = get_cargo_metadata()
1158+
get_cargo_metadata()
11581159
.with_context(|| "failed to get cargo metadata")?
1159-
.target_directory;
1160+
.target_directory
1161+
};
11601162

1161-
if let Some(triple) = triple {
1162-
path.push(triple);
1163-
}
1163+
Ok(path)
1164+
}
11641165

1165-
path
1166-
};
1166+
/// This function determines the 'target' directory and suffixes it with the profile
1167+
/// to determine where the compiled binary will be located.
1168+
fn get_target_dir(triple: Option<&str>, options: &Options) -> crate::Result<PathBuf> {
1169+
let mut path = get_cargo_target_dir(&options.args)?;
1170+
1171+
if let Some(triple) = triple {
1172+
path.push(triple);
1173+
}
11671174

11681175
path.push(get_profile_dir(options));
11691176

@@ -1633,7 +1640,10 @@ mod tests {
16331640
);
16341641
assert_eq!(
16351642
get_target_dir(Some("x86_64-pc-windows-msvc"), &options).unwrap(),
1636-
current_dir.join("path/to/some/dir/release")
1643+
current_dir
1644+
.join("path/to/some/dir")
1645+
.join("x86_64-pc-windows-msvc")
1646+
.join("release")
16371647
);
16381648

16391649
let options = Options {

crates/tauri-runtime-wry/src/monitor/macos.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,28 @@
22
// SPDX-License-Identifier: Apache-2.0
33
// SPDX-License-Identifier: MIT
44

5-
use tauri_runtime::dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalRect};
5+
use tauri_runtime::dpi::{LogicalSize, PhysicalRect};
66

77
impl super::MonitorExt for tao::monitor::MonitorHandle {
88
fn work_area(&self) -> PhysicalRect<i32, u32> {
99
use objc2_app_kit::NSScreen;
1010
use tao::platform::macos::MonitorHandleExtMacOS;
1111
if let Some(ns_screen) = self.ns_screen() {
1212
let ns_screen: &NSScreen = unsafe { &*ns_screen.cast() };
13-
let rect = ns_screen.visibleFrame();
13+
let screen_frame = ns_screen.frame();
14+
let visible_frame = ns_screen.visibleFrame();
15+
1416
let scale_factor = self.scale_factor();
17+
18+
let mut position = self.position().to_logical::<f64>(scale_factor);
19+
20+
position.x += visible_frame.origin.x - screen_frame.origin.x;
21+
position.y += visible_frame.origin.y - screen_frame.origin.y;
22+
1523
PhysicalRect {
16-
size: LogicalSize::new(rect.size.width, rect.size.height).to_physical(scale_factor),
17-
position: LogicalPosition::new(rect.origin.x, rect.origin.y).to_physical(scale_factor),
24+
size: LogicalSize::new(visible_frame.size.width, visible_frame.size.height)
25+
.to_physical(scale_factor),
26+
position: position.to_physical(scale_factor),
1827
}
1928
} else {
2029
PhysicalRect {

crates/tauri/build.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ const PLUGINS: &[(&str, &[(&str, bool)])] = &[
135135
("set_webview_size", false),
136136
("set_webview_position", false),
137137
("set_webview_focus", false),
138+
("set_webview_auto_resize", false),
138139
("set_webview_zoom", false),
139140
("webview_hide", false),
140141
("webview_show", false),

crates/tauri/permissions/webview/autogenerated/reference.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,32 @@ Denies the reparent command without any pre-configured scope.
203203
<tr>
204204
<td>
205205

206+
`core:webview:allow-set-webview-auto-resize`
207+
208+
</td>
209+
<td>
210+
211+
Enables the set_webview_auto_resize command without any pre-configured scope.
212+
213+
</td>
214+
</tr>
215+
216+
<tr>
217+
<td>
218+
219+
`core:webview:deny-set-webview-auto-resize`
220+
221+
</td>
222+
<td>
223+
224+
Denies the set_webview_auto_resize command without any pre-configured scope.
225+
226+
</td>
227+
</tr>
228+
229+
<tr>
230+
<td>
231+
206232
`core:webview:allow-set-webview-background-color`
207233

208234
</td>

0 commit comments

Comments
 (0)