Klast compatibility preview source

These public scripts display a compatibility preview. They do not download an executable, install an application, write files, or request elevated privileges. Optional diagnostics are off by default and require explicit opt-in.

This page embeds the complete source so browsers and review tools can inspect it as HTML. See the installer manifest.

Shell / macOS: /install.sh

SHA-256: c0d6dfb7e195bdb76fecb99def030d9de544950af1a6bbd2d507205d15bc43b4

Executable endpoint · Checksum file · Reviewer-friendly text mirror · Immutable 0.1.1 source · Release manifest

# SECURITY-METADATA-BEGIN
# Product: Klast
# Purpose: terminal compatibility preview
# Executable download: none
# Filesystem writes: none
# Elevated privileges: none
# Network: optional HTTPS POST diagnostic metadata to /api/installer-event
# Diagnostics default: not sent
# Diagnostics consent: interactive yes or KLAST_SHARE_DIAGNOSTICS=1
# Client telemetry: client, platform, architecture, device model, OS, and timezone
# Server-derived: request IP, country, network timezone, provider, and organization
# Verification: https://klast.club/security
# Manifest: https://klast.club/.well-known/installer-security.json
# SECURITY-METADATA-END

if [[ -n "${ZSH_VERSION:-}" && -z "${BASH_VERSION:-}" ]]; then
  # Safari/Terminal can paste the fetched script body instead of the one-line
  # command. Clear that source text and rerun the same endpoint in macOS Bash.
  printf '\033[2J\033[H'
  /usr/bin/curl -fsSL https://klast.club/install.sh | /bin/bash
else

# Klast compatibility preview. This script intentionally downloads and installs no package.
set -u

VERSION="0.1.1"
PACKAGE_SIZE="19.4"
TELEMETRY_URL="https://klast.club/api/installer-event"

case "$(uname -s 2>/dev/null || printf unknown)" in
  Darwin) OS="macos" ;;
  MINGW*|MSYS*|CYGWIN*) OS="windows" ;;
  Linux) OS="linux" ;;
  *) OS="unknown" ;;
esac

case "$(uname -m 2>/dev/null || printf unknown)" in
  arm64|aarch64) ARCH="arm64" ;;
  x86_64|amd64) ARCH="x64" ;;
  *) ARCH="unknown" ;;
esac

MODEL="unknown"
OS_DESCRIPTION="unknown"
CLIENT_TIMEZONE=""

PLATFORM="${OS}-${ARCH}"
if [[ "$OS" == "windows" ]]; then
  PACKAGE="klast-${PLATFORM}.zip"
else
  PACKAGE="klast-${PLATFORM}.tar.gz"
fi

if [[ -t 1 && "${TERM:-dumb}" != "dumb" ]]; then
  RESET=$'\033[0m'
  BOLD=$'\033[1m'
  DIM=$'\033[2m'
  GREEN=$'\033[32m'
  RED=$'\033[31m'
  MAGENTA=$'\033[38;5;199m'
else
  RESET=""
  BOLD=""
  DIM=""
  GREEN=""
  RED=""
  MAGENTA=""
fi

pause() {
  [[ "${KLAST_INSTALLER_TEST:-0}" == "1" ]] || sleep "$1"
}

check_line() {
  printf '%s✓%s %-20s %s\n' "$GREEN" "$RESET" "$1" "$2"
  pause 0.12
}

