From 2d924a98cb6eac20aa37afb3dbd59195c3de907e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=80=D0=B5=D0=B2?= Date: Wed, 20 May 2026 22:56:04 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20Windows=20download=20=E2=80=94=20TLS12?= =?UTF-8?q?=20+=20WebClient=20fallback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Invoke-WebRequest fails without TLS12 on some Windows. Use System.Net.WebClient with explicit TLS12 and User-Agent. Co-Authored-By: Claude Opus 4.6 --- full_install.ps1 | 19 ++++++++++++++++--- install_windows.txt | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/full_install.ps1 b/full_install.ps1 index 86c26be..ff7de55 100644 --- a/full_install.ps1 +++ b/full_install.ps1 @@ -74,6 +74,9 @@ New-Item -ItemType Directory -Path $localDir | Out-Null $scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path if (-not $scriptDir) { $scriptDir = Get-Location } +# Ensure TLS 1.2 for GitHub downloads +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + $filesToGet = @("ssh_manager.py", "gen_icon.py") foreach ($f in $filesToGet) { $localFile = Join-Path $scriptDir $f @@ -84,10 +87,20 @@ foreach ($f in $filesToGet) { } else { Write-Host "[*] Downloading $f from GitHub..." -ForegroundColor Yellow try { - Invoke-WebRequest -Uri "$REPO_RAW/$f" -OutFile $destFile -UseBasicParsing - Write-Host "[OK] $f (downloaded)" -ForegroundColor Green + $url = "$REPO_RAW/$f" + Write-Host " URL: $url" -ForegroundColor DarkGray + $wc = New-Object System.Net.WebClient + $wc.Headers.Add("User-Agent", "PCA-SSH-Installer") + $wc.DownloadFile($url, $destFile) + if (Test-Path $destFile) { + $sz = (Get-Item $destFile).Length + Write-Host "[OK] $f ($sz bytes)" -ForegroundColor Green + } else { + throw "File not saved" + } } catch { - Write-Host "[FAIL] Cannot download $f" -ForegroundColor Red + Write-Host "[FAIL] Cannot download $f : $_" -ForegroundColor Red + Write-Host "Try manual download: https://github.com/andrey271192/ssh-manage" -ForegroundColor Yellow Read-Host "Press Enter" exit 1 } diff --git a/install_windows.txt b/install_windows.txt index 784ce67..883f6e5 100644 --- a/install_windows.txt +++ b/install_windows.txt @@ -5,7 +5,7 @@ СПОСОБ 1 — Одна команда (рекомендуется) Скопируй и вставь в PowerShell: -irm https://raw.githubusercontent.com/andrey271192/ssh-manage/main/full_install.ps1 -OutFile $env:TEMP\pca_install.ps1; powershell -ExecutionPolicy Bypass -File $env:TEMP\pca_install.ps1 +[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $wc=New-Object Net.WebClient; $wc.Headers.Add('User-Agent','PCA'); $wc.DownloadFile('https://raw.githubusercontent.com/andrey271192/ssh-manage/main/full_install.ps1',"$env:TEMP\pca_install.ps1"); powershell -ExecutionPolicy Bypass -File $env:TEMP\pca_install.ps1 Что произойдёт: - Скачает установщик с GitHub