feat: add arch detection (x32=sciter, x64=normal), update to 1.4.6

This commit is contained in:
Windneiro 2026-04-14 11:19:28 +05:00
parent 333b8d46a6
commit 3d3f0d35b8
1 changed files with 38 additions and 8 deletions

View File

@ -33,23 +33,53 @@ Write-Host "[2/5] Download and install RustDesk..." -ForegroundColor Yellow
New-Item -ItemType Directory -Path $temp -Force | Out-Null
# Opredelyaem razryadnost sistemy
$arch = (Get-WmiObject -Class Win32_OperatingSystem -ErrorAction SilentlyContinue).OSArchitecture
if ($arch -match "32") {
$isX86 = $true
Write-Host " Architecture: x86 (32-bit)" -ForegroundColor Gray
} else {
$isX86 = $false
Write-Host " Architecture: x64 (64-bit)" -ForegroundColor Gray
}
# Nahodim fayl RustDesk v repo cherez API
$repoApi = "$($repo -replace '/raw/branch/main', '')/api/v1/repos/helmut/auto-turning/contents/installers"
try {
$response = Invoke-WebRequest -Uri $repoApi -ErrorAction Stop
$files = ($response.Content | ConvertFrom-Json) | Where-Object { $_.type -eq "file" -and $_.name -match "rustdesk" }
if ($files.Count -eq 0) {
$allFiles = ($response.Content | ConvertFrom-Json) | Where-Object { $_.type -eq "file" }
# Vibiraem nuzhnyj fayl po arhitekture
if ($isX86) {
# Dlya 32-bit: sciter versiya
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86.*sciter" } | Select-Object -First 1).name
if (-not $rdFile) {
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86" } | Select-Object -First 1).name
}
} else {
# Dlya 64-bit: x86_64 versiya
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk.*x86_64" } | Select-Object -First 1).name
}
if (-not $rdFile) {
# Fallback: lyuboy rustdesk fayl
$rdFile = ($allFiles | Where-Object { $_.name -match "rustdesk" } | Select-Object -First 1).name
}
if (-not $rdFile) {
Write-Host " RustDesk installer NOT found in repo" -ForegroundColor Red
exit 1
}
$rdFile = $files[0].name
Write-Host " Found: $rdFile" -ForegroundColor Green
Write-Host " Selected: $rdFile" -ForegroundColor Green
} catch {
# Fallback: esli API nedostupen, ishem lokalno ili po imeni
$rdFile = "Rustdesk-1.4.4-x86_64.exe"
# Fallback: esli API nedostupen
if ($isX86) {
$rdFile = "rustdesk-1.4.6-x86-sciter.exe"
} else {
$rdFile = "rustdesk-1.4.6-x86_64.exe"
}
Write-Host " Using default: $rdFile" -ForegroundColor Yellow
}