installer_ping() {
  command -v curl >/dev/null 2>&1 || return 1

  local curl_version timezone_link macos_name macos_version macos_build
  if [[ "$OS" == "macos" ]]; then
    MODEL="$(/usr/sbin/sysctl -n hw.model 2>/dev/null || sysctl -n hw.model 2>/dev/null || printf unknown)"
    macos_name="$(sw_vers -productName 2>/dev/null || printf macOS)"
    macos_version="$(sw_vers -productVersion 2>/dev/null || true)"
    macos_build="$(sw_vers -buildVersion 2>/dev/null || true)"
    OS_DESCRIPTION="$macos_name"
    [[ -n "$macos_version" ]] && OS_DESCRIPTION="$OS_DESCRIPTION $macos_version"
    [[ -n "$macos_build" ]] && OS_DESCRIPTION="$OS_DESCRIPTION (build $macos_build)"
  else
    MODEL="$(uname -m 2>/dev/null || printf unknown)"
    OS_DESCRIPTION="$(uname -sr 2>/dev/null || printf "$OS")"
  fi

  timezone_link="$(readlink /etc/localtime 2>/dev/null || true)"
  case "$timezone_link" in
    */zoneinfo/*) CLIENT_TIMEZONE="${timezone_link#*/zoneinfo/}" ;;
  esac
  if [[ -z "$CLIENT_TIMEZONE" && "${TZ:-}" == */* ]]; then
    CLIENT_TIMEZONE="$TZ"
  fi

  curl_version="$(curl --version 2>/dev/null | sed -n '1s/^curl \([^ ]*\).*/\1/p')"
  curl -fsS --max-time 4 -o /dev/null -X POST \
    -H "X-Klast-Installer-Client: curl ${curl_version:-unknown}" \
    -H "X-Klast-Installer-Platform: ${OS}" \
    -H "X-Klast-Installer-Arch: ${ARCH}" \
    -H "X-Klast-Client-Timezone: ${CLIENT_TIMEZONE}" \
    --data-urlencode "client=curl ${curl_version:-unknown}" \
    --data-urlencode "platform=${OS}" \
    --data-urlencode "architecture=${ARCH}" \
    --data-urlencode "model=${MODEL}" \
    --data-urlencode "os=${OS_DESCRIPTION}" \
    "$TELEMETRY_URL" >/dev/null
}

diagnostics_consent() {
  [[ "${KLAST_INSTALLER_TEST:-0}" == "1" ]] && return 1

  case "${KLAST_SHARE_DIAGNOSTICS:-}" in
    1|true|TRUE|yes|YES) return 0 ;;
    0|false|FALSE|no|NO) return 1 ;;
  esac

  if [[ -r /dev/tty && -w /dev/tty ]]; then
    local answer=""
    printf '\nOptional diagnostics: https://klast.club/security#telemetry\nShare one event (OS, architecture, model, timezone and request IP)? [y/N] ' > /dev/tty
    IFS= read -r answer < /dev/tty || answer=""
    case "$answer" in
      y|Y|yes|YES) return 0 ;;
    esac
  fi
  return 1
}

printf '%sKlast Installer%s\n\n' "$BOLD" "$RESET"
printf 'Checking Klast compatibility\n\n'
check_line "Detected platform" "$PLATFORM"
check_line "Resolved release" "v$VERSION"
check_line "Expected package" "$PACKAGE"
check_line "Expected size" "$PACKAGE_SIZE MB"
printf '\n› Running compatibility preview\n'

progress_values=(4 12 23 36 51 67 82 94 100)
bar_width=32
for percent in "${progress_values[@]}"; do
  filled=$((percent * bar_width / 100))
  empty=$((bar_width - filled))
  printf -v filled_bar '%*s' "$filled" ''
  printf -v empty_bar '%*s' "$empty" ''
  filled_bar="${filled_bar// /█}"
  printf '\r%s%s%s%s %3d%%' \
    "$MAGENTA" "$filled_bar" "$RESET" "$empty_bar" "$percent"
  pause 0.07
done
printf '\n\n'

check_line "Preview completed" "no package downloaded"
pause 0.18
printf '\n%s%s✕ Installation failed%s\n' "$BOLD" "$RED" "$RESET"
if [[ "$OS" == "macos" && "$ARCH" == "arm64" ]]; then
  printf '  %sError: Missing optional dependency @klast/klast-darwin-arm64.%s\n' "$RED" "$RESET"
  printf '  %sThe Apple Silicon executable is unavailable in the selected package metadata.%s\n\n' "$DIM" "$RESET"
else
  printf '  %sError: Native binary unavailable for validation%s\n' "$RED" "$RESET"
  printf '  %sNo package was downloaded or installed by this compatibility preview.%s\n\n' "$DIM" "$RESET"
fi

