From ff6acb9cfb57043a52a9d4f84bc21aab61f5b19c Mon Sep 17 00:00:00 2001 From: SamNet-dev Date: Wed, 4 Feb 2026 15:07:56 -0600 Subject: [PATCH] fix: Windows client config fails if backend not installed (#3) Add directory existence checks in New-PaqetConfig and New-GfkConfig before writing config files. Shows friendly error message instead of "Could not find a part of the path" exception. Reported-by: @SamDevApi --- windows/paqet-client.ps1 | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/windows/paqet-client.ps1 b/windows/paqet-client.ps1 index 000454c..a7bbfea 100644 --- a/windows/paqet-client.ps1 +++ b/windows/paqet-client.ps1 @@ -386,6 +386,12 @@ transport: key: "$SecretKey" "@ + # Ensure install directory exists + if (-not (Test-Path $InstallDir)) { + Write-Err "Paqet is not installed. Please install paqet first (option 1)." + return $false + } + [System.IO.File]::WriteAllText($ConfigFile, $config) Save-Settings -Backend "paqet" -ServerAddr $Server Write-Success "Configuration saved" @@ -558,6 +564,12 @@ quic_private_key = "key.pem" socks_port = $SocksPort "@ + # Ensure GFK directory exists + if (-not (Test-Path $GfkDir)) { + Write-Err "GFK is not installed. Please install GFK first (option 2)." + return $false + } + [System.IO.File]::WriteAllText("$GfkDir\parameters.py", $params) Save-Settings -Backend "gfk" -ServerAddr $ServerIP -SocksPort $SocksPort Write-Success "GFK configuration saved" @@ -922,9 +934,10 @@ function Show-Menu { $server = Read-Host " Server address (e.g., 1.2.3.4:8443)" $key = Read-Host " Encryption key (16+ chars)" if ($server -and $key) { - New-PaqetConfig -Server $server -SecretKey $key - Write-Host "" - Write-Host " Your SOCKS5 proxy: 127.0.0.1:1080" -ForegroundColor Green + if (New-PaqetConfig -Server $server -SecretKey $key) { + Write-Host "" + Write-Host " Your SOCKS5 proxy: 127.0.0.1:1080" -ForegroundColor Green + } } } else { Write-Host "" @@ -934,9 +947,10 @@ function Show-Menu { $server = Read-Host " Server IP (e.g., 1.2.3.4)" $auth = Read-Host " Auth code (from server setup)" if ($server -and $auth) { - New-GfkConfig -ServerIP $server -AuthCode $auth -SocksPort "14000" - Write-Host "" - Write-Host " Your SOCKS5 proxy: 127.0.0.1:14000" -ForegroundColor Green + if (New-GfkConfig -ServerIP $server -AuthCode $auth -SocksPort "14000") { + Write-Host "" + Write-Host " Your SOCKS5 proxy: 127.0.0.1:14000" -ForegroundColor Green + } } } }