<# ================================================================================ Kay's Toolbox — Automated Windows App Installer Hub & Dashboard One-Liner Bootstrap Installer ================================================================================ #> $ErrorActionPreference = "Stop" # 1. Enable Modern TLS protocols [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 function Write-StyledBanner { Write-Host '' Write-Host ' _ __ `_ _____ _ _ ' -ForegroundColor Cyan Write-Host ' | |/ / (_) |_ _| | | | ' -ForegroundColor Cyan Write-Host ' | '' / __ _ _ _ _ | | ___ ___ | | |__ _____ __' -ForegroundColor Cyan Write-Host ' | < / _` | | | || | | |/ _ \ / _ \| | ''_ \ / _ \ \/ /' -ForegroundColor Cyan Write-Host ' | . \ (_| | |_| || | | | (_) | (_) | | |_) | (_) > < ' -ForegroundColor Cyan Write-Host ' |_|\_\__,_|\__, || | \_/\___/ \___/|_|_.__/ \___/_/\_\' -ForegroundColor Cyan Write-Host ' __/ |/ | ' -ForegroundColor Cyan Write-Host ' |___/__/ ' -ForegroundColor Cyan Write-Host ' ========================================================' -ForegroundColor DarkGray Write-Host ' ⚡ Kay''s Toolbox — Windows Universal App Installer Hub' -ForegroundColor White Write-Host ' ========================================================' -ForegroundColor DarkGray Write-Host '' } Write-StyledBanner # Configuration $TargetDir = Join-Path $env:USERPROFILE ".kays-toolbox" $TempZip = Join-Path $env:TEMP "kays-toolbox-installer.zip" $TempExtract = Join-Path $env:TEMP "kays-toolbox-temp" $WorkerUrl = "https://kays-toolbox.gvtechhub.workers.dev" $ZipDownloadUrl = "$WorkerUrl/zip" Write-Host "==> [1/4] Preparing setup environment..." -ForegroundColor Yellow if (!(Test-Path $TargetDir)) { New-Item -ItemType Directory -Path $TargetDir -Force | Out-Null } Write-Host "==> [2/4] Downloading latest Kay's Toolbox package..." -ForegroundColor Yellow try { Invoke-WebRequest -Uri $ZipDownloadUrl -OutFile $TempZip -UseBasicParsing Write-Host " [OK] Download completed." -ForegroundColor Green } catch { Write-Host " [!] Worker download failed, attempting direct GitHub archive..." -ForegroundColor DarkYellow $FallbackUrl = "https://github.com/itsKayWat/kays-toolbox/archive/refs/heads/main.zip" Invoke-WebRequest -Uri $FallbackUrl -OutFile $TempZip -UseBasicParsing Write-Host " [OK] Downloaded from GitHub." -ForegroundColor Green } Write-Host "==> [3/4] Extracting toolbox files..." -ForegroundColor Yellow if (Test-Path $TempExtract) { Remove-Item -Path $TempExtract -Recurse -Force -ErrorAction SilentlyContinue } Expand-Archive -Path $TempZip -DestinationPath $TempExtract -Force # Locate extracted inner directory $InnerDir = Get-ChildItem -Path $TempExtract | Where-Object { $_.PSIsContainer } | Select-Object -First 1 if ($InnerDir) { Copy-Item -Path "$($InnerDir.FullName)\*" -Destination $TargetDir -Recurse -Force } else { Copy-Item -Path "$TempExtract\*" -Destination $TargetDir -Recurse -Force } # Clean temp files Remove-Item -Path $TempZip -Force -ErrorAction SilentlyContinue Remove-Item -Path $TempExtract -Recurse -Force -ErrorAction SilentlyContinue Write-Host " [OK] Extracted to: $TargetDir" -ForegroundColor Green Write-Host "==> [4/4] Installing Kay's Toolbox executable and shortcuts..." -ForegroundColor Yellow $InstallProgramScript = Join-Path $TargetDir "scripts\install-program.ps1" if (Test-Path $InstallProgramScript) { & powershell.exe -ExecutionPolicy Bypass -NoProfile -File $InstallProgramScript } else { $RegisterScript = Join-Path $TargetDir "scripts\register-cli.ps1" if (Test-Path $RegisterScript) { & powershell.exe -ExecutionPolicy Bypass -NoProfile -File $RegisterScript } } Write-Host "" Write-Host "========================================================" -ForegroundColor Cyan Write-Host " ✨ Kay's Toolbox installed successfully!" -ForegroundColor Green Write-Host " 🚀 Launching Kay's Toolbox Application..." -ForegroundColor Cyan Write-Host "========================================================" -ForegroundColor Cyan Write-Host "" $ExePath = Join-Path $env:LOCALAPPDATA "Programs\KaysToolbox\KaysToolbox.exe" if (Test-Path $ExePath) { Start-Process -FilePath $ExePath } else { Start-Process -FilePath "powershell.exe" -ArgumentList "-ExecutionPolicy", "Bypass", "-File", (Join-Path $TargetDir "server.ps1") }