feat: add private api feature flag (#7)

This commit is contained in:
Lucas Nogueira 2022-01-09 11:29:29 -03:00
parent cf54dcf9c8
commit 6ac21b3cef
No known key found for this signature in database
GPG Key ID: 2714B66BCFB01F7F
17 changed files with 367 additions and 158 deletions

7
.changes/private-api.md Normal file
View File

@ -0,0 +1,7 @@
---
"tauri": patch
"tauri-runtime-wry": patch
"cli.rs": patch
---
Add `macos-private-api` feature flag, enabled via `tauri.conf.json > tauri > macOSPrivateApi`.

View File

@ -14,7 +14,7 @@ readme = "README.md"
[dependencies]
#wry = { version = "0.12", default-features = false, features = [ "file-drop", "protocol" ] }
wry = { git = "https://github.com/tauri-apps/wry", rev = "3284f8d442978269f7654edbdfc9bc51022eaa40", default-features = false, features = [ "file-drop", "protocol", "transparent", "fullscreen" ] }
wry = { git = "https://github.com/tauri-sec/wry", branch = "next", default-features = false, features = [ "file-drop", "protocol" ] }
tauri-runtime = { version = "0.2.1", path = "../tauri-runtime" }
tauri-utils = { version = "1.0.0-beta.3", path = "../tauri-utils" }
uuid = { version = "0.8.2", features = [ "v4" ] }
@ -45,3 +45,4 @@ gtk = { version = "0.14", features = [ "v3_20" ] }
dox = [ "wry/dox" ]
system-tray = [ "wry/tray", "tauri-runtime/system-tray" ]
egui = ["epi", "egui-tao", "egui_glow", "tao-glutin", "glow", "once_cell"]
macos-private-api = [ "wry/fullscreen", "wry/transparent", "tauri-runtime/macos-private-api" ]

View File

@ -11,9 +11,7 @@ use tauri_runtime::{
},
menu::{CustomMenuItem, Menu, MenuEntry, MenuHash, MenuId, MenuItem, MenuUpdate},
monitor::Monitor,
webview::{
FileDropEvent, FileDropHandler, RpcRequest, WebviewRpcHandler, WindowBuilder, WindowBuilderBase,
},
webview::{FileDropEvent, FileDropHandler, WebviewIpcHandler, WindowBuilder, WindowBuilderBase},
window::{
dpi::{LogicalPosition, LogicalSize, PhysicalPosition, PhysicalSize, Position, Size},
DetachedWindow, PendingWindow, WindowEvent,
@ -68,10 +66,7 @@ use wry::{
Request as WryHttpRequest, RequestParts as WryRequestParts, Response as WryHttpResponse,
ResponseParts as WryResponseParts,
},
webview::{
FileDropEvent as WryFileDropEvent, RpcRequest as WryRpcRequest, RpcResponse, WebContext,
WebView, WebViewBuilder,
},
webview::{FileDropEvent as WryFileDropEvent, WebContext, WebView, WebViewBuilder},
};
pub use wry::application::window::{Window, WindowBuilder as WryWindowBuilder, WindowId};
@ -738,13 +733,17 @@ impl WindowBuilder for WindowBuilderWrapper {
.inner_size(config.width, config.height)
.visible(config.visible)
.resizable(config.resizable)
.fullscreen(config.fullscreen)
.decorations(config.decorations)
.maximized(config.maximized)
.fullscreen(config.fullscreen)
.transparent(config.transparent)
.always_on_top(config.always_on_top)
.skip_taskbar(config.skip_taskbar);
#[cfg(any(not(target_os = "macos"), feature = "macos-private-api"))]
{
window = window.transparent(config.transparent);
}
if let (Some(min_width), Some(min_height)) = (config.min_width, config.min_height) {
window = window.min_inner_size(min_width, min_height);
}
@ -835,6 +834,7 @@ impl WindowBuilder for WindowBuilderWrapper {
self
}
#[cfg(any(not(target_os = "macos"), feature = "macos-private-api"))]
fn transparent(mut self, transparent: bool) -> Self {
self.inner = self.inner.with_transparent(transparent);
self
@ -889,17 +889,6 @@ impl WindowBuilder for WindowBuilderWrapper {
}
}
pub struct RpcRequestWrapper(WryRpcRequest);
impl From<RpcRequestWrapper> for RpcRequest {
fn from(request: RpcRequestWrapper) -> Self {
Self {
command: request.0.method,
params: request.0.params,
}
}
}
pub struct FileDropEventWrapper(WryFileDropEvent);
impl From<FileDropEventWrapper> for FileDropEvent {
@ -3066,7 +3055,7 @@ fn create_webview(
webview_attributes,
uri_scheme_protocols,
mut window_builder,
rpc_handler,
ipc_handler,
file_drop_handler,
label,
url,
@ -3106,8 +3095,8 @@ fn create_webview(
.with_url(&url)
.unwrap() // safe to unwrap because we validate the URL beforehand
.with_transparent(is_window_transparent);
if let Some(handler) = rpc_handler {
webview_builder = webview_builder.with_rpc_handler(create_rpc_handler(
if let Some(handler) = ipc_handler {
webview_builder = webview_builder.with_ipc_handler(create_ipc_handler(
context.clone(),
label.clone(),
menu_ids.clone(),
@ -3172,14 +3161,14 @@ fn create_webview(
})
}
/// Create a wry rpc handler from a tauri rpc handler.
fn create_rpc_handler(
/// Create a wry ipc handler from a tauri ipc handler.
fn create_ipc_handler(
context: Context,
label: String,
menu_ids: Arc<Mutex<HashMap<MenuHash, MenuId>>>,
js_event_listeners: Arc<Mutex<HashMap<String, HashSet<u64>>>>,
handler: WebviewRpcHandler<Wry>,
) -> Box<dyn Fn(&Window, WryRpcRequest) -> Option<RpcResponse> + 'static> {
handler: WebviewIpcHandler<Wry>,
) -> Box<dyn Fn(&Window, String) + 'static> {
Box::new(move |window, request| {
handler(
DetachedWindow {
@ -3191,9 +3180,8 @@ fn create_rpc_handler(
menu_ids: menu_ids.clone(),
js_event_listeners: js_event_listeners.clone(),
},
RpcRequestWrapper(request).into(),
request,
);
None
})
}

View File

@ -46,3 +46,4 @@ gtk = { version = "0.14", features = [ "v3_20" ] }
[features]
system-tray = [ ]
macos-private-api = [ ]

View File

@ -120,6 +120,11 @@ pub trait WindowBuilder: WindowBuilderBase {
/// Whether the the window should be transparent. If this is true, writing colors
/// with alpha values different than `1.0` will produce a transparent window.
#[cfg(any(not(target_os = "macos"), feature = "macos-private-api"))]
#[cfg_attr(
doc_cfg,
doc(cfg(any(not(target_os = "macos"), feature = "macos-private-api")))
)]
fn transparent(self, transparent: bool) -> Self;
/// Whether the window should have borders and bars.
@ -160,15 +165,6 @@ pub trait WindowBuilder: WindowBuilderBase {
fn get_menu(&self) -> Option<&Menu>;
}
/// Rpc request.
#[derive(Debug)]
pub struct RpcRequest {
/// RPC command.
pub command: String,
/// Params.
pub params: Option<JsonValue>,
}
/// The file drop event payload.
#[derive(Debug, Clone)]
#[non_exhaustive]
@ -181,8 +177,8 @@ pub enum FileDropEvent {
Cancelled,
}
/// Rpc handler.
pub type WebviewRpcHandler<R> = Box<dyn Fn(DetachedWindow<R>, RpcRequest) + Send>;
/// IPC handler.
pub type WebviewIpcHandler<R> = Box<dyn Fn(DetachedWindow<R>, String) + Send>;
/// File drop handler callback
/// Return `true` in the callback to block the OS' default behavior of handling a file drop.
@ -190,6 +186,7 @@ pub type FileDropHandler<R> = Box<dyn Fn(FileDropEvent, DetachedWindow<R>) -> bo
#[derive(Debug, Deserialize)]
pub struct InvokePayload {
pub command: String,
#[serde(rename = "__tauriModule")]
pub tauri_module: Option<String>,
pub callback: String,

View File

@ -7,7 +7,7 @@
use crate::{
http::{Request as HttpRequest, Response as HttpResponse},
menu::{Menu, MenuEntry, MenuHash, MenuId},
webview::{FileDropHandler, WebviewAttributes, WebviewRpcHandler},
webview::{FileDropHandler, WebviewAttributes, WebviewIpcHandler},
Dispatch, Runtime, WindowBuilder,
};
use serde::Serialize;
@ -93,8 +93,8 @@ pub struct PendingWindow<R: Runtime> {
pub uri_scheme_protocols: HashMap<String, Box<UriSchemeProtocol>>,
/// How to handle RPC calls on the webview window.
pub rpc_handler: Option<WebviewRpcHandler<R>>,
/// How to handle IPC calls on the webview window.
pub ipc_handler: Option<WebviewIpcHandler<R>>,
/// How to handle a file dropping onto the webview window.
pub file_drop_handler: Option<FileDropHandler<R>>,
@ -125,7 +125,7 @@ impl<R: Runtime> PendingWindow<R> {
webview_attributes,
uri_scheme_protocols: Default::default(),
label: label.into(),
rpc_handler: None,
ipc_handler: None,
file_drop_handler: None,
url: "tauri://localhost".to_string(),
menu_ids: Arc::new(Mutex::new(menu_ids)),
@ -149,7 +149,7 @@ impl<R: Runtime> PendingWindow<R> {
webview_attributes,
uri_scheme_protocols: Default::default(),
label: label.into(),
rpc_handler: None,
ipc_handler: None,
file_drop_handler: None,
url: "tauri://localhost".to_string(),
menu_ids: Arc::new(Mutex::new(menu_ids)),

View File

@ -448,6 +448,9 @@ pub struct WindowConfig {
#[serde(default = "default_focus")]
pub focus: bool,
/// Whether the window is transparent or not.
///
/// Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > tauri > macosPrivateApi`.
/// WARNING: Using private APIs on `macOS` prevents your application from being accepted for the `App Store`.
#[serde(default)]
pub transparent: bool,
/// Whether the window is maximized or not.
@ -900,6 +903,9 @@ pub struct TauriConfig {
pub updater: UpdaterConfig,
/// Configuration for app system tray.
pub system_tray: Option<SystemTrayConfig>,
/// MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.
#[serde(rename = "macOSPrivateApi", default)]
pub macos_private_api: bool,
}
impl Default for TauriConfig {
@ -912,6 +918,7 @@ impl Default for TauriConfig {
security: SecurityConfig::default(),
updater: UpdaterConfig::default(),
system_tray: None,
macos_private_api: false,
}
}
}
@ -930,6 +937,9 @@ impl TauriConfig {
if self.system_tray.is_some() {
features.push("system-tray");
}
if self.macos_private_api {
features.push("macos-private-api");
}
features.sort_unstable();
features
}
@ -1615,6 +1625,7 @@ mod build {
let security = &self.security;
let system_tray = opt_lit(self.system_tray.as_ref());
let allowlist = quote!(Default::default());
let macos_private_api = self.macos_private_api;
literal_struct!(
tokens,
@ -1625,7 +1636,8 @@ mod build {
updater,
security,
system_tray,
allowlist
allowlist,
macos_private_api
);
}
}
@ -1741,6 +1753,7 @@ mod test {
},
allowlist: AllowlistConfig::default(),
system_tray: None,
macos_private_api: false,
};
// create a build config

View File

@ -115,6 +115,7 @@ api-all = [
]
updater = [ "minisign-verify", "base64" ]
system-tray = [ "tauri-runtime/system-tray", "tauri-runtime-wry/system-tray" ]
macos-private-api = [ "tauri-runtime/macos-private-api", "tauri-runtime-wry/macos-private-api" ]
reqwest-client = [ "reqwest", "bytes" ]
fs-all = [ "fs-write-binary-file" ]
fs-read-text-file = [ ]

View File

@ -657,7 +657,7 @@ impl<R: Runtime> Builder<R> {
invoke_handler: Box::new(|_| ()),
invoke_responder: Arc::new(window_invoke_responder),
invoke_initialization_script:
"Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (cmd, args) => window.rpc.notify(cmd, args) })".into(),
"Object.defineProperty(window, '__TAURI_POST_MESSAGE__', { value: (command, args) => window.ipc.notify(JSON.stringify({{ ...args, command }})) })".into(),
on_page_load: Box::new(|_, _| ()),
pending_windows: Default::default(),
plugins: PluginStore::default(),

View File

@ -14,6 +14,7 @@
//! - **reqwest-client**: Uses `reqwest` as HTTP client on the `http` APIs. Improves performance, but increases the bundle size.
//! - **cli**: Enables usage of `clap` for CLI argument parsing. Enabled by default if the `cli` config is defined on the `tauri.conf.json` file.
//! - **system-tray**: Enables application system tray API. Enabled by default if the `systemTray` config is defined on the `tauri.conf.json` file.
//! - **macos-private-api**: Enables features only available in **macOS**'s private APIs, currently the `transparent` window functionality and the `fullScreenEnabled` preference setting to `true`. Enabled by default if the `tauri > macosPrivateApi` config flag is set to `true` on the `tauri.conf.json` file.
//! - **updater**: Enables the application auto updater. Enabled by default if the `updater` config is defined on the `tauri.conf.json` file.
//! - **egui**: Enables method to create a native egui window. This can be used for creating native
//! OpenGL contexts or [egui](https://github.com/emilk/egui) widgets.

View File

@ -12,7 +12,7 @@ use crate::{
HttpRange, MimeType, Request as HttpRequest, Response as HttpResponse,
ResponseBuilder as HttpResponseBuilder,
},
webview::{FileDropEvent, FileDropHandler, InvokePayload, WebviewRpcHandler, WindowBuilder},
webview::{FileDropEvent, FileDropHandler, InvokePayload, WebviewIpcHandler, WindowBuilder},
window::{dpi::PhysicalSize, DetachedWindow, PendingWindow, WindowEvent},
Icon, Runtime,
},
@ -463,23 +463,13 @@ impl<R: Runtime> WindowManager<R> {
Ok(pending)
}
fn prepare_rpc_handler(&self, app_handle: AppHandle<R>) -> WebviewRpcHandler<R> {
fn prepare_ipc_handler(&self, app_handle: AppHandle<R>) -> WebviewIpcHandler<R> {
let manager = self.clone();
Box::new(move |window, request| {
let window = Window::new(manager.clone(), window, app_handle.clone());
let command = request.command.clone();
let arg = request
.params
.unwrap()
.as_array_mut()
.unwrap()
.first_mut()
.unwrap_or(&mut JsonValue::Null)
.take();
match serde_json::from_value::<InvokePayload>(arg) {
match serde_json::from_str::<InvokePayload>(&request) {
Ok(message) => {
let _ = window.on_message(command, message);
let _ = window.on_message(message);
}
Err(e) => {
let error: crate::Error = e.into();
@ -784,7 +774,7 @@ impl<R: Runtime> WindowManager<R> {
if is_local {
let label = pending.label.clone();
pending = self.prepare_pending_window(pending, &label, pending_labels, app_handle.clone())?;
pending.rpc_handler = Some(self.prepare_rpc_handler(app_handle.clone()));
pending.ipc_handler = Some(self.prepare_ipc_handler(app_handle.clone()));
}
if pending.webview_attributes.file_drop_handler_enabled {

View File

@ -224,9 +224,9 @@ impl<R: Runtime> Window<R> {
}
/// How to handle this window receiving an [`InvokeMessage`].
pub fn on_message(self, command: String, payload: InvokePayload) -> crate::Result<()> {
pub fn on_message(self, payload: InvokePayload) -> crate::Result<()> {
let manager = self.manager.clone();
match command.as_str() {
match payload.command.as_str() {
"__initialized" => {
let payload: PageLoadPayload = serde_json::from_value(payload.inner)?;
manager.run_on_page_load(self, payload);
@ -235,7 +235,7 @@ impl<R: Runtime> Window<R> {
let message = InvokeMessage::new(
self.clone(),
manager.state(),
command.to_string(),
payload.command.to_string(),
payload.inner,
);
let resolver = InvokeResolver::new(self, payload.callback, payload.error);
@ -244,7 +244,7 @@ impl<R: Runtime> Window<R> {
if let Some(module) = &payload.tauri_module {
let module = module.to_string();
crate::endpoints::handle(module, invoke, manager.config(), manager.package_info());
} else if command.starts_with("plugin:") {
} else if payload.command.starts_with("plugin:") {
manager.extend_api(invoke);
} else {
manager.run_invoke_handler(invoke);

View File

@ -178,16 +178,16 @@ dependencies = [
[[package]]
name = "blake3"
version = "1.2.0"
version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "526c210b4520e416420759af363083471656e819a75e831b8d2c9d5a584f2413"
checksum = "882e99e4a0cb2ae6cb6e442102e8e6b7131718d94110e64c3e6a34ea9b106f37"
dependencies = [
"arrayref",
"arrayvec 0.7.2",
"cc",
"cfg-if 1.0.0",
"constant_time_eq",
"digest",
"digest 0.10.1",
"rayon",
]
@ -197,6 +197,24 @@ version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"generic-array",
]
[[package]]
name = "block-buffer"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1d36a02058e76b040de25a4464ba1c80935655595b661505c8b39b664828b95"
dependencies = [
"generic-array",
]
[[package]]
name = "bstr"
version = "0.2.17"
@ -208,9 +226,9 @@ dependencies = [
[[package]]
name = "bumpalo"
version = "3.8.0"
version = "3.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c"
checksum = "a4a45a46ab1f2412e53d3a0ade76ffad2025804294569aae387231a0cd6e0899"
[[package]]
name = "byteorder"
@ -391,9 +409,9 @@ dependencies = [
[[package]]
name = "combine"
version = "4.6.1"
version = "4.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a909e4d93292cd8e9c42e189f61681eff9d67b6541f96b8a1a737f23737bd001"
checksum = "b2b2f5d0ee456f3928812dfc8c6d9a1d592b98678f6d56db9b0cd2b7bc6c8db5"
dependencies = [
"bytes",
"memchr",
@ -502,6 +520,15 @@ dependencies = [
"objc",
]
[[package]]
name = "cpufeatures"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95059428f66df56b63431fdb4e1947ed2190586af5c5a8a8b71122bdf5a7f469"
dependencies = [
"libc",
]
[[package]]
name = "crc32fast"
version = "1.3.0"
@ -513,9 +540,9 @@ dependencies = [
[[package]]
name = "crossbeam-channel"
version = "0.5.1"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06ed27e177f16d65f0f0c22a213e17c696ace5dd64b14258b52f9417ccb52db4"
checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -534,9 +561,9 @@ dependencies = [
[[package]]
name = "crossbeam-epoch"
version = "0.9.5"
version = "0.9.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ec02e091aa634e2c3ada4a392989e7c3116673ef0ac5b72232439094d73b7fd"
checksum = "97242a70df9b89a65d0b6df3c4bf5b9ce03c5b7309019777fbde37e7537f8762"
dependencies = [
"cfg-if 1.0.0",
"crossbeam-utils",
@ -547,14 +574,23 @@ dependencies = [
[[package]]
name = "crossbeam-utils"
version = "0.8.5"
version = "0.8.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d82cfc11ce7f2c3faef78d8a684447b40d503d9681acebed6cb728d45940c4db"
checksum = "cfcae03edb34f947e64acdb1c33ec169824e20657e9ecb61cef6c8c74dcb8120"
dependencies = [
"cfg-if 1.0.0",
"lazy_static",
]
[[package]]
name = "crypto-common"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683d6b536309245c849479fba3da410962a43ed8e51c26b729208ec0ac2798d0"
dependencies = [
"generic-array",
]
[[package]]
name = "cssparser"
version = "0.27.2"
@ -600,12 +636,12 @@ dependencies = [
[[package]]
name = "darling"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "757c0ded2af11d8e739c4daea1ac623dd1624b06c844cf3f5a39f1bdbd99bb12"
checksum = "d0d720b8683f8dd83c65155f0530560cba68cd2bf395f6513a483caee57ff7f4"
dependencies = [
"darling_core 0.13.0",
"darling_macro 0.13.0",
"darling_core 0.13.1",
"darling_macro 0.13.1",
]
[[package]]
@ -624,16 +660,16 @@ dependencies = [
[[package]]
name = "darling_core"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c34d8efb62d0c2d7f60ece80f75e5c63c1588ba68032740494b0b9a996466e3"
checksum = "7a340f241d2ceed1deb47ae36c4144b2707ec7dd0b649f894cb39bb595986324"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote 1.0.9",
"quote",
"strsim 0.10.0",
"syn 1.0.77",
"syn",
]
[[package]]
@ -642,20 +678,20 @@ version = "0.10.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72"
dependencies = [
"darling_core",
"darling_core 0.10.2",
"quote",
"syn",
]
[[package]]
name = "darling_macro"
version = "0.13.0"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ade7bff147130fe5e6d39f089c6bd49ec0250f35d70b2eebf72afdfc919f15cc"
checksum = "72c41b3b7352feb3211a0d743dc5700a4e3b60f51bd2b368892d1e0f9a95f44b"
dependencies = [
"darling_core 0.13.0",
"quote 1.0.9",
"syn 1.0.77",
"darling_core 0.13.1",
"quote",
"syn",
]
[[package]]
@ -711,6 +747,18 @@ dependencies = [
"generic-array",
]
[[package]]
name = "digest"
version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b697d66081d42af4fba142d56918a3cb21dc8eb63372c6b85d14f44fb9c5979b"
dependencies = [
"block-buffer 0.10.0",
"crypto-common",
"generic-array",
"subtle",
]
[[package]]
name = "dirs"
version = "1.0.5"
@ -1067,9 +1115,9 @@ dependencies = [
[[package]]
name = "generic-array"
version = "0.14.4"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
checksum = "fd48d33ec7f05fbfa152300fdad764757cbded343c1aa1cff2fbaf4134851803"
dependencies = [
"typenum",
"version_check",
@ -1359,9 +1407,9 @@ dependencies = [
[[package]]
name = "indexmap"
version = "1.7.0"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bc633605454125dec4b66843673f01c7df2b89479b32e0ed634e43a91cff62a5"
checksum = "282a6247722caba404c065016bbfa522806e51714c34f5dfc3e4a3a46fcb4223"
dependencies = [
"autocfg",
"hashbrown",
@ -1464,9 +1512,9 @@ dependencies = [
[[package]]
name = "kstring"
version = "1.0.5"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e8d7e992938cc9078c8db5fd5bdc400e7f9da6efa384c280902a8922b676221"
checksum = "8b310ccceade8121d7d77fee406160e457c2f4e7c7982d589da3499bc7ea4526"
dependencies = [
"serde",
]
@ -1828,6 +1876,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1"
dependencies = [
"malloc_buf",
"objc_exception",
]
[[package]]
@ -1841,6 +1890,15 @@ dependencies = [
"objc_id",
]
[[package]]
name = "objc_exception"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4"
dependencies = [
"cc",
]
[[package]]
name = "objc_id"
version = "0.1.1"
@ -1856,6 +1914,12 @@ version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "2.0.2"
@ -2609,18 +2673,18 @@ dependencies = [
[[package]]
name = "serde"
version = "1.0.132"
version = "1.0.133"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b9875c23cf305cd1fd7eb77234cbb705f21ea6a72c637a5c6db5fe4b8e7f008"
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_derive"
version = "1.0.132"
version = "1.0.133"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecc0db5cb2556c0e558887d9bbdcf6ac4471e83ff66cf696e5419024d1606276"
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537"
dependencies = [
"proc-macro2",
"quote",
@ -2629,9 +2693,9 @@ dependencies = [
[[package]]
name = "serde_json"
version = "1.0.73"
version = "1.0.74"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bcbd0344bc6533bc7ec56df11d42fb70f1b912351c0825ccb7211b59d8af7cf5"
checksum = "ee2bb9cd061c5865d345bb02ca49fcef1391741b672b54a0bf7b679badec3142"
dependencies = [
"itoa 1.0.1",
"ryu",
@ -2663,9 +2727,9 @@ dependencies = [
[[package]]
name = "serde_with"
version = "1.10.0"
version = "1.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "062b87e45d8f26714eacfaef0ed9a583e2bfd50ebd96bdd3c200733bd5758e2c"
checksum = "ad6056b4cb69b6e43e3a0f055def223380baecc99da683884f205bf347f7c4b3"
dependencies = [
"rustversion",
"serde",
@ -2674,14 +2738,14 @@ dependencies = [
[[package]]
name = "serde_with_macros"
version = "1.5.0"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "98c1fcca18d55d1763e1c16873c4bde0ac3ef75179a28c7b372917e0494625be"
checksum = "12e47be9471c72889ebafb5e14d5ff930d89ae7a67bbdb5f8abb564f845a927e"
dependencies = [
"darling 0.13.0",
"darling 0.13.1",
"proc-macro2",
"quote 1.0.9",
"syn 1.0.77",
"quote",
"syn",
]
[[package]]
@ -2694,6 +2758,19 @@ dependencies = [
"stable_deref_trait",
]
[[package]]
name = "sha2"
version = "0.9.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800"
dependencies = [
"block-buffer 0.9.0",
"cfg-if 1.0.0",
"cpufeatures",
"digest 0.9.0",
"opaque-debug",
]
[[package]]
name = "sharded-slab"
version = "0.1.4"
@ -2854,10 +2931,16 @@ dependencies = [
]
[[package]]
name = "syn"
version = "1.0.84"
name = "subtle"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ecb2e6da8ee5eb9a61068762a32fa9619cc591ceb055b3687f4cd4051ec2e06b"
checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601"
[[package]]
name = "syn"
version = "1.0.85"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7"
dependencies = [
"proc-macro2",
"quote",
@ -2898,7 +2981,7 @@ dependencies = [
[[package]]
name = "tao"
version = "0.5.2"
source = "git+https://github.com/tauri-apps/tao?branch=next#059630cf8f9fa842b7755b4758f330654a1a4195"
source = "git+https://github.com/tauri-apps/tao?rev=9f699a345788fbb08bc483a3f335ca4a94339676#9f699a345788fbb08bc483a3f335ca4a94339676"
dependencies = [
"bitflags",
"cairo-rs",
@ -2930,8 +3013,7 @@ dependencies = [
"scopeguard",
"serde",
"unicode-segmentation",
"windows 0.29.0",
"windows_macros",
"windows 0.25.0",
"x11-dl",
]
@ -2974,6 +3056,7 @@ dependencies = [
"percent-encoding",
"rand 0.8.4",
"raw-window-handle 0.4.2",
"regex",
"rfd",
"semver 1.0.4",
"serde",
@ -3009,6 +3092,7 @@ dependencies = [
name = "tauri-codegen"
version = "1.0.0-beta.4"
dependencies = [
"base64",
"blake3",
"kuchiki",
"proc-macro2",
@ -3016,6 +3100,7 @@ dependencies = [
"regex",
"serde",
"serde_json",
"sha2",
"tauri-utils",
"thiserror",
"walkdir",
@ -3045,7 +3130,7 @@ dependencies = [
"tauri-utils",
"thiserror",
"uuid",
"webview2-com",
"webview2-com 0.9.0",
"windows 0.29.0",
]
@ -3060,7 +3145,7 @@ dependencies = [
"tauri-runtime",
"tauri-utils",
"uuid",
"webview2-com",
"webview2-com 0.9.0",
"windows 0.29.0",
"wry",
]
@ -3085,13 +3170,13 @@ dependencies = [
[[package]]
name = "tempfile"
version = "3.2.0"
version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22"
checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [
"cfg-if 1.0.0",
"fastrand",
"libc",
"rand 0.8.4",
"redox_syscall 0.2.10",
"remove_dir_all",
"winapi",
@ -3204,6 +3289,18 @@ dependencies = [
"serde",
]
[[package]]
name = "toml_edit"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0a0ddb4919e3b49fe9e08e7921d69445bb00ce95a2ea807bb8826cde6610455"
dependencies = [
"combine",
"indexmap",
"itertools",
"kstring",
]
[[package]]
name = "tracing"
version = "0.1.29"
@ -3265,18 +3362,6 @@ dependencies = [
"tracing-log",
]
[[package]]
name = "toml_edit"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e0a0ddb4919e3b49fe9e08e7921d69445bb00ce95a2ea807bb8826cde6610455"
dependencies = [
"combine",
"indexmap",
"itertools",
"kstring",
]
[[package]]
name = "typenum"
version = "1.15.0"
@ -3519,16 +3604,38 @@ dependencies = [
"system-deps 5.0.0",
]
[[package]]
name = "webview2-com"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "abdc9ca7cebd96a1005d5ba1e9d70c61c0f6c276a41cddaeecb7842d436ab3bc"
dependencies = [
"webview2-com-macros 0.4.0",
"webview2-com-sys 0.7.0",
"windows 0.25.0",
]
[[package]]
name = "webview2-com"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b0f21eed16a0078ef52de94d15d6e3a22f9998cf45bdabaf9ef4a235ae235ac"
dependencies = [
"webview2-com-macros",
"webview2-com-sys",
"webview2-com-macros 0.5.0",
"webview2-com-sys 0.9.0",
"windows 0.29.0",
"windows_macros",
"windows_macros 0.29.0",
]
[[package]]
name = "webview2-com-macros"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "07bca4b354035275764ea4ca8d6bfa74cc5b0e8126e7cd675ee327574b59e13d"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
@ -3542,6 +3649,19 @@ dependencies = [
"syn",
]
[[package]]
name = "webview2-com-sys"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73472d7f0e9038b58204cb3f582ee138a8c181719dc6825ea03371ad085c6058"
dependencies = [
"regex",
"serde",
"serde_json",
"thiserror",
"windows 0.25.0",
]
[[package]]
name = "webview2-com-sys"
version = "0.9.0"
@ -3614,13 +3734,29 @@ dependencies = [
"windows_x86_64_msvc 0.24.0",
]
[[package]]
name = "windows"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e46c474738425c090573ecf5472d54ee5f78132e6195d0bbfcc2aabc0ed29f37"
dependencies = [
"windows_aarch64_msvc 0.25.0",
"windows_gen 0.25.0",
"windows_i686_gnu 0.25.0",
"windows_i686_msvc 0.25.0",
"windows_macros 0.25.0",
"windows_reader 0.25.0",
"windows_x86_64_gnu 0.25.0",
"windows_x86_64_msvc 0.25.0",
]
[[package]]
name = "windows"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aac7fef12f4b59cd0a29339406cc9203ab44e440ddff6b3f5a41455349fa9cf3"
dependencies = [
"windows_aarch64_msvc",
"windows_aarch64_msvc 0.29.0",
"windows_i686_gnu 0.29.0",
"windows_i686_msvc 0.29.0",
"windows_x86_64_gnu 0.29.0",
@ -3633,24 +3769,40 @@ version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b01138bf46333583966ea4b86fd4f61a9b524c0f5f88bc3c18768d6b66cb6c4e"
dependencies = [
"windows_quote",
"windows_reader",
"windows_quote 0.29.0",
"windows_reader 0.29.0",
]
[[package]]
name = "windows_aarch64_msvc"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3022d174000fcaeb6f95933fb04171ea0e21b9289ac57fe4400bfa148e41df79"
[[package]]
name = "windows_aarch64_msvc"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3d027175d00b01e0cbeb97d6ab6ebe03b12330a35786cbaca5252b1c4bf5d9b"
[[package]]
name = "windows_gen"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54e0f0e40e950724f92de0f714817c7030a88161738b9b1c58d62c817246fe1c"
dependencies = [
"windows_quote 0.25.0",
"windows_reader 0.25.0",
]
[[package]]
name = "windows_gen"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e59eb69ef41a029911bb604a850f70ec1f58c8587511bc10ed84a3465931df0b"
dependencies = [
"windows_quote",
"windows_reader",
"windows_quote 0.29.0",
"windows_reader 0.29.0",
]
[[package]]
@ -3659,6 +3811,12 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0866510a3eca9aed73a077490bbbf03e5eaac4e1fd70849d89539e5830501fd"
[[package]]
name = "windows_i686_gnu"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "03b1584eebf06654708eab4301152032c13c1e47f4a754ffc93c733f10993e85"
[[package]]
name = "windows_i686_gnu"
version = "0.29.0"
@ -3671,12 +3829,30 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf0ffed56b7e9369a29078d2ab3aaeceea48eb58999d2cff3aa2494a275b95c6"
[[package]]
name = "windows_i686_msvc"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f49df16591e9ad429997ec57d462b0cc45168f639d03489e8c2e933ea9c389d7"
[[package]]
name = "windows_i686_msvc"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8602f6c418b67024be2996c512f5f995de3ba417f4c75af68401ab8756796ae4"
[[package]]
name = "windows_macros"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6103bcf1a7396d66f6f08a2d67d8a2ab34efaf4b1d7567301af2c002507c8c3b"
dependencies = [
"syn",
"windows_gen 0.25.0",
"windows_quote 0.25.0",
"windows_reader 0.25.0",
]
[[package]]
name = "windows_macros"
version = "0.29.0"
@ -3684,17 +3860,29 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f6443f71f760ce91f4cc7fc81ee78f680dccb8ec110c52a92ec857a7def39a3"
dependencies = [
"syn",
"windows_gen",
"windows_quote",
"windows_reader",
"windows_gen 0.29.0",
"windows_quote 0.29.0",
"windows_reader 0.29.0",
]
[[package]]
name = "windows_quote"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e414df8d5dd2013f2317fdc414d3ad035effcb7aef1f16bf508ac5743154835a"
[[package]]
name = "windows_quote"
version = "0.29.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1dd83f20d7c391dc3b115a7e8a0851b71d0a9c356be2791571e858063b5f823c"
[[package]]
name = "windows_reader"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8132c9fb77903d852ea20053af816bd15c088a6e8d283b8283e80353347bb6b9"
[[package]]
name = "windows_reader"
version = "0.29.0"
@ -3707,6 +3895,12 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384a173630588044205a2993b6864a2f56e5a8c1e7668c07b93ec18cf4888dc4"
[[package]]
name = "windows_x86_64_gnu"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2cb06177184100374f97d5e7261ee0b6adefa8ee32e38f87518ca22b519bb80e"
[[package]]
name = "windows_x86_64_gnu"
version = "0.29.0"
@ -3719,6 +3913,12 @@ version = "0.24.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9bd8f062d8ca5446358159d79a90be12c543b3a965c847c8f3eedf14b321d399"
[[package]]
name = "windows_x86_64_msvc"
version = "0.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3c27bcbb33ddbed3569e36c14775c99f72b97c72ce49f81d128637fb48a061f"
[[package]]
name = "windows_x86_64_msvc"
version = "0.29.0"
@ -3748,7 +3948,7 @@ dependencies = [
[[package]]
name = "wry"
version = "0.12.2"
source = "git+https://github.com/tauri-apps/wry?rev=3284f8d442978269f7654edbdfc9bc51022eaa40#3284f8d442978269f7654edbdfc9bc51022eaa40"
source = "git+https://github.com/tauri-sec/wry?branch=next#7e6021068c0d20688ac3d218da1f55d02eaa6f0c"
dependencies = [
"cocoa",
"core-graphics 0.22.3",
@ -3769,9 +3969,8 @@ dependencies = [
"url",
"webkit2gtk",
"webkit2gtk-sys",
"webview2-com",
"windows 0.29.0",
"windows_macros",
"webview2-com 0.7.0",
"windows 0.25.0",
]
[[package]]
@ -3851,18 +4050,18 @@ dependencies = [
[[package]]
name = "zstd"
version = "0.9.1+zstd.1.5.1"
version = "0.9.2+zstd.1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "538b8347df9257b7fbce37677ef7535c00a3c7bf1f81023cc328ed7fe4b41de8"
checksum = "2390ea1bf6c038c39674f22d95f0564725fc06034a47129179810b2fc58caa54"
dependencies = [
"zstd-safe",
]
[[package]]
name = "zstd-safe"
version = "4.1.2+zstd.1.5.1"
version = "4.1.3+zstd.1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fb4cfe2f6e6d35c5d27ecd9d256c4b6f7933c4895654917460ec56c29336cc1"
checksum = "e99d81b99fb3c2c2c794e3fe56c305c63d5173a16a46b5850b07c935ffc7db79"
dependencies = [
"libc",
"zstd-sys",

View File

@ -12,7 +12,7 @@ tauri-build = { path = "../../../core/tauri-build" }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] }
tauri = { path = "../../../core/tauri", features = ["api-all", "cli", "system-tray", "updater"] }
tauri = { path = "../../../core/tauri", features = ["api-all", "cli", "macos-private-api", "system-tray", "updater"] }
[features]
default = [ "custom-protocol" ]

View File

@ -10,6 +10,7 @@
"version": "../package.json"
},
"tauri": {
"macOSPrivateApi": true,
"cli": {
"description": "Tauri API example",
"args": [

View File

@ -1171,7 +1171,11 @@ interface WindowOptions {
fullscreen?: boolean
/** Whether the window will be initially hidden or focused. */
focus?: boolean
/** Whether the window is transparent or not. */
/**
* Whether the window is transparent or not.
* Note that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > tauri > macosPrivateApi`.
* WARNING: Using private APIs on `macOS` prevents your application from being accepted for the `App Store`.
*/
transparent?: boolean
/** Whether the window should be maximized upon creation or not. */
maximized?: boolean

View File

@ -105,6 +105,7 @@
"wix": null
}
},
"macOSPrivateApi": false,
"security": {},
"updater": {
"active": false,
@ -1161,6 +1162,11 @@
}
]
},
"macOSPrivateApi": {
"description": "MacOS private API configuration. Enables the transparent background API and sets the `fullScreenEnabled` preference to `true`.",
"default": false,
"type": "boolean"
},
"security": {
"description": "Security configuration.",
"default": {},
@ -1372,7 +1378,7 @@
"type": "string"
},
"transparent": {
"description": "Whether the window is transparent or not.",
"description": "Whether the window is transparent or not.\n\nNote that on `macOS` this requires the `macos-private-api` feature flag, enabled under `tauri.conf.json > tauri > macosPrivateApi`. WARNING: Using private APIs on `macOS` prevents your application from being accepted for the `App Store`.",
"default": false,
"type": "boolean"
},