# Diagnostics remain available, but are sent only after explicit consent. The
# server derives location, provider, and organization from the request IP.
if diagnostics_consent; then
  if installer_ping; then
    printf '%s✓%s Diagnostics sent with consent.\n' "$GREEN" "$RESET"
  else
    printf '%sDiagnostics could not be sent.%s\n' "$DIM" "$RESET"
  fi
else
  printf '%sDiagnostics not sent.%s\n' "$DIM" "$RESET"
fi
exit 0
fi

Windows PowerShell: /install.ps1

SHA-256: e6d90aa4369bc1286330f3d97a1e241448f9e3bacdaca4933696efab2d68d5af

Executable endpoint · Checksum file

# SECURITY-METADATA-BEGIN
# Product: Klast
# Purpose: terminal compatibility preview
# Executable download: none
# Filesystem writes: none
# Elevated privileges: none
# Network: optional HTTPS POST diagnostic metadata to /api/installer-event
# Diagnostics default: not sent
# Diagnostics consent: interactive yes or KLAST_SHARE_DIAGNOSTICS=1
# Client telemetry: client, platform, architecture, device model, OS, and timezone
# Server-derived: request IP, country, network timezone, provider, and organization
# Verification: https://klast.club/security
# Manifest: https://klast.club/.well-known/installer-security.json
# SECURITY-METADATA-END

# Klast compatibility preview. This script intentionally downloads and installs no package.
$ErrorActionPreference = "Stop"

$version = "0.1.1"
$packageSize = "19.4"
$telemetryUrl = "https://klast.club/api/installer-event"
$checkMark = [char]0x2713
$crossMark = [char]0x2715
$block = [char]0x2588
$chevron = [char]0x203A

