Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev' into prevent-window-overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Legend-Master committed Nov 13, 2024
2 parents 16f4895 + cccb308 commit d887510
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 7 deletions.
7 changes: 7 additions & 0 deletions .changes/deb-updater-support.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'tauri-bundler': minor:feat
'tauri-cli': minor:feat
'@tauri-apps/cli': minor:feat
---

Generate signature for `.deb` packages when `createUpdaterArtifacts` option is enabled.
7 changes: 7 additions & 0 deletions .changes/extension-path.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"tauri": "minor:feat"
"tauri-runtime": "minor:feat"
"tauri-runtime-wry": "minor:feat"
---

Add `WebviewWindowBuilder/WebviewBuilder::extensions_path` on Linux and Windows.
7 changes: 7 additions & 0 deletions .changes/info-linux-de-and-session.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"tauri-cli": "patch:feat"
"@tauri-apps/cli": "patch:feat"
---

Include Linux destkop environment and session type in `tauri info` command.

6 changes: 6 additions & 0 deletions .changes/json5-capability-files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri": patch:bug
"tauri-utils": patch:bug
---

Fix `.json5` capability files not recognized even with `config-json5` feature enabled
3 changes: 2 additions & 1 deletion crates/tauri-bundler/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<Bundle>> {
| PackageType::MacOsBundle
| PackageType::Nsis
| PackageType::WindowsMsi
| PackageType::Deb
)
} else {
matches!(package_type, PackageType::MacOsBundle)
Expand All @@ -166,7 +167,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<Bundle>> {
// Self contained updater, no need to zip
matches!(
package_type,
PackageType::AppImage | PackageType::Nsis | PackageType::WindowsMsi
PackageType::AppImage | PackageType::Nsis | PackageType::WindowsMsi | PackageType::Deb
)
})
{
Expand Down
6 changes: 5 additions & 1 deletion crates/tauri-cli/src/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ fn sign_updaters(
.filter(|bundle| {
matches!(
bundle.package_type,
PackageType::Updater | PackageType::Nsis | PackageType::WindowsMsi | PackageType::AppImage
PackageType::Updater
| PackageType::Nsis
| PackageType::WindowsMsi
| PackageType::AppImage
| PackageType::Deb
)
})
.collect();
Expand Down
32 changes: 30 additions & 2 deletions crates/tauri-cli/src/info/env_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,45 @@ fn is_xcode_command_line_tools_installed() -> bool {
.map(|o| o.status.success())
.unwrap_or(false)
}
fn de_and_session() -> String {
#[cfg(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd"
))]
return {
let de = std::env::var("DESKTOP_SESSION");
let session = std::env::var("XDG_SESSION_TYPE");
format!(
" ({} on {})",
de.as_deref().unwrap_or("Unknown DE"),
session.as_deref().unwrap_or("Unknown Session")
)
};

#[cfg(not(any(
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "openbsd",
target_os = "netbsd"
)))]
String::new()
}

