Skip to content

Commit 06857f4

Browse files
committed
Merge branch 'system-proxy' of https://github.com/rivethorn/MasterHttpRelayVPN-RUST into system-proxy
2 parents 05f4300 + be72022 commit 06857f4

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

scripts/proxy_set_osx_sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ is_proxy_enabled() {
6363
# Loop through each network service
6464
echo "$SERVICES" | while read -r SERVICE; do
6565
# Check if HTTP proxy is enabled
66-
HTTP_PROXY_STATE=$(networksetup -getwebproxy "$SERVICE" | grep "Enabled:" | awk '{print $2}')
66+
HTTP_PROXY_STATE=$(networksetup -getwebproxy "$SERVICE" | grep "Enabled:" | awk '{print $2}' | grep -v 'Proxy')
6767
if [ "$HTTP_PROXY_STATE" == "Yes" ]; then
6868
echo "Proxy is currently enabled for network service '$SERVICE'"
6969
return 0

src/system_proxy.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@ pub fn check_system_proxy() -> std::io::Result<bool> {
2121
}
2222
#[cfg(target_os = "macos")]
2323
{
24-
run_script(MACOS_SCRIPT, &["check"])
25-
.map(|_| true)
26-
.or_else(|_| Ok(false))
24+
let res = run_script(MACOS_SCRIPT, &["check"]);
25+
match res {
26+
Ok(()) => Ok(true),
27+
Err(_) => Ok(false),
28+
}
2729
}
2830
}
2931

@@ -99,6 +101,7 @@ fn run_script(script_content: &str, args: &[&str]) -> std::io::Result<()> {
99101

100102
if !output.status.success() {
101103
eprintln!("Script error: {}", String::from_utf8_lossy(&output.stderr));
104+
let _ = fs::remove_file(script_path);
102105
return Err(Error::new(ErrorKind::Other, "Failed to run proxy script"));
103106
}
104107

0 commit comments

Comments
 (0)