()
| 618 | |
| 619 | // Function to disable system proxy (run as admin) |
| 620 | function disableSystemProxy() { |
| 621 | try { |
| 622 | // Check if the script file exists |
| 623 | if (!fs.existsSync(disableProxyScriptPath)) { |
| 624 | console.error(`Disable proxy script file not found at: ${disableProxyScriptPath}`); |
| 625 | |
| 626 | // Create the script file in the core directory if it doesn't exist |
| 627 | const corePath = getResourcePath('core'); |
| 628 | if (!fs.existsSync(corePath)) { |
| 629 | fs.mkdirSync(corePath, { recursive: true }); |
| 630 | } |
| 631 | |
| 632 | if (isWindows) { |
| 633 | const disableBatContent = `@echo off |
| 634 | REM Script to disable Windows system proxy |
| 635 | REM This script needs to be run as administrator |
| 636 | |
| 637 | REM Disable system proxy |
| 638 | reg add "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f |
| 639 | reg delete "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyServer /f 2>nul |
| 640 | reg delete "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings" /v ProxyOverride /f 2>nul |
| 641 | |
| 642 | REM Notify user |
| 643 | echo Windows system proxy has been disabled. |
| 644 | echo. |
| 645 | echo This window will close in 3 seconds... |
| 646 | timeout /t 3 > nul`; |
| 647 | |
| 648 | fs.writeFileSync(disableProxyScriptPath, disableBatContent); |
| 649 | console.log(`Created disable proxy BAT file at: ${disableProxyScriptPath}`); |
| 650 | } else if (isLinux) { |
| 651 | const disableShContent = `#!/bin/bash |
| 652 | # Script to disable system proxy on Linux |
| 653 | # This script may need to be run with sudo privileges depending on your desktop environment |
| 654 | |
| 655 | # Check if script is run as root |
| 656 | if [ "$EUID" -ne 0 ]; then |
| 657 | echo "This script may need to be run with sudo privileges depending on your desktop environment" |
| 658 | fi |
| 659 | |
| 660 | # Disable system proxy for GNOME |
| 661 | gsettings set org.gnome.system.proxy mode 'none' 2>/dev/null |
| 662 | gsettings reset org.gnome.system.proxy.http host 2>/dev/null |
| 663 | gsettings reset org.gnome.system.proxy.http port 2>/dev/null |
| 664 | gsettings reset org.gnome.system.proxy.https host 2>/dev/null |
| 665 | gsettings reset org.gnome.system.proxy.https port 2>/dev/null |
| 666 | |
| 667 | # Disable system proxy for KDE (if kwriteconfig5 is available) |
| 668 | if command -v kwriteconfig5 &> /dev/null; then |
| 669 | kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key ProxyType 0 2>/dev/null |
| 670 | kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key httpProxy --delete 2>/dev/null |
| 671 | kwriteconfig5 --file kioslaverc --group "Proxy Settings" --key httpsProxy --delete 2>/dev/null |
| 672 | fi |
| 673 | |
| 674 | # Also unset environment variables that might be set |
| 675 | unset http_proxy |
| 676 | unset https_proxy |
| 677 | unset ftp_proxy |
no test coverage detected