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
This commit is contained in:
@@ -386,6 +386,12 @@ transport:
|
|||||||
key: "$SecretKey"
|
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)
|
[System.IO.File]::WriteAllText($ConfigFile, $config)
|
||||||
Save-Settings -Backend "paqet" -ServerAddr $Server
|
Save-Settings -Backend "paqet" -ServerAddr $Server
|
||||||
Write-Success "Configuration saved"
|
Write-Success "Configuration saved"
|
||||||
@@ -558,6 +564,12 @@ quic_private_key = "key.pem"
|
|||||||
socks_port = $SocksPort
|
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)
|
[System.IO.File]::WriteAllText("$GfkDir\parameters.py", $params)
|
||||||
Save-Settings -Backend "gfk" -ServerAddr $ServerIP -SocksPort $SocksPort
|
Save-Settings -Backend "gfk" -ServerAddr $ServerIP -SocksPort $SocksPort
|
||||||
Write-Success "GFK configuration saved"
|
Write-Success "GFK configuration saved"
|
||||||
@@ -922,9 +934,10 @@ function Show-Menu {
|
|||||||
$server = Read-Host " Server address (e.g., 1.2.3.4:8443)"
|
$server = Read-Host " Server address (e.g., 1.2.3.4:8443)"
|
||||||
$key = Read-Host " Encryption key (16+ chars)"
|
$key = Read-Host " Encryption key (16+ chars)"
|
||||||
if ($server -and $key) {
|
if ($server -and $key) {
|
||||||
New-PaqetConfig -Server $server -SecretKey $key
|
if (New-PaqetConfig -Server $server -SecretKey $key) {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " Your SOCKS5 proxy: 127.0.0.1:1080" -ForegroundColor Green
|
Write-Host " Your SOCKS5 proxy: 127.0.0.1:1080" -ForegroundColor Green
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
@@ -934,9 +947,10 @@ function Show-Menu {
|
|||||||
$server = Read-Host " Server IP (e.g., 1.2.3.4)"
|
$server = Read-Host " Server IP (e.g., 1.2.3.4)"
|
||||||
$auth = Read-Host " Auth code (from server setup)"
|
$auth = Read-Host " Auth code (from server setup)"
|
||||||
if ($server -and $auth) {
|
if ($server -and $auth) {
|
||||||
New-GfkConfig -ServerIP $server -AuthCode $auth -SocksPort "14000"
|
if (New-GfkConfig -ServerIP $server -AuthCode $auth -SocksPort "14000") {
|
||||||
Write-Host ""
|
Write-Host ""
|
||||||
Write-Host " Your SOCKS5 proxy: 127.0.0.1:14000" -ForegroundColor Green
|
Write-Host " Your SOCKS5 proxy: 127.0.0.1:14000" -ForegroundColor Green
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user