refractor: add missing MacOS depencies for tauri application

This commit is contained in:
2026-03-25 07:11:37 +01:00
parent b4b3494e17
commit 778a3fc258
7 changed files with 66 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
Bundle the macOS x64 NexaVPN tunnel helper here.
Expected filename:
- nexavpn-tunnel-helper
This helper encapsulates the WireGuard runtime so the end user only interacts with NexaVPN.

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.network.client</key>
<true/>
<key>com.apple.security.network.server</key>
<true/>
</dict>
</plist>

View File

@@ -996,8 +996,17 @@ pub fn run() {
Ok(())
})
.on_window_event(|window, event| match event {
WindowEvent::CloseRequested { .. } => {
window.app_handle().exit(0);
WindowEvent::CloseRequested { api, .. } => {
#[cfg(target_os = "macos")]
{
hide_main_window(window);
api.prevent_close();
}
#[cfg(not(target_os = "macos"))]
{
let _ = api;
window.app_handle().exit(0);
}
}
WindowEvent::Resized(_) => {
if window.is_minimized().unwrap_or(false) {

View File

@@ -15,8 +15,10 @@ const CREATE_NO_WINDOW: u32 = 0x08000000;
pub fn current_tunnel_strategy() -> &'static str {
if cfg!(target_os = "windows") {
"embedded-wireguard-windows-x64"
} else if cfg!(target_os = "macos") {
"embedded-wireguard-macos-arm"
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
"embedded-wireguard-macos-arm64"
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
"embedded-wireguard-macos-x64"
} else {
"unsupported"
}
@@ -108,10 +110,12 @@ fn bundled_backend(app: &AppHandle) -> Result<PathBuf, String> {
let relative = if cfg!(target_os = "windows") {
PathBuf::from("bundled/windows-x64/nexavpn-tunnel-helper.exe")
} else if cfg!(target_os = "macos") {
} else if cfg!(all(target_os = "macos", target_arch = "aarch64")) {
PathBuf::from("bundled/macos-arm64/nexavpn-tunnel-helper")
} else if cfg!(all(target_os = "macos", target_arch = "x86_64")) {
PathBuf::from("bundled/macos-x64/nexavpn-tunnel-helper")
} else {
return Err("This NexaVPN client build supports embedded tunnel backends only for Windows x64 and macOS ARM".into());
return Err("This NexaVPN client build supports embedded tunnel backends only for Windows x64, macOS ARM64, and macOS x64".into());
};
let path = resource_dir.join(relative);

View File

@@ -0,0 +1,15 @@
{
"$schema": "https://schema.tauri.app/config/2",
"bundle": {
"targets": ["dmg", "app"],
"icon": [
"icons/icon.png",
"icons/icon.icns"
],
"category": "Utility",
"macOS": {
"entitlements": "entitlements.plist",
"minimumSystemVersion": "11.0"
}
}
}