diff --git a/AGENTS.md b/AGENTS.md index c217399..ea09599 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -72,6 +72,21 @@ If a required command fails or emits a warning from project code, fix it in the ## Lessons +- Use a platform-native Hiddify path in dependency status fixtures and assert + which file was selected. A Linux AppImage fixture on macOS only passed when + a real Hiddify app was installed on the developer's host (ADR 0141). + +- A settings recovery fixture must compare with an ordinary load of the saved + settings. macOS normalizes the TUN name and DNS port on load, so comparing + with the immediate save result fails even when recovery succeeds (ADR 0142). + +- A Finder-launched application can have a different PATH from the terminal. + Check both standard Homebrew prefixes for the OpenVPN CLI in the desktop, + and refresh the check on window focus after installation. Track CLI + presence separately from supported side-tunnel routing. Use the desktop's + candidate list for environment snapshots and remove the old collector's + `PathBuf` import when the list moves (ADR 0075). + - A path or a file that reaches the helper over IPC is attacker input, even from the authorized user: the helper is root and the desktop is not. "Regular, non-symlink file" is not trust. Check who can change the file and every diff --git a/Cargo.lock b/Cargo.lock index da2b6cd..503f84e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2044,7 +2044,7 @@ dependencies = [ [[package]] name = "iran-split-cli" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "clap", @@ -2062,7 +2062,7 @@ dependencies = [ [[package]] name = "iran-split-clients" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "ipnet", @@ -2079,7 +2079,7 @@ dependencies = [ [[package]] name = "iran-split-config" -version = "6.3.0" +version = "6.3.1" dependencies = [ "hex", "rand 0.9.5", @@ -2092,7 +2092,7 @@ dependencies = [ [[package]] name = "iran-split-core" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "iran-split-config", @@ -2109,7 +2109,7 @@ dependencies = [ [[package]] name = "iran-split-desktop" -version = "6.3.0" +version = "6.3.1" dependencies = [ "dirs 6.0.0", "flate2", @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "iran-split-helper" -version = "6.3.0" +version = "6.3.1" dependencies = [ "clap", "hex", @@ -2176,7 +2176,7 @@ dependencies = [ [[package]] name = "iran-split-helper-winacl" -version = "6.3.0" +version = "6.3.1" dependencies = [ "tokio", "windows", @@ -2184,7 +2184,7 @@ dependencies = [ [[package]] name = "iran-split-ipc" -version = "6.3.0" +version = "6.3.1" dependencies = [ "bytes", "serde", @@ -2196,7 +2196,7 @@ dependencies = [ [[package]] name = "iran-split-mihomo" -version = "6.3.0" +version = "6.3.1" dependencies = [ "futures-util", "hex", @@ -2219,7 +2219,7 @@ dependencies = [ [[package]] name = "iran-split-netstats" -version = "6.3.0" +version = "6.3.1" dependencies = [ "libc", "tempfile", @@ -2228,7 +2228,7 @@ dependencies = [ [[package]] name = "iran-split-platform-linux" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "hex", @@ -2252,7 +2252,7 @@ dependencies = [ [[package]] name = "iran-split-platform-macos" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "hex", @@ -2276,7 +2276,7 @@ dependencies = [ [[package]] name = "iran-split-platform-win" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "iran-split-clients", @@ -2299,7 +2299,7 @@ dependencies = [ [[package]] name = "iran-split-rules" -version = "6.3.0" +version = "6.3.1" dependencies = [ "async-trait", "hex", @@ -2321,7 +2321,7 @@ dependencies = [ [[package]] name = "iran-split-taskbar" -version = "6.3.0" +version = "6.3.1" dependencies = [ "iran-split-config", "objc2", diff --git a/Cargo.toml b/Cargo.toml index 3b89383..e13c53c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ members = [ ] [workspace.package] -version = "6.3.0" +version = "6.3.1" edition = "2021" license = "MIT OR Apache-2.0" rust-version = "1.88" diff --git a/apps/desktop/package.json b/apps/desktop/package.json index 7dfa1ec..cdb56b8 100644 --- a/apps/desktop/package.json +++ b/apps/desktop/package.json @@ -1,6 +1,6 @@ { "name": "@iran-split/desktop", - "version": "6.3.0", + "version": "6.3.1", "private": true, "type": "module", "scripts": { diff --git a/apps/desktop/src/components/ClientRegistry.test.tsx b/apps/desktop/src/components/ClientRegistry.test.tsx index bbf3bb6..06b5e28 100644 --- a/apps/desktop/src/components/ClientRegistry.test.tsx +++ b/apps/desktop/src/components/ClientRegistry.test.tsx @@ -1,4 +1,4 @@ -import { render, screen, within } from "@testing-library/react"; +import { fireEvent, render, screen, within } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { beforeEach, describe, expect, it, vi } from "vitest"; import { desktop } from "../api/desktop"; @@ -367,6 +367,31 @@ describe("ClientRegistry profile picker", () => { ); }); + it("refreshes OpenVPN installation on focus and explains the macOS tunnel limitation", async () => { + useAppStore.setState({ boot: { platform: "macos" } as BootstrapResult }); + vi.mocked(desktop.clientBinaryInstalled).mockResolvedValue(false); + render(); + + const card = within(screen.getByTestId("client-card-openvpn")); + const windscribe = within(screen.getByTestId("client-card-windscribe")); + expect(await card.findByText("OpenVPN CLI was not found.")).toBeVisible(); + expect( + await windscribe.findByText("OpenVPN CLI was not found."), + ).toBeVisible(); + + vi.mocked(desktop.clientBinaryInstalled).mockResolvedValue(true); + fireEvent.focus(window); + + expect(await card.findByText("OpenVPN CLI is installed.")).toBeVisible(); + expect( + await windscribe.findByText("OpenVPN CLI is installed."), + ).toBeVisible(); + expect( + card.getByText("BiFlow side tunnels are unavailable on macOS."), + ).toBeVisible(); + expect(card.queryByText("OpenVPN CLI was not found.")).toBeNull(); + }); + it.each([ ["macos", "https://formulae.brew.sh/formula/openvpn"], ["linux", "https://openvpn.net/community-docs/installing-openvpn/"], diff --git a/apps/desktop/src/components/ClientRegistry.tsx b/apps/desktop/src/components/ClientRegistry.tsx index 8e27f1e..99850f5 100644 --- a/apps/desktop/src/components/ClientRegistry.tsx +++ b/apps/desktop/src/components/ClientRegistry.tsx @@ -417,17 +417,25 @@ function ClientCard({ // Side tunnels need a system binary the app cannot ship; surface a // per-platform download link when it is missing. const [binaryInstalled, setBinaryInstalled] = useState(null); + const macosSideTunnel = + platform === "macos" && client.config.kind === "owned_side_tunnel"; useEffect(() => { if (client.config.kind !== "owned_side_tunnel") return; - let cancelled = false; - desktop - .clientBinaryInstalled(client.preset) - .then((installed) => { - if (!cancelled) setBinaryInstalled(installed); - }) - .catch(() => undefined); + let latestCheck = 0; + function checkInstallation() { + const check = ++latestCheck; + void desktop + .clientBinaryInstalled(client.preset) + .then((installed) => { + if (check === latestCheck) setBinaryInstalled(installed); + }) + .catch(() => undefined); + } + checkInstallation(); + window.addEventListener("focus", checkInstallation); return () => { - cancelled = true; + latestCheck += 1; + window.removeEventListener("focus", checkInstallation); }; }, [client.preset, client.config.kind]); @@ -496,14 +504,29 @@ function ClientCard({ ) : null}

