diff --git a/PowerShell/Microsoft.PowerShell_profile.ps1 b/PowerShell/Microsoft.PowerShell_profile.ps1 index ae0dd1a..e33c23b 100644 --- a/PowerShell/Microsoft.PowerShell_profile.ps1 +++ b/PowerShell/Microsoft.PowerShell_profile.ps1 @@ -1,50 +1,3 @@ -# Get internet settings -$settings = Get-ItemProperty -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings'; - -function SetProxy -{ - # Get proxy data from settings - $proxy_server = $settings.proxyServer; - - # Set proxy environment variables - $env:http_proxy = ($env:https_proxy = $proxy_server) - [System.Environment]::SetEnvironmentVariable('http_proxy', $proxy_server, 'User'); - [System.Environment]::SetEnvironmentVariable('https_proxy', $proxy_server, 'User'); - - # Set proxy git settings - git config --global http.proxy $proxy_server; - git config --global https.proxy $proxy_server; - - # Set proxy npm settings - npm config set proxy $proxy_server; - npm config set https-proxy $proxy_server; -} -Set-Alias -Name Proxy-Set -Value SetProxy; - -function UnsetProxy -{ - # Unset proxy environment variables - $env:http_proxy = ($env:https_proxy = '') - [System.Environment]::SetEnvironmentVariable('http_proxy', [NullString]::Value, 'User'); - [System.Environment]::SetEnvironmentVariable('https_proxy', [NullString]::Value, 'User'); - - # Unset proxy git settings - git config --global --unset http.proxy; - git config --global --unset https.proxy; - - # Delete proxy npm settings - npm config delete proxy; - npm config delete https-proxy; -} -Set-Alias -Name Proxy-Unset -Value UnsetProxy; - -if ($settings.proxyEnable -and (!$env:http_proxy)) -{ SetProxy; -} elseif ((!$settings.proxyEnable) -and $env:http_proxy) -{ UnsetProxy; -} - - # Function to toggle alacritty theme imports based on current theme function ToggleThemeLines { diff --git a/install_windows.ps1 b/install_windows.ps1 index a8019b8..364bcb5 100644 --- a/install_windows.ps1 +++ b/install_windows.ps1 @@ -155,6 +155,10 @@ ProcessUrlFiles -sourceDir "$dotfilesRepo\nvim" -destinationDir "$env:LOCALAPPDA Write-Host "Setting up PowerShell profile..." -ForegroundColor Cyan CopyFileWithPrompt "$dotfilesRepo\PowerShell\Microsoft.PowerShell_profile.ps1" $psProfile +# Setting up self-made ProxySwitcher +Write-Host "Setting up ProxySwitcher..." -ForegroundColor Cyan +Invoke-RestMethod 'https://raw.githubusercontent.com/Baipyrus/ProxySwitcher/main/install.ps1' | Invoke-Expression + function UnzipAndInstall { param (