Refine ProxyWarden routing and config flows

This commit is contained in:
2026-07-10 21:15:17 +03:00
parent 9fd0a8c0b9
commit dbba3806cc
31 changed files with 1823 additions and 191 deletions
+13 -11
View File
@@ -47,10 +47,10 @@ noise
#[test]
fn safe_install_dir_allows_only_proxywarden_singbox_folder() {
assert!(
ensure_safe_singbox_install_dir(Path::new(r"C:\Program Files\ProxyWarden\sing-box"))
.is_ok()
);
assert!(ensure_safe_singbox_install_dir(Path::new(
r"C:\Program Files\ProxyWarden\components\sing-box"
))
.is_ok());
assert!(ensure_safe_singbox_install_dir(Path::new(r"C:\Windows")).is_err());
assert!(ensure_safe_singbox_install_dir(Path::new(r"C:\Program Files\sing-box")).is_err());
}
@@ -72,7 +72,7 @@ fn service_control_script_targets_named_service_and_action() {
#[test]
fn service_control_script_syncs_generated_config_before_start() {
let source = Path::new(r"C:\ProgramData\ProxyWarden\generated\sing-box-config.json");
let target = Path::new(r"C:\Program Files\ProxyWarden\sing-box\config.json");
let target = Path::new(r"C:\Program Files\ProxyWarden\components\sing-box\config.json");
let script = service_control_script(
SingBoxServiceAction::Start,
"ProxyWardenSingBox",
@@ -83,9 +83,9 @@ fn service_control_script_syncs_generated_config_before_start() {
assert!(script.contains(
"$configSource = 'C:\\ProgramData\\ProxyWarden\\generated\\sing-box-config.json'"
));
assert!(
script.contains("$configTarget = 'C:\\Program Files\\ProxyWarden\\sing-box\\config.json'")
);
assert!(script.contains(
"$configTarget = 'C:\\Program Files\\ProxyWarden\\components\\sing-box\\config.json'"
));
assert!(script.contains("Copy-Item -LiteralPath $configSource"));
assert!(script.contains("'config_sync_failed'"));
}
@@ -116,10 +116,12 @@ fn install_singbox_script_parses_as_powershell() {
fn detected_singbox(binary_exists: bool, wrapper_exists: bool, running: bool) -> DetectedSingBox {
DetectedSingBox {
install_dir: PathBuf::from(r"C:\Program Files\ProxyWarden\sing-box"),
executable_path: PathBuf::from(r"C:\Program Files\ProxyWarden\sing-box\sing-box.exe"),
install_dir: PathBuf::from(r"C:\Program Files\ProxyWarden\components\sing-box"),
executable_path: PathBuf::from(
r"C:\Program Files\ProxyWarden\components\sing-box\sing-box.exe",
),
wrapper_path: PathBuf::from(
r"C:\Program Files\ProxyWarden\sing-box\ProxyWardenSingBox.exe",
r"C:\Program Files\ProxyWarden\components\sing-box\ProxyWardenSingBox.exe",
),
binary_exists,
wrapper_exists,