Add VPN proxy connection handling

This commit is contained in:
2026-07-07 22:33:15 +03:00
parent 7dbf786c56
commit c5bdb10445
8 changed files with 1108 additions and 29 deletions

View File

@@ -32,6 +32,8 @@ use proxifyre::ProxiFyreAdapter;
use std::collections::HashSet;
use std::fs;
use std::path::{Path, PathBuf};
#[cfg(windows)]
use std::process::Command as ProcessCommand;
use std::time::{SystemTime, UNIX_EPOCH};
use storage::JsonStorage;
@@ -119,6 +121,40 @@ fn resolve_preview_returns_structured_apps_without_filesystem_scan() {
.any(|warning| warning.contains("Сканирование папок отложено")));
}
#[test]
#[cfg(windows)]
fn proxifyre_install_script_parses_as_powershell() {
let root = test_root("proxifyre-install-script");
fs::create_dir_all(&root).expect("test root should be created");
let script = commands::wrap_elevated_package_script(
&commands::install_proxifyre_script(&root.join("proxifyre-app-config.json")),
&root.join("install.log"),
);
let script_path = root.join("install.ps1");
let mut script_bytes = vec![0xEF, 0xBB, 0xBF];
script_bytes.extend_from_slice(script.as_bytes());
fs::write(&script_path, script_bytes).expect("script should be written");
let escaped_path = script_path.display().to_string().replace('\'', "''");
let parser = format!(
"$tokens = $null; $errors = $null; [System.Management.Automation.Language.Parser]::ParseFile('{escaped_path}', [ref]$tokens, [ref]$errors) | Out-Null; if ($errors.Count -gt 0) {{ $errors | ForEach-Object {{ $_.Message }}; exit 1 }}"
);
let output = ProcessCommand::new("powershell")
.args(["-NoProfile", "-NonInteractive", "-Command", &parser])
.output()
.expect("powershell parser should run");
assert!(
output.status.success(),
"install script should parse\nstdout:\n{}\nstderr:\n{}",
String::from_utf8_lossy(&output.stdout),
String::from_utf8_lossy(&output.stderr),
);
cleanup(&root);
}
#[test]
fn apply_generates_derived_config_and_records_activity_with_mock_helper() {
let root = test_root("apply");