# Ridge installer. Run from the website: irm https://ridgeos.pages.dev/install.ps1 | iex # Shows a small window, then: .NET 10 Desktop Runtime from Microsoft if missing (Windows asks for permission), # the newest signed Ridge from the update channel (signature + SHA-256 checked), Start menu, start with Windows, # "Apps" entry for uninstalling, optional Claude Code link, and starts Ridge. Per user, no admin needed for Ridge itself. # A PowerShell script is used instead of a setup.exe because Windows Smart App Control blocks unsigned .exe downloads. & { $ErrorActionPreference = 'Stop' $ProgressPreference = 'SilentlyContinue' [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Add-Type -AssemblyName System.Windows.Forms, System.Drawing $Channel = 'https://ridge-updates.pages.dev/latest.json' $Site = 'https://ridgeos.pages.dev' $RuntimeUrl = 'https://aka.ms/dotnet/10.0/windowsdesktop-runtime-win-x64.exe' # public half of the update signing key (the private half never leaves the build PC) $PubKey = 'MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEnV14bbLS7gND8t3oym7O4vYi+/lJm/bFMQxM1qUdYK3rK5UEyuuYTKeSXgr73H9TZVl1DXDElbQKvGPdmEdwSA==' $Dest = Join-Path $env:LOCALAPPDATA 'Ridge' $Tmp = Join-Path $env:TEMP ('ridge-setup-' + [guid]::NewGuid().ToString('N').Substring(0, 8)) # ---------------- window ---------------- [Windows.Forms.Application]::EnableVisualStyles() $ink = [Drawing.Color]::FromArgb(13, 14, 17); $panel = [Drawing.Color]::FromArgb(22, 24, 29); $fg = [Drawing.Color]::FromArgb(236, 238, 242); $dim = [Drawing.Color]::FromArgb(154, 160, 170) $font = New-Object Drawing.Font('Segoe UI', 10) $f = New-Object Windows.Forms.Form $f.Text = 'התקנת Ridge'; $f.ClientSize = New-Object Drawing.Size(560, 430); $f.StartPosition = 'CenterScreen' $f.FormBorderStyle = 'FixedSingle'; $f.MaximizeBox = $false; $f.BackColor = $ink; $f.ForeColor = $fg; $f.Font = $font $f.RightToLeft = 'Yes'; $f.RightToLeftLayout = $true; $f.TopMost = $true $logo = New-Object Windows.Forms.PictureBox; $logo.Size = New-Object Drawing.Size(64, 64); $logo.Location = New-Object Drawing.Point(28, 28); $logo.SizeMode = 'Zoom' try { $wc0 = New-Object Net.WebClient; $logo.Image = [Drawing.Image]::FromStream((New-Object IO.MemoryStream(, $wc0.DownloadData("$Site/ridge.png")))) } catch { } $f.Controls.Add($logo) $title = New-Object Windows.Forms.Label; $title.Text = 'Ridge'; $title.Font = New-Object Drawing.Font('Segoe UI Semibold', 22); $title.AutoSize = $true; $title.Location = New-Object Drawing.Point(104, 26); $f.Controls.Add($title) $sub = New-Object Windows.Forms.Label; $sub.Text = 'מסך הבית, ווידג''טים, מיקסר ועוד, בתוכנה אחת'; $sub.ForeColor = $dim; $sub.AutoSize = $true; $sub.Location = New-Object Drawing.Point(106, 70); $f.Controls.Add($sub) $box = New-Object Windows.Forms.Panel; $box.BackColor = $panel; $box.Location = New-Object Drawing.Point(28, 116); $box.Size = New-Object Drawing.Size(504, 196); $f.Controls.Add($box) function New-Check($text, $y, $on) { $c = New-Object Windows.Forms.CheckBox; $c.Text = $text; $c.Checked = $on; $c.AutoSize = $true; $c.Location = New-Object Drawing.Point(18, $y); $c.ForeColor = $fg; $box.Controls.Add($c); $c } $cAuto = New-Check 'להפעיל את Ridge כשהמחשב נדלק' 18 $true $cMenu = New-Check 'קיצור דרך בתפריט התחל' 50 $true $hasClaude = Test-Path (Join-Path $env:USERPROFILE '.claude') $cClaude = New-Check 'לחבר את Claude Code לפינה של Claude' 82 $hasClaude $cClaude.Enabled = $hasClaude $note = New-Object Windows.Forms.Label; $note.ForeColor = $dim; $note.Location = New-Object Drawing.Point(18, 122); $note.Size = New-Object Drawing.Size(468, 64) $note.Text = "יותקן אצלך בתיקייה %LOCALAPPDATA%\Ridge, בלי הרשאות מנהל.`nאם חסר .NET 10 של Microsoft, הוא יותקן קודם, ו-Windows יבקש אישור." $box.Controls.Add($note) $status = New-Object Windows.Forms.Label; $status.Location = New-Object Drawing.Point(28, 326); $status.Size = New-Object Drawing.Size(504, 22); $status.ForeColor = $dim; $f.Controls.Add($status) $bar = New-Object Windows.Forms.ProgressBar; $bar.Location = New-Object Drawing.Point(28, 352); $bar.Size = New-Object Drawing.Size(504, 6); $bar.Visible = $false; $f.Controls.Add($bar) $go = New-Object Windows.Forms.Button; $go.Text = 'התקנה'; $go.Size = New-Object Drawing.Size(120, 36); $go.Location = New-Object Drawing.Point(412, 378) $go.FlatStyle = 'Flat'; $go.BackColor = [Drawing.Color]::FromArgb(232, 232, 232); $go.ForeColor = [Drawing.Color]::FromArgb(17, 17, 17); $go.FlatAppearance.BorderSize = 0; $go.Font = New-Object Drawing.Font('Segoe UI Semibold', 10) $f.Controls.Add($go); $f.AcceptButton = $go $cancel = New-Object Windows.Forms.Button; $cancel.Text = 'ביטול'; $cancel.Size = New-Object Drawing.Size(100, 36); $cancel.Location = New-Object Drawing.Point(302, 378) $cancel.FlatStyle = 'Flat'; $cancel.BackColor = $panel; $cancel.ForeColor = $fg; $cancel.FlatAppearance.BorderSize = 0; $cancel.Add_Click({ $f.Close() }); $f.Controls.Add($cancel) function Say($t) { $status.Text = $t; [Windows.Forms.Application]::DoEvents() } # download in chunks so the progress bar moves and the window stays responsive function Get-File($url, $path) { $req = [Net.HttpWebRequest]::Create($url); $req.UserAgent = 'RidgeSetup' $resp = $req.GetResponse(); $total = $resp.ContentLength $in = $resp.GetResponseStream(); $out = [IO.File]::Create($path) try { $buf = New-Object byte[] 262144; $sum = 0; $bar.Style = 'Continuous' while (($n = $in.Read($buf, 0, $buf.Length)) -gt 0) { $out.Write($buf, 0, $n); $sum += $n if ($total -gt 0) { $bar.Value = [int][Math]::Min(100, 100 * $sum / $total) } [Windows.Forms.Application]::DoEvents() } } finally { $out.Close(); $in.Close(); $resp.Close() } } function Test-Runtime { $d = Join-Path $env:ProgramFiles 'dotnet\shared\Microsoft.WindowsDesktop.App' (Test-Path $d) -and [bool](Get-ChildItem $d -Directory | Where-Object { $_.Name -like '10.*' }) } function Test-Signature($latest) { $der = [Convert]::FromBase64String($PubKey) $xy = $der[($der.Length - 64)..($der.Length - 1)] $blob = [byte[]](0x45, 0x43, 0x53, 0x31, 0x20, 0, 0, 0) + [byte[]]$xy # BCRYPT_ECDSA_PUBLIC_P256_MAGIC + key length 32 $key = [Security.Cryptography.CngKey]::Import($blob, [Security.Cryptography.CngKeyBlobFormat]::EccPublicBlob) $ec = New-Object Security.Cryptography.ECDsaCng($key) $ec.HashAlgorithm = [Security.Cryptography.CngAlgorithm]::Sha256 $data = [Text.Encoding]::UTF8.GetBytes("$($latest.version)`n$($latest.file)`n$($latest.sha256.ToLower())") $ec.VerifyData($data, [Convert]::FromBase64String($latest.signature)) } $state = @{ done = $false } $go.Add_Click({ if ($state.done) { $f.Close(); return } $go.Enabled = $false; $cancel.Enabled = $false; $box.Enabled = $false; $bar.Visible = $true try { New-Item -ItemType Directory -Force $Tmp | Out-Null # 1. .NET 10 Desktop Runtime (Microsoft) if (-not (Test-Runtime)) { Say 'מוריד את .NET 10 Desktop Runtime מ-Microsoft (בערך 60MB)…' $rt = Join-Path $Tmp 'windowsdesktop-runtime-win-x64.exe' Get-File $RuntimeUrl $rt $sig = Get-AuthenticodeSignature $rt if ($sig.Status -ne 'Valid' -or $sig.SignerCertificate.Subject -notmatch 'O=Microsoft Corporation') { throw 'הקובץ של .NET לא חתום על ידי Microsoft, ההתקנה נעצרה.' } Say 'מתקין את .NET 10. אם Windows שואל, צריך לאשר.' $bar.Style = 'Marquee' $p = Start-Process $rt -ArgumentList '/install', '/quiet', '/norestart' -Verb RunAs -PassThru while (-not $p.HasExited) { [Windows.Forms.Application]::DoEvents(); Start-Sleep -Milliseconds 100 } if (-not (Test-Runtime)) { throw '.NET 10 לא הותקן (אולי האישור של Windows בוטל). אפשר לנסות שוב.' } } # 2. newest signed Ridge Say 'בודק את הגרסה האחרונה…' $latest = Invoke-RestMethod ($Channel + '?t=' + [DateTime]::UtcNow.Ticks) if (-not (Test-Signature $latest)) { throw 'החתימה של הגרסה לא תקינה, ההתקנה נעצרה.' } Say "מוריד את Ridge $($latest.version)…" $zip = Join-Path $Tmp $latest.file Get-File ([Uri]::new([Uri]$Channel, $latest.file).AbsoluteUri) $zip if ((Get-FileHash $zip -Algorithm SHA256).Hash.ToLower() -ne $latest.sha256.ToLower()) { throw 'הקובץ שהורד לא תואם לחתימה, ההתקנה נעצרה.' } # 3. files Say 'מתקין…' $bar.Style = 'Marquee' Get-Process RidgeApp, Ridge -ErrorAction SilentlyContinue | Stop-Process -Force Start-Sleep -Milliseconds 700 $ver = Join-Path $Dest "versions\$($latest.version)" if (Test-Path $ver) { Remove-Item $ver -Recurse -Force } New-Item -ItemType Directory -Force $ver | Out-Null Add-Type -AssemblyName System.IO.Compression.FileSystem [IO.Compression.ZipFile]::ExtractToDirectory($zip, $ver) Copy-Item (Join-Path $ver 'launcher\*') $Dest -Recurse -Force Copy-Item (Join-Path $ver 'setup\uninstall.ps1') $Dest -Force Set-Content (Join-Path $Dest 'versions\current.txt') $latest.version -Encoding ascii Remove-Item (Join-Path $Dest 'versions\next.txt') -ErrorAction SilentlyContinue Get-ChildItem (Join-Path $Dest 'versions') -Directory | Where-Object { $_.Name -ne $latest.version } | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue $exe = Join-Path $Dest 'Ridge.exe' $ico = Join-Path $ver 'ridge.ico' # 4. Start menu, start with Windows, Apps & features entry $lnk = Join-Path ([Environment]::GetFolderPath('Programs')) 'Ridge.lnk' if ($cMenu.Checked) { $s = (New-Object -ComObject WScript.Shell).CreateShortcut($lnk) $s.TargetPath = $exe; $s.WorkingDirectory = $Dest; $s.IconLocation = $ico; $s.Description = 'Ridge'; $s.Save() } elseif (Test-Path $lnk) { Remove-Item $lnk } $run = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Run' if ($cAuto.Checked) { Set-ItemProperty $run -Name 'Ridge' -Value "`"$exe`"" } else { Remove-ItemProperty $run -Name 'Ridge' -ErrorAction SilentlyContinue } $un = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Ridge' New-Item $un -Force | Out-Null $size = [int]((Get-ChildItem $Dest -Recurse -File -Exclude *.log | Where-Object { $_.FullName -notlike '*\webview\*' } | Measure-Object Length -Sum).Sum / 1KB) $vals = @{ DisplayName = 'Ridge'; DisplayVersion = $latest.version; Publisher = 'Ridge'; DisplayIcon = $ico; InstallLocation = $Dest; URLInfoAbout = $Site UninstallString = "powershell.exe -NoProfile -ExecutionPolicy Bypass -File `"$Dest\uninstall.ps1`""; NoModify = 1; NoRepair = 1; EstimatedSize = $size } foreach ($k in $vals.Keys) { Set-ItemProperty $un -Name $k -Value $vals[$k] } # 5. Claude Code corner if ($cClaude.Checked) { Say 'מחבר את Claude Code…' & powershell.exe -NoProfile -ExecutionPolicy Bypass -File (Join-Path $ver 'setup\Set-ClaudeHooks.ps1') -NoPause | Out-Null } # 6. start Say 'מפעיל את Ridge…' Start-Process $exe -WorkingDirectory $Dest $bar.Style = 'Continuous'; $bar.Value = 100 Say "Ridge $($latest.version) מותקן ופועל. האייקון שלו נמצא ליד השעון, לחיצה כפולה פותחת את ההגדרות." $go.Text = 'סיום'; $go.Enabled = $true $state.done = $true } catch { $bar.Visible = $false $status.ForeColor = [Drawing.Color]::FromArgb(255, 179, 179) Say ('ההתקנה נעצרה: ' + $_.Exception.Message) $cancel.Text = 'סגירה'; $cancel.Enabled = $true; $go.Text = 'נסה שוב'; $go.Enabled = $true; $box.Enabled = $true } finally { Remove-Item $Tmp -Recurse -Force -ErrorAction SilentlyContinue } }) $f.Add_Shown({ $f.Activate(); $f.TopMost = $false }) [void]$f.ShowDialog() }