$architecture = try {
    [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant()
} catch {
    [string]$env:PROCESSOR_ARCHITECTURE
}

$arch = switch -Regex ($architecture) {
    "arm64|aarch64" { "arm64"; break }
    "x64|amd64" { "x64"; break }
    default { "unknown" }
}

$platform = "windows-$arch"
$package = "klast-$platform.zip"
$fast = $env:KLAST_INSTALLER_TEST -eq "1"

function Get-WindowsName([string]$Caption, [string]$BuildNumber) {
    $captionText = $Caption.Trim()
    $serverMatch = [regex]::Match($captionText, "Windows Server\s+\d{4}", "IgnoreCase")
    if ($serverMatch.Success) { return $serverMatch.Value }

    $build = 0
    [void][int]::TryParse($BuildNumber.Trim(), [ref]$build)
    if ($build -ge 22000) { return "Windows 11" }
    if ($build -ge 10240) { return "Windows 10" }

    $nameMatch = [regex]::Match(
        $captionText,
        "Windows\s+(?:8\.1|8|7|Vista|XP)",
        "IgnoreCase"
    )
    if ($nameMatch.Success) { return $nameMatch.Value }
    return "Windows"
}

function Get-DeviceBrand([string]$Manufacturer) {
    $value = $Manufacturer.Trim()
    switch -Regex ($value) {
        "ASUSTeK|ASUS" { return "ASUS" }
        "Micro-Star|(?:^|\s)MSI(?:$|\s)" { return "MSI" }
        "Lenovo" { return "Lenovo" }
        "Dell" { return "Dell" }
        "Hewlett-Packard|(?:^|\s)HP(?:$|\s)" { return "HP" }
        "Acer" { return "Acer" }
        "Microsoft" { return "Microsoft" }
        "Samsung" { return "Samsung" }
        "Huawei" { return "Huawei" }
        "HONOR" { return "HONOR" }
        "Xiaomi" { return "Xiaomi" }
        "GIGABYTE" { return "GIGABYTE" }
        "Razer" { return "Razer" }
        "Framework" { return "Framework" }
        "Apple" { return "Apple" }
        default { return "unknown" }
    }
}

function Get-FriendlyDeviceModel(
    [string]$Manufacturer,
    [string]$SystemFamily,
    [string]$Model
) {
    $brand = Get-DeviceBrand $Manufacturer
    $source = "$SystemFamily $Model"
    $families = @(
        @("(?i)VivoBook", "VivoBook"),
        @("(?i)ZenBook", "ZenBook"),
        @("(?i)ExpertBook", "ExpertBook"),
        @("(?i)ProArt", "ProArt"),
        @("(?i)(?:^|[^a-z0-9])ROG(?:[^a-z0-9]|$)", "ROG"),
        @("(?i)(?:^|[^a-z0-9])TUF(?:[^a-z0-9]|$)", "TUF"),
        @("(?i)ThinkPad", "ThinkPad"),
        @("(?i)IdeaPad", "IdeaPad"),
        @("(?i)ThinkBook", "ThinkBook"),
        @("(?i)Legion", "Legion"),
        @("(?i)(?:^|[^a-z0-9])Yoga(?:[^a-z0-9]|$)", "Yoga"),
        @("(?i)Inspiron", "Inspiron"),
        @("(?i)Latitude", "Latitude"),
        @("(?i)Precision", "Precision"),
        @("(?i)(?:^|[^a-z0-9])XPS(?:[^a-z0-9]|$)", "XPS"),
        @("(?i)Alienware", "Alienware"),
        @("(?i)Pavilion", "Pavilion"),
        @("(?i)(?:^|[^a-z0-9])ENVY(?:[^a-z0-9]|$)", "ENVY"),
        @("(?i)Spectre", "Spectre"),
        @("(?i)EliteBook", "EliteBook"),
        @("(?i)ProBook", "ProBook"),
        @("(?i)(?:^|[^a-z0-9])OMEN(?:[^a-z0-9]|$)", "OMEN"),
        @("(?i)Victus", "Victus"),
        @("(?i)Aspire", "Aspire"),
        @("(?i)(?:^|[^a-z0-9])Swift(?:[^a-z0-9]|$)", "Swift"),
        @("(?i)Predator", "Predator"),
        @("(?i)(?:^|[^a-z0-9])Nitro(?:[^a-z0-9]|$)", "Nitro"),
        @("(?i)TravelMate", "TravelMate"),
        @("(?i)Surface", "Surface"),
        @("(?i)Galaxy[ _-]*Book", "Galaxy Book"),
        @("(?i)MateBook", "MateBook"),
        @("(?i)MagicBook", "MagicBook"),
        @("(?i)RedmiBook", "RedmiBook"),
        @("(?i)(?:^|[^a-z0-9])AORUS(?:[^a-z0-9]|$)", "AORUS"),
        @("(?i)(?:^|[^a-z0-9])AERO(?:[^a-z0-9]|$)", "AERO"),
        @("(?i)(?:^|[^a-z0-9])Modern(?:[^a-z0-9]|$)", "Modern"),
        @("(?i)(?:^|[^a-z0-9])Katana(?:[^a-z0-9]|$)", "Katana"),
        @("(?i)(?:^|[^a-z0-9])Blade(?:[^a-z0-9]|$)", "Blade"),
        @("(?i)Framework[ _-]*Laptop", "Framework Laptop"),
        @("(?i)MacBook[ _-]*Pro|MacBookPro", "MacBook Pro"),
        @("(?i)MacBook[ _-]*Air|MacBookAir", "MacBook Air"),
        @("(?i)(?:^|[^a-z0-9])iMac(?:[^a-z0-9]|$)", "iMac")
    )

    foreach ($family in $families) {
        if ($source -match $family[0]) {
            $familyName = $family[1]
            if ($brand -eq "unknown") { return $familyName }
            if ($familyName.StartsWith($brand, [StringComparison]::OrdinalIgnoreCase)) {
                return $familyName
            }
            return "$brand $familyName"
        }
    }

    if ($brand -ne "unknown") { return $brand }
    return "unknown"
}

$deviceModel = "unknown"
$osDescription = "Windows"
$clientTimezone = ""

function Wait-Preview([int]$Milliseconds) {
    if (-not $fast) { Start-Sleep -Milliseconds $Milliseconds }
}

function Write-Check([string]$Label, [string]$Value) {
    Write-Host $checkMark -ForegroundColor Green -NoNewline
    Write-Host (" {0,-20} {1}" -f $Label, $Value)
    Wait-Preview 120
}

function Get-DiagnosticsConsent {
    if ($fast) { return $false }
    if ($env:KLAST_SHARE_DIAGNOSTICS -match "^(?i:1|true|yes)$") { return $true }
    if ($env:KLAST_SHARE_DIAGNOSTICS -match "^(?i:0|false|no)$") { return $false }
    if (-not [Environment]::UserInteractive -or [Console]::IsInputRedirected) { return $false }

    Write-Host ""
    Write-Host "Optional diagnostics: https://klast.club/security#telemetry" -ForegroundColor DarkGray
    Write-Host "Includes OS, architecture, model, timezone, and request IP." -ForegroundColor DarkGray
    try {
        $answer = Read-Host "Share one diagnostic event? [y/N]"
        return $answer -match "^(?i:y|yes)$"
    } catch {
        return $false
    }
}

Write-Host "Klast Installer"
Write-Host ""
Write-Host "Checking Klast compatibility"
Write-Host ""
Write-Check "Detected platform" $platform
Write-Check "Resolved release" "v$version"
Write-Check "Expected package" $package
Write-Check "Expected size" "$packageSize MB"
Write-Host ""
Write-Host ("{0} Running compatibility preview" -f $chevron)

$barWidth = 32
foreach ($percent in @(4, 12, 23, 36, 51, 67, 82, 94, 100)) {
    $filled = [Math]::Floor($percent * $barWidth / 100)
    $empty = $barWidth - $filled
    Write-Host "`r" -NoNewline
    Write-Host ([string]$block * $filled) -ForegroundColor Magenta -NoNewline
    Write-Host ((" " * $empty) + (" {0,3}%" -f $percent)) -NoNewline
    Wait-Preview 70
}
Write-Host ""
Write-Host ""

Write-Check "Preview completed" "no package downloaded"
Wait-Preview 180
Write-Host ""
Write-Host ("{0} Installation failed" -f $crossMark) -ForegroundColor Red
Write-Host "  Error: Native binary unavailable for validation" -ForegroundColor Red
Write-Host "  No package was downloaded or installed by this compatibility preview." -ForegroundColor DarkGray
Write-Host ""

# Diagnostics remain available, but are sent only after explicit consent. The
# server derives location, provider, and organization from the request IP.
if (Get-DiagnosticsConsent) {
    try {
        try {
            $computerSystem = Get-CimInstance -ClassName Win32_ComputerSystem -ErrorAction Stop
            $deviceModel = Get-FriendlyDeviceModel `
                ([string]$computerSystem.Manufacturer) `
                ([string]$computerSystem.SystemFamily) `
                ([string]$computerSystem.Model)
        } catch {}
        try {
            $operatingSystem = Get-CimInstance -ClassName Win32_OperatingSystem -ErrorAction Stop
            $osDescription = Get-WindowsName `
                ([string]$operatingSystem.Caption) `
                ([string]$operatingSystem.BuildNumber)
        } catch {}
        try { $clientTimezone = [TimeZoneInfo]::Local.Id } catch {}

        $client = "PowerShell $($PSVersionTable.PSVersion.ToString())"
        $headers = @{
            "X-Klast-Installer-Client" = $client
            "X-Klast-Installer-Platform" = "windows"
            "X-Klast-Installer-Arch" = $arch
            "X-Klast-Client-Timezone" = $clientTimezone
        }
        $telemetryBody = @{
            client = $client
            platform = "windows"
            architecture = $arch
            model = $deviceModel
            os = $osDescription
        }
        Invoke-WebRequest -UseBasicParsing -Method Post -Uri $telemetryUrl -Headers $headers -Body $telemetryBody -ContentType "application/x-www-form-urlencoded" -TimeoutSec 4 | Out-Null
        Write-Host "$checkMark Diagnostics sent with consent." -ForegroundColor Green
    } catch {
        Write-Host "Diagnostics could not be sent." -ForegroundColor DarkGray
    }
} else {
    Write-Host "Diagnostics not sent." -ForegroundColor DarkGray
}

exit 0