From 3d3f0d35b80edb389ef8e39d35590052dae1aceb Mon Sep 17 00:00:00 2001 From: Windneiro Date: Tue, 14 Apr 2026 11:19:28 +0500 Subject: [PATCH] feat: add arch detection (x32=sciter, x64=normal), update to 1.4.6 --- rd_setup.ps1 | 46 ++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 8 deletions(-) diff --git a/rd_setup.ps1 b/rd_setup.ps1 index 706478b..bd9c5d9 100644 --- a/rd_setup.ps1 +++ b/rd_setup.ps1 @@ -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 }