- {binaryInstalled === false ? ( -

- {t("binaryMissing")} - + {binaryInstalled === false || macosSideTunnel ? ( +

+ {binaryInstalled === false ? ( + + {t(macosSideTunnel ? "openvpnCliMissing" : "binaryMissing")} + + ) : null} + {macosSideTunnel && binaryInstalled === true ? ( + {t("openvpnCliInstalled")} + ) : null} + {macosSideTunnel ? ( + {t("macosSideTunnelUnavailable")} + ) : null} + {binaryInstalled === false ? ( + + ) : null}

) : null} diff --git a/apps/desktop/src/i18n/config.ts b/apps/desktop/src/i18n/config.ts index 182b9be..6bd255b 100644 --- a/apps/desktop/src/i18n/config.ts +++ b/apps/desktop/src/i18n/config.ts @@ -179,6 +179,10 @@ const resources = { clientDetails: "Settings & pinned hosts", pinSummary: "{{domains}} domains · {{ips}} IPs", binaryMissing: "OpenVPN is not installed on this system.", + openvpnCliMissing: "OpenVPN CLI was not found.", + openvpnCliInstalled: "OpenVPN CLI is installed.", + macosSideTunnelUnavailable: + "BiFlow side tunnels are unavailable on macOS.", allowDirectWhenDown: "If disconnected, allow direct (leaks real IP)", openvpnProfile: "Config file", chooseFile: "Choose file", @@ -606,6 +610,9 @@ const resources = { clientDetails: "تنظیمات و میزبان‌های سنجاق‌شده", pinSummary: "{{domains}} دامنه · {{ips}} آی‌پی", binaryMissing: "OpenVPN روی این سیستم نصب نیست.", + openvpnCliMissing: "نسخهٔ خط فرمان OpenVPN پیدا نشد.", + openvpnCliInstalled: "نسخهٔ خط فرمان OpenVPN نصب است.", + macosSideTunnelUnavailable: "تونل جانبی BiFlow روی macOS در دسترس نیست.", allowDirectWhenDown: "اگر قطع بود، مستقیم برود (آی‌پی واقعی لو می‌رود)", openvpnProfile: "فایل کانفیگ", chooseFile: "انتخاب فایل", diff --git a/crates/iran-split-config/src/lib.rs b/crates/iran-split-config/src/lib.rs index f8a47fa..56643ea 100644 --- a/crates/iran-split-config/src/lib.rs +++ b/crates/iran-split-config/src/lib.rs @@ -1062,8 +1062,12 @@ mod tests { let path = directory.path().join("config.toml"); let store = store(&path); let mut config = store.load_or_create().expect("create"); - config.behavior.show_taskbar_speed = !config.behavior.show_taskbar_speed; - let saved = store.save(config, 0).expect("save"); + let show_taskbar_speed = !config.behavior.show_taskbar_speed; + config.behavior.show_taskbar_speed = show_taskbar_speed; + store.save(config, 0).expect("save"); + let expected = store.load().expect("read saved settings for this platform"); + assert_eq!(expected.revision, 1); + assert_eq!(expected.behavior.show_taskbar_speed, show_taskbar_speed); for (broken, cause) in [ (b"password = \"secret".as_slice(), "not_valid_toml"), (b"\xff\xfe\x00".as_slice(), "not_text"), @@ -1074,12 +1078,15 @@ mod tests { let recovery = recovery.expect("recovered"); assert_eq!(recovery.cause, cause); assert_eq!(recovery.source, RecoveredFrom::LastSaved); - assert_eq!(loaded, saved); + assert!(loaded == expected, "recovery must match an ordinary load"); assert_eq!( fs::read(path.with_extension("toml.corrupt")).expect("kept"), broken ); - assert_eq!(store.load().expect("load"), saved); + assert!( + store.load().expect("load") == expected, + "the next load must retain the recovered settings" + ); } } diff --git a/docs/adr/0075-windscribe-openvpn-download.md b/docs/adr/0075-windscribe-openvpn-download.md index 7b0b081..84bc2b1 100644 --- a/docs/adr/0075-windscribe-openvpn-download.md +++ b/docs/adr/0075-windscribe-openvpn-download.md @@ -21,6 +21,13 @@ already had a profile still had no in-app path to OpenVPN. instructions. On Windows it opens the official Community installer page. - The amber "OpenVPN is not installed" banner always opens the OpenVPN page, including on a Windscribe card. +- The desktop and environment snapshot check the standard Homebrew CLI paths + for Apple Silicon and Intel Macs independently of the app's launch PATH. + Under `/opt/homebrew` and `/usr/local`, discovery checks both + `opt/openvpn/sbin/openvpn` and `sbin/openvpn`. + Client cards refresh installation status when the window regains focus. + On macOS the card and environment findings describe side-tunnel support + separately from CLI presence. Homebrew discovery belongs to the desktop. - The URL allowlist stays derived from the preset table; Windscribe reuses the OpenVPN row so it cannot drift. - Use `/usr/bin/open` on macOS, `xdg-open` on Linux, and the Windows shell diff --git a/docs/screenshots/desktop.png b/docs/screenshots/desktop.png index 05928f7..ebd5560 100644 Binary files a/docs/screenshots/desktop.png and b/docs/screenshots/desktop.png differ diff --git a/docs/screenshots/diagnostics.png b/docs/screenshots/diagnostics.png index fb18cdb..809d521 100644 Binary files a/docs/screenshots/diagnostics.png and b/docs/screenshots/diagnostics.png differ diff --git a/docs/screenshots/mobile.png b/docs/screenshots/mobile.png index d97823b..a34850a 100644 Binary files a/docs/screenshots/mobile.png and b/docs/screenshots/mobile.png differ diff --git a/docs/screenshots/settings-speed.png b/docs/screenshots/settings-speed.png index 9d28f28..16aaf5e 100644 Binary files a/docs/screenshots/settings-speed.png and b/docs/screenshots/settings-speed.png differ diff --git a/e2e/primary-flows.spec.ts b/e2e/primary-flows.spec.ts index e64626f..7300af6 100644 --- a/e2e/primary-flows.spec.ts +++ b/e2e/primary-flows.spec.ts @@ -645,13 +645,30 @@ test.describe("primary BiFlow flows", () => { await row.getByRole("button", { name: /^OpenVPN/ }).click(); const card = page.getByTestId("client-card-openvpn"); await expect( - card.getByText("OpenVPN is not installed on this system."), + card.getByText( + platform === "macOS" + ? "OpenVPN CLI was not found." + : "OpenVPN is not installed on this system.", + ), ).toBeVisible(); await page.evaluate(() => sessionStorage.removeItem("client-download-test-url"), ); await card.getByRole("button", { name: "Download OpenVPN" }).click(); await expect.poll(openedUrl).toBe(url); + if (platform === "macOS") { + await page.evaluate(() => { + sessionStorage.setItem("biflow-mock-openvpn-installed", "1"); + window.dispatchEvent(new Event("focus")); + }); + await expect(card.getByText("OpenVPN CLI is installed.")).toBeVisible(); + await expect( + card.getByText("BiFlow side tunnels are unavailable on macOS."), + ).toBeVisible(); + await expect(card.getByText("OpenVPN CLI was not found.")).toHaveCount( + 0, + ); + } await page.getByRole("button", { name: "Add client" }).click(); const happRow = page.getByTestId("client-catalog-happ"); diff --git a/package.json b/package.json index c592b16..721e1ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "iran-split-desktop-workspace", - "version": "6.3.0", + "version": "6.3.1", "private": true, "packageManager": "pnpm@9.0.1", "engines": { diff --git a/src-tauri/src/deps.rs b/src-tauri/src/deps.rs index c688bca..8ef7daf 100644 --- a/src-tauri/src/deps.rs +++ b/src-tauri/src/deps.rs @@ -241,6 +241,57 @@ fn lookup_on_path(names: &[&str]) -> Vec { ) } +pub(crate) fn known_openvpn_binary() -> Option { + first_existing(&openvpn_candidates(std::env::consts::OS)) +} + +pub(crate) fn openvpn_binary_installed() -> bool { + let name = if cfg!(windows) { + "openvpn.exe" + } else { + "openvpn" + }; + known_openvpn_binary().is_some() || !lookup_on_path(&[name]).is_empty() +} + +// Desktop discovery only. The privileged helper has its own executable policy. +fn openvpn_candidates(platform: &str) -> Vec { + const UNIX: &[&str] = &[ + "/usr/sbin/openvpn", + "/usr/bin/openvpn", + "/sbin/openvpn", + "/bin/openvpn", + ]; + const HOMEBREW: &[&str] = &[ + "/opt/homebrew/opt/openvpn/sbin/openvpn", + "/usr/local/opt/openvpn/sbin/openvpn", + "/opt/homebrew/sbin/openvpn", + "/usr/local/sbin/openvpn", + ]; + if platform == "windows" { + return ["ProgramFiles", "ProgramFiles(x86)"] + .into_iter() + .filter_map(std::env::var_os) + .map(|root| { + PathBuf::from(root) + .join("OpenVPN") + .join("bin") + .join("openvpn.exe") + }) + .chain([ + PathBuf::from(r"C:\Program Files\OpenVPN\bin\openvpn.exe"), + PathBuf::from(r"C:\Program Files (x86)\OpenVPN\bin\openvpn.exe"), + ]) + .collect(); + } + let platform_paths = if platform == "macos" { HOMEBREW } else { &[] }; + platform_paths + .iter() + .chain(UNIX) + .map(PathBuf::from) + .collect() +} + #[cfg(any(windows, test))] fn has_extension(name: &str, extension: &str) -> bool { Path::new(name) @@ -1102,6 +1153,31 @@ fn open_url_allowed(url: &str) -> bool { mod tests { use super::*; + #[test] + fn desktop_finds_homebrew_openvpn_without_path() { + let mac = openvpn_candidates("macos"); + let linux = openvpn_candidates("linux"); + for expected in [ + "/opt/homebrew/opt/openvpn/sbin/openvpn", + "/usr/local/opt/openvpn/sbin/openvpn", + "/opt/homebrew/sbin/openvpn", + "/usr/local/sbin/openvpn", + ] { + assert!(mac.iter().any(|path| path == Path::new(expected))); + assert!(!linux.iter().any(|path| path == Path::new(expected))); + let fixture = tempfile::tempdir().unwrap(); + let candidates: Vec<_> = mac + .iter() + .map(|path| fixture.path().join(path.strip_prefix("/").unwrap())) + .collect(); + assert_eq!(first_existing(&candidates), None); + let cli = fixture.path().join(expected.trim_start_matches('/')); + fs::create_dir_all(cli.parent().unwrap()).unwrap(); + fs::write(&cli, "synthetic installation").unwrap(); + assert_eq!(first_existing(&candidates), Some(cli)); + } + } + #[test] fn zip_extraction_keeps_nested_files_inside_destination() { let mut archive = zip::ZipWriter::new(Cursor::new(Vec::new())); @@ -1438,18 +1514,28 @@ mod tests { #[test] fn existing_binaries_in_data_dir_hide_install() { - let dir = std::env::temp_dir().join(format!("biflow-deps-{}", std::process::id())); - let apps = dir.join("apps"); - let bin = dir.join("bin"); - fs::create_dir_all(&apps).expect("apps"); - fs::create_dir_all(&bin).expect("bin"); - fs::write(apps.join("Hiddify.AppImage"), b"elf").expect("hiddify"); - fs::write(mihomo_install_path(&dir), b"elf").expect("mihomo"); - let status = dependency_status(&dir); - fs::remove_dir_all(&dir).expect("cleanup dependency fixture"); - assert!(status + let directory = tempfile::tempdir().expect("dependency fixture"); + let data = directory.path(); + let hiddify = data.join(match std::env::consts::OS { + "macos" => "apps/Hiddify.app/Contents/MacOS/Hiddify", + "windows" => "apps/Hiddify/Hiddify.exe", + _ => "apps/Hiddify.AppImage", + }); + let mihomo = mihomo_install_path(data); + fs::create_dir_all(hiddify.parent().expect("Hiddify directory")).expect("apps"); + fs::create_dir_all(mihomo.parent().expect("Mihomo directory")).expect("bin"); + fs::write(&hiddify, b"fixture").expect("hiddify"); + fs::write(mihomo, b"fixture").expect("mihomo"); + let status = dependency_status(data); + let hiddify_status = status .iter() - .any(|item| item.id == "hiddify" && item.installed)); + .find(|item| item.id == "hiddify") + .expect("Hiddify status"); + assert!(hiddify_status.installed); + assert_eq!( + hiddify_status.path.as_deref().map(Path::new), + Some(hiddify.as_path()) + ); assert!(status .iter() .any(|item| item.id == "mihomo" && item.installed)); diff --git a/src-tauri/src/environment/apps.rs b/src-tauri/src/environment/apps.rs index b5adbc3..16c465b 100644 --- a/src-tauri/src/environment/apps.rs +++ b/src-tauri/src/environment/apps.rs @@ -14,11 +14,7 @@ use jiff::{ use regex::Regex; use serde::Serialize; use serde_json::Value; -use std::{ - path::{Path, PathBuf}, - sync::OnceLock, - time::Duration, -}; +use std::{path::Path, sync::OnceLock, time::Duration}; #[derive(Debug, Clone, Serialize, Default)] pub struct RuntimeInfo { @@ -232,35 +228,6 @@ pub(super) fn path_location(path: &Path, data_dir: Option<&Path>) -> &'static st } } -/// `OpenVPN` paths the helper searches (`iran-split-helper` `candidate_binaries`). -pub(super) fn openvpn_candidates() -> Vec { - if cfg!(windows) { - let mut paths = Vec::new(); - for variable in ["ProgramFiles", "ProgramFiles(x86)"] { - if let Some(root) = std::env::var_os(variable) { - paths.push( - PathBuf::from(root) - .join("OpenVPN") - .join("bin") - .join("openvpn.exe"), - ); - } - } - paths.push(PathBuf::from(r"C:\Program Files\OpenVPN\bin\openvpn.exe")); - paths - } else { - [ - "/usr/sbin/openvpn", - "/usr/bin/openvpn", - "/sbin/openvpn", - "/bin/openvpn", - ] - .into_iter() - .map(PathBuf::from) - .collect() - } -} - /// First line of `--version`, with addresses and home paths removed. pub(super) fn first_version_line(output: &str) -> Option { output @@ -890,6 +857,9 @@ fn side_tunnel_findings(report: &EnvironmentReport, findings: &mut Vec) { findings.push("openvpn_binary_missing".into()); } + if openvpn_needed && report.system.os == "macos" { + findings.push("openvpn_side_tunnel_unsupported_on_macos".into()); + } } #[cfg(test)] @@ -1090,6 +1060,39 @@ mod tests { ); } + #[test] + fn installed_macos_openvpn_still_reports_the_tunnel_limitation() { + let report = EnvironmentReport { + system: super::super::SystemInfo { + os: "macos", + ..super::super::SystemInfo::default() + }, + apps: AppsInfo { + openvpn: Some(BinaryInfo { + found: true, + location: "system", + version: None, + }), + side_tunnels: vec![SideTunnelProfile { + preset: "openvpn", + enabled: true, + ..SideTunnelProfile::default() + }], + ..AppsInfo::default() + }, + ..EnvironmentReport::default() + }; + let mut found = Vec::new(); + side_tunnel_findings(&report, &mut found); + assert_eq!( + found, + [ + "side_tunnel_no_profile:openvpn", + "openvpn_side_tunnel_unsupported_on_macos" + ] + ); + } + #[test] fn helper_version_mismatch_and_last_error_are_findings() { let mut report = EnvironmentReport::default(); diff --git a/src-tauri/src/environment/mod.rs b/src-tauri/src/environment/mod.rs index 769af86..f031686 100644 --- a/src-tauri/src/environment/mod.rs +++ b/src-tauri/src/environment/mod.rs @@ -501,9 +501,7 @@ async fn collect(context: CollectContext) -> EnvironmentReport { report.runtime = apps::runtime_info(context.stack.as_ref(), context.helper.as_ref()); report.install = apps::install_info(context.install_kind); let data_dir = context.data_dir.as_deref(); - let openvpn = apps::openvpn_candidates() - .into_iter() - .find(|path| path.exists()); + let openvpn = crate::deps::known_openvpn_binary(); let (mihomo, openvpn_binary, clock) = tokio::join!( apps::binary_info(context.mihomo_path.as_deref(), "-v", data_dir), apps::binary_info(openvpn.as_deref(), "--version", data_dir), diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index dd6bcae..b23d69e 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -2050,7 +2050,24 @@ fn client_binary_installed(preset: String) -> Result { Ok(match spec.kind { // Side tunnels need the system OpenVPN binary the app // cannot ship; local proxies are probed at Connect instead. - iran_split_config::EgressKind::OwnedSideTunnel => openvpn_binary_installed(), + iran_split_config::EgressKind::OwnedSideTunnel => { + let installed = deps::openvpn_binary_installed(); + info!( + event = "dependency.openvpn_detection", + section = "dependencies", + initiator = "tauri_command", + cause = if installed { + "cli_found" + } else { + "cli_missing" + }, + trace_route = "tauri_command->dependencies->client_binary_installed", + preset = spec.id, + installed, + "OpenVPN CLI installation checked" + ); + installed + } iran_split_config::EgressKind::LocalProxy => true, iran_split_config::EgressKind::Unsupported => false, }) @@ -2058,34 +2075,6 @@ fn client_binary_installed(preset: String) -> Result { ) } -fn openvpn_binary_installed() -> bool { - // Kept in step with `candidate_binaries` in the helper's openvpn module. - let fixed: &[&str] = if cfg!(windows) { - &[ - r"C:\Program Files\OpenVPN\bin\openvpn.exe", - r"C:\Program Files (x86)\OpenVPN\bin\openvpn.exe", - ] - } else { - &[ - "/usr/sbin/openvpn", - "/usr/bin/openvpn", - "/sbin/openvpn", - "/bin/openvpn", - ] - }; - if fixed.iter().any(|path| Path::new(path).is_file()) { - return true; - } - let name = if cfg!(windows) { - "openvpn.exe" - } else { - "openvpn" - }; - std::env::var_os("PATH").is_some_and(|path| { - std::env::split_paths(&path).any(|directory| directory.join(name).is_file()) - }) -} - #[tauri::command] async fn open_external_url(url: String) -> Result<(), String> { diagnostics::trace_action( diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 086cac0..0f42fd4 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "BiFlow", - "version": "6.3.0", + "version": "6.3.1", "identifier": "app.biflow.desktop", "build": { "beforeDevCommand": "pnpm bundle:check && pnpm --dir apps/desktop dev", diff --git a/version b/version index e7e42a4..dc0208a 100644 --- a/version +++ b/version @@ -1 +1 @@ -6.3.0 \ No newline at end of file +6.3.1