pub fn items() -> Vec<SectionItem> {
vec![
SectionItem::new().action(|| {
let os_info = os_info::get();
format!(
"OS: {} {} {} ({:?})",
"OS: {} {} {} ({:?}){}",
os_info.os_type(),
os_info.version(),
os_info.architecture().unwrap_or("Unknown Architecture"),
os_info.bitness()
os_info.bitness(),
de_and_session(),
).into()
}),
#[cfg(windows)]
Expand Down
14 changes: 14 additions & 0 deletions crates/tauri-runtime-wry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4348,6 +4348,20 @@ fn create_webview<T: UserEvent>(
.with_browser_extensions_enabled(webview_attributes.browser_extensions_enabled);
}

#[cfg(any(
windows,
target_os = "linux",
target_os = "dragonfly",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
{
if let Some(path) = &webview_attributes.extensions_path {
webview_builder = webview_builder.with_extension_path(path);
}
}

webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
kind,
window_id.clone(),
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-runtime/src/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub struct WebviewAttributes {
pub proxy_url: Option<Url>,
pub zoom_hotkeys_enabled: bool,
pub browser_extensions_enabled: bool,
pub extensions_path: Option<PathBuf>,
pub use_https_scheme: bool,
pub devtools: Option<bool>,
pub background_color: Option<Color>,
Expand Down Expand Up @@ -272,6 +273,7 @@ impl WebviewAttributes {
proxy_url: None,
zoom_hotkeys_enabled: false,
browser_extensions_enabled: false,
extensions_path: None,
use_https_scheme: false,
devtools: None,
background_color: None,
Expand Down
7 changes: 6 additions & 1 deletion crates/tauri-utils/src/acl/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@ pub const PERMISSION_FILE_EXTENSIONS: &[&str] = &["json", "toml"];
pub const PERMISSION_DOCS_FILE_NAME: &str = "reference.md";

/// Allowed capability file extensions
const CAPABILITY_FILE_EXTENSIONS: &[&str] = &["json", "toml"];
const CAPABILITY_FILE_EXTENSIONS: &[&str] = &[
"json",
#[cfg(feature = "config-json5")]
"json5",
"toml",
];

/// Known folder name of the capability schemas
const CAPABILITIES_SCHEMA_FOLDER_NAME: &str = "schemas";
Expand Down
2 changes: 2 additions & 0 deletions crates/tauri-utils/src/acl/capability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,8 @@ impl CapabilityFile {
let file: Self = match ext.as_str() {
"toml" => toml::from_str(&capability_file)?,
"json" => serde_json::from_str(&capability_file)?,
#[cfg(feature = "config-json5")]
"json5" => json5::from_str(&capability_file)?,
_ => return Err(super::Error::UnknownCapabilityFormat(ext)),
};
Ok(file)
Expand Down
5 changes: 5 additions & 0 deletions crates/tauri-utils/src/acl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,11 @@ pub enum Error {
#[error("failed to parse JSON: {0}")]
Json(#[from] serde_json::Error),

/// Invalid JSON5 encountered
#[cfg(feature = "config-json5")]
#[error("failed to parse JSON5: {0}")]
Json5(#[from] json5::Error),

/// Invalid permissions file format
#[error("unknown permission format {0}")]
UnknownPermissionFormat(String),
Expand Down
14 changes: 13 additions & 1 deletion crates/tauri/src/webview/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use crate::{
use std::{
borrow::Cow,
hash::{Hash, Hasher},
path::PathBuf,
path::{Path, PathBuf},
sync::{Arc, Mutex, MutexGuard},
};

Expand Down Expand Up @@ -802,6 +802,18 @@ fn main() {
self
}

/// Set the path from which to load extensions from. Extensions stored in this path should be unpacked Chrome extensions on Windows, and compiled `.so` extensions on Linux.
///
/// ## Platform-specific:
///
/// - **Windows**: Browser extensions must first be enabled. See [`browser_extensions_enabled`](Self::browser_extensions_enabled)
/// - **MacOS / iOS / Android** - Unsupported.
#[must_use]
pub fn extensions_path(mut self, path: impl AsRef<Path>) -> Self {
self.webview_attributes.extensions_path = Some(path.as_ref().to_path_buf());
self
}

/// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`.
///
/// ## Note
Expand Down
14 changes: 13 additions & 1 deletion crates/tauri/src/webview/webview_window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::{
borrow::Cow,
path::PathBuf,
path::{Path, PathBuf},
sync::{Arc, MutexGuard},
};

Expand Down Expand Up @@ -906,6 +906,18 @@ impl<'a, R: Runtime, M: Manager<R>> WebviewWindowBuilder<'a, R, M> {
self
}

/// Set the path from which to load extensions from. Extensions stored in this path should be unpacked Chrome extensions on Windows, and compiled `.so` extensions on Linux.
///
/// ## Platform-specific:
///
/// - **Windows**: Browser extensions must first be enabled. See [`browser_extensions_enabled`](Self::browser_extensions_enabled)
/// - **MacOS / iOS / Android** - Unsupported.
#[must_use]
pub fn extensions_path(mut self, path: impl AsRef<Path>) -> Self {
self.webview_builder = self.webview_builder.extensions_path(path);
self
}

/// Sets whether the custom protocols should use `https://<scheme>.localhost` instead of the default `http://<scheme>.localhost` on Windows and Android. Defaults to `false`.
///
/// ## Note
Expand Down

0 comments on commit d887510

Please sign in to comment.