From 1998cb050ddb5a867c8b17bc45ce8fe314b2fbed Mon Sep 17 00:00:00 2001 From: nullchinchilla Date: Wed, 26 Jun 2024 23:16:08 +0200 Subject: [PATCH 1/2] fix --- binaries/geph5-client-gui/geph5-client-gui | 0 .../geph5-client-gui/src/pac/geph5-client-gui | 0 binaries/geph5-client-gui/src/pac/macos.rs | 6 ++---- .../geph5-client-gui/src/pac/macos_set_proxy.sh | 15 ++++++++++----- .../geph5-client-gui/src/pac/macos_unset_proxy.sh | 9 ++++++--- 5 files changed, 18 insertions(+), 12 deletions(-) create mode 100644 binaries/geph5-client-gui/geph5-client-gui create mode 100644 binaries/geph5-client-gui/src/pac/geph5-client-gui diff --git a/binaries/geph5-client-gui/geph5-client-gui b/binaries/geph5-client-gui/geph5-client-gui new file mode 100644 index 0000000..e69de29 diff --git a/binaries/geph5-client-gui/src/pac/geph5-client-gui b/binaries/geph5-client-gui/src/pac/geph5-client-gui new file mode 100644 index 0000000..e69de29 diff --git a/binaries/geph5-client-gui/src/pac/macos.rs b/binaries/geph5-client-gui/src/pac/macos.rs index 342d95a..1bbf348 100644 --- a/binaries/geph5-client-gui/src/pac/macos.rs +++ b/binaries/geph5-client-gui/src/pac/macos.rs @@ -4,8 +4,7 @@ pub fn set_http_proxy(proxy: SocketAddr) -> anyhow::Result<()> { let shell_src = include_str!("macos_set_proxy.sh"); std::env::set_var("proxy_server", proxy.ip().to_string()); std::env::set_var("port", proxy.port().to_string()); - let output = runas::Command::new("bash") - .gui(true) + let output = std::process::Command::new("bash") .arg("-c") .arg(shell_src) .status()?; @@ -17,8 +16,7 @@ pub fn set_http_proxy(proxy: SocketAddr) -> anyhow::Result<()> { pub fn unset_http_proxy() -> anyhow::Result<()> { let shell_src = include_str!("macos_unset_proxy.sh"); - let output = runas::Command::new("bash") - .gui(true) + let output = std::process::Command::new("bash") .arg("-c") .arg(shell_src) .status()?; diff --git a/binaries/geph5-client-gui/src/pac/macos_set_proxy.sh b/binaries/geph5-client-gui/src/pac/macos_set_proxy.sh index bef7f25..d5cff66 100644 --- a/binaries/geph5-client-gui/src/pac/macos_set_proxy.sh +++ b/binaries/geph5-client-gui/src/pac/macos_set_proxy.sh @@ -1,13 +1,18 @@ #!/bin/bash +# AppleScript to request administrator privileges and run the script +osascript -e 'do shell script " # Get the list of network services network_services=$(networksetup -listallnetworkservices | tail -n +2) # Loop through each line using read while IFS= read -r service; do # Set HTTP and HTTPS proxies - networksetup -setwebproxy "$service" "$proxy_server" $port - networksetup -setwebproxystate "$service" on - networksetup -setsecurewebproxy "$service" "$proxy_server" $port - networksetup -setsecurewebproxystate "$service" on -done <<< "$network_services" \ No newline at end of file + networksetup -setwebproxy \"$service\" \"$proxy_server\" $port + networksetup -setwebproxystate \"$service\" on + networksetup -setsecurewebproxy \"$service\" \"$proxy_server\" $port + networksetup -setsecurewebproxystate \"$service\" on +done <<< \"$network_services\" +" with administrator privileges' + +# Note: You need to define the variables $proxy_server and $port before running the script diff --git a/binaries/geph5-client-gui/src/pac/macos_unset_proxy.sh b/binaries/geph5-client-gui/src/pac/macos_unset_proxy.sh index d7484d5..232543d 100644 --- a/binaries/geph5-client-gui/src/pac/macos_unset_proxy.sh +++ b/binaries/geph5-client-gui/src/pac/macos_unset_proxy.sh @@ -1,11 +1,14 @@ #!/bin/bash +# AppleScript to request administrator privileges and run the script +osascript -e 'do shell script " # Get the list of network services network_services=$(networksetup -listallnetworkservices | tail -n +2) # Loop through each line using read while IFS= read -r service; do # Disable HTTP and HTTPS proxies - networksetup -setwebproxystate "$service" off - networksetup -setsecurewebproxystate "$service" off -done <<< "$network_services" \ No newline at end of file + networksetup -setwebproxystate \"$service\" off + networksetup -setsecurewebproxystate \"$service\" off +done <<< \"$network_services\" +" with administrator privileges' From 54675d63501f058fc908203b8f1b17b029f7b33b Mon Sep 17 00:00:00 2001 From: nullchinchilla Date: Wed, 26 Jun 2024 23:16:29 +0200 Subject: [PATCH 2/2] fa --- binaries/geph5-client-gui/geph5-client-gui | 0 binaries/geph5-client-gui/src/pac/geph5-client-gui | 0 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100644 binaries/geph5-client-gui/geph5-client-gui delete mode 100644 binaries/geph5-client-gui/src/pac/geph5-client-gui diff --git a/binaries/geph5-client-gui/geph5-client-gui b/binaries/geph5-client-gui/geph5-client-gui deleted file mode 100644 index e69de29..0000000 diff --git a/binaries/geph5-client-gui/src/pac/geph5-client-gui b/binaries/geph5-client-gui/src/pac/geph5-client-gui deleted file mode 100644 index e69de29..0000000