# web-install.ps1 — Warph Terminal Standalone Web Installer # Usage: # irm | iex # irm | iex -ArgumentList "-Install", "-Mode", "3" #Requires -Version 7 [CmdletBinding()] param( [string]$Branch = 'main', [switch]$Install, [ValidateSet('1', '2', '3')] [string]$Mode = '3', [switch]$SkipOptional, [switch]$NoTUI, [switch]$TUI, [switch]$Quiet ) if ($env:WARPH_BRANCH) { $Branch = $env:WARPH_BRANCH } $grn = $PSStyle.Foreground.BrightGreen $ylw = $PSStyle.Foreground.BrightYellow $cyn = $PSStyle.Foreground.BrightCyan $red = $PSStyle.Foreground.BrightRed $wht = $PSStyle.Foreground.White $dim = $PSStyle.Foreground.BrightBlack $bold = $PSStyle.Bold $rst = $PSStyle.Reset $w0 = $PSStyle.Foreground.FromRgb(255, 255, 255) if ($env:NO_COLOR) { $grn = $ylw = $cyn = $red = $wht = $dim = $bold = $rst = $w0 = "" } # 1. PowerShell 7+ verification if ($PSVersionTable.PSVersion.Major -lt 7) { Write-Host "" Write-Host "${red}${bold}[ERROR] Warph Terminal requires PowerShell 7 or higher.${rst}" Write-Host "You are currently running PowerShell $($PSVersionTable.PSVersion)." Write-Host "" if (Get-Command winget -ErrorAction SilentlyContinue) { $doInstallPwsh = Read-Host " Install PowerShell 7 now via winget? [Y/n]" if ($doInstallPwsh -notmatch '^[nN]$') { winget install --id Microsoft.PowerShell -e --source winget --accept-package-agreements --accept-source-agreements Write-Host "${grn}Please relaunch this script inside PowerShell 7 (pwsh.exe).${rst}" return } } else { Write-Host "Install PowerShell 7 via winget:" Write-Host " ${cyn}winget install Microsoft.PowerShell${rst}" } Write-Host "" return } # 2. Windows Terminal verification (REQUIRED) $hasWT = (Get-Command wt -ErrorAction SilentlyContinue) -or (Get-AppxPackage Microsoft.WindowsTerminal* -ErrorAction SilentlyContinue) if (-not $hasWT) { Write-Host "" Write-Host "${ylw}${bold}[!] Windows Terminal is REQUIRED for Warph Terminal.${rst}" Write-Host " (Legacy console host cannot render glyphs, true-color ANSI or SVG icons)" if (Get-Command winget -ErrorAction SilentlyContinue) { $doInstallWT = Read-Host " Install Windows Terminal now via winget? [Y/n]" if ($doInstallWT -notmatch '^[nN]$') { winget install --id Microsoft.WindowsTerminal -e --source winget --accept-package-agreements --accept-source-agreements } } } [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 $version = $null if (-not $Branch -or $Branch -eq 'main') { try { $latestRel = Invoke-RestMethod -Uri "https://api.github.com/repos/Wpnnt/warph-terminal/releases/latest" -Headers @{'User-Agent'='Warph-Terminal-Web-Installer'} -TimeoutSec 3 -ErrorAction SilentlyContinue if ($latestRel -and $latestRel.tag_name) { $version = $latestRel.tag_name } } catch { } } function Get-TerminalWidth { try { $w = $Host.UI.RawUI.WindowSize.Width if ($w -and $w -ge 40) { return $w } } catch { } return 120 } function Show-WarphBanner { $w = Get-TerminalWidth $logoPad = " " * [Math]::Max(0, [int](($w - 72) / 2)) $bannerFile = if ($PSScriptRoot) { Join-Path $PSScriptRoot "..\assets\banner.ansi" } else { $null } $bannerText = $null if ($bannerFile -and (Test-Path -LiteralPath $bannerFile)) { $bannerText = Get-Content -LiteralPath $bannerFile -Raw } else { # Embedded fallback for standalone remote execution (irm da.gd/warph | iex) $b64 = "H4sIAAAAAAAACuVc25HsuA39v1U3gvm5IYhN6lXzsYFMAvvhzsFROEBH4lIDoADwgJJ6Hp6xVzhbO1q2JJB4E9LL21+38R8vb8P9T/jPy9t8f3nLy+vtddiO+7//9U/+O23H9nel7VJ68Gvx48Kfqmv4m23XrA+Bbtr+oMfPcP/964hV+8hdpo45eoIuTELIbsDpMZeP0+3SfTZd5RHx922Zeye7La/op9+RzfOMe649zz+X4+vcW97/Nzi/OgtmDn4uq57tlrufuLwvb/RAC9F9PzUNROrUnIj0qUykPOgtMz0GjCuRGpBXJhowEqkBZRXa/lqY9IBJ6PHw26MT9F1GJhpTJoF+1MdBA26DwEcDNCBnIsU8XMZDldgl5qcIjLA7EakZKDORnj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x8Cw4RP4Clzhc6vwNfp7k4+qhqxMzHdMVcKWWdZedPnyXN15lv4j7B7cmnl8H+UY4/gPuyffr379+//gMtEme0A1gAAA==" try { $gzBytes = [Convert]::FromBase64String($b64) $msIn = [System.IO.MemoryStream]::new($gzBytes) $gzDec = [System.IO.Compression.GZipStream]::new($msIn, [System.IO.Compression.CompressionMode]::Decompress) $sr = [System.IO.StreamReader]::new($gzDec, [System.Text.Encoding]::UTF8) $bannerText = $sr.ReadToEnd() } catch { } } if ($bannerText) { Write-Host "" $lines = $bannerText -split "\r?\n" foreach ($l in $lines) { if ($l.Trim().Length -gt 0) { Write-Host "$logoPad$l" } else { Write-Host "" } } } Write-Host "" $vBadge = if ($Branch -and $Branch -ne 'main') { " ${cyn}[$Branch]${rst}" } elseif ($version) { " ${dim}$version${rst}" } else { "" } Write-Host " ${w0}${bold}WARPH TERMINAL${rst}$vBadge" Write-Host " ${dim}modular · fast · powershell${rst}" Write-Host "" } # When executed inside a local repository clone, delegate directly to local setup.ps1 $localSetup = if ($PSScriptRoot) { Join-Path $PSScriptRoot "..\setup.ps1" } else { $null } if ($localSetup -and (Test-Path -LiteralPath $localSetup)) { if ($Install) { & (Resolve-Path $localSetup).Path -Install -Mode:$Mode -SkipOptional:$SkipOptional -Quiet:$Quiet -NoTUI:$NoTUI -TUI:$TUI } else { & (Resolve-Path $localSetup).Path -NoTUI:$NoTUI -TUI:$TUI } return } if (-not $Quiet) { Show-WarphBanner } $tempZip = Join-Path ([System.IO.Path]::GetTempPath()) "warph-terminal-latest-$([System.Guid]::NewGuid().ToString('N').Substring(0,8)).zip" $tempExtract = Join-Path ([System.IO.Path]::GetTempPath()) "warph-setup-$([System.Guid]::NewGuid().ToString('N').Substring(0,8))" $zipUrl = if ($Branch -and $Branch -ne 'main') { "https://github.com/Wpnnt/warph-terminal/archive/refs/heads/$Branch.zip" } elseif ($version) { "https://github.com/Wpnnt/warph-terminal/releases/download/$version/warph-terminal.zip" } else { "https://github.com/Wpnnt/warph-terminal/archive/refs/heads/main.zip" } try { $relText = if ($Branch -and $Branch -ne 'main') { "$Branch (preview)" } elseif ($version) { $version } else { "package" } Write-Host " ${dim}downloading $relText...${rst} " -NoNewline try { Invoke-WebRequest -Uri $zipUrl -OutFile $tempZip -UseBasicParsing } catch { if ($Branch -and $Branch -ne 'main') { throw "Failed to download branch archive: $_" } $zipUrl = "https://github.com/Wpnnt/warph-terminal/archive/refs/heads/main.zip" Invoke-WebRequest -Uri $zipUrl -OutFile $tempZip -UseBasicParsing } Write-Host "${dim}done${rst}" Write-Host " ${dim}extracting assets...${rst} " -NoNewline Expand-Archive -LiteralPath $tempZip -DestinationPath $tempExtract -Force Write-Host "${dim}done${rst}" Write-Host "" # Locate setup.ps1 and execute $setupScript = Get-ChildItem -Path $tempExtract -Recurse -Filter "setup.ps1" | Where-Object { $_.Directory.Name -eq (Split-Path $_.DirectoryName -Leaf) -or $_.Directory.Name -match "warph-terminal" } | Select-Object -First 1 if (-not $setupScript) { $setupScript = Get-ChildItem -Path $tempExtract -Recurse -Filter "setup.ps1" | Select-Object -First 1 } if (-not $setupScript -or -not (Test-Path -LiteralPath $setupScript.FullName)) { throw "Could not locate setup.ps1 inside extracted archive." } if ($Install) { $env:WARPH_NO_BANNER = "1" & $setupScript.FullName -Install -Mode:$Mode -SkipOptional:$SkipOptional -Quiet:$Quiet -NoTUI:$NoTUI -TUI:$TUI } else { & $setupScript.FullName -NoTUI:$NoTUI -TUI:$TUI } } catch { Write-Host "" Write-Host " ${red}${bold}[error]${rst} Installation failed: $_" } finally { Remove-Item env:WARPH_NO_BANNER -ErrorAction SilentlyContinue if (Test-Path -LiteralPath $tempZip) { Remove-Item -LiteralPath $tempZip -Force -ErrorAction SilentlyContinue } if (Test-Path -LiteralPath $tempExtract) { Remove-Item -LiteralPath $tempExtract -Recurse -Force -ErrorAction SilentlyContinue } }