From 2d1c082e3020c7eb07e37409923226a7845b1d95 Mon Sep 17 00:00:00 2001 From: AJ ONeal Date: Wed, 6 May 2026 23:23:02 -0600 Subject: [PATCH] feat(webi): probe zst as unpacker; properly probe formats in webi-pwsh webi/webi.sh: detect unzstd/zstd alongside the existing git/unxz/ unzip/tar probes. Sends `?formats=...,zst` when zstd is available so the server can pick a .tar.zst build only on hosts that can extract it. webi/webi-pwsh.ps1: replace the hardcoded `formats=zip,exe,tar,git` TODO with real Get-Command probing for git, zstd, and 7z. --- webi/webi-pwsh.ps1 | 7 +++++-- webi/webi.sh | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/webi/webi-pwsh.ps1 b/webi/webi-pwsh.ps1 index 752b178..49f9d3d 100755 --- a/webi/webi-pwsh.ps1 +++ b/webi/webi-pwsh.ps1 @@ -194,8 +194,11 @@ Write-Host "${TTask}Installing${TReset} ${TName}${exename}${TReset}" Write-Host " ${TDim}Fetching install script ...${TReset}" $PKG_URL = "$Env:WEBI_HOST/api/installers/$exename.ps1" -# TODO detect formats -$UrlParams = "formats=zip,exe,tar,git&libc=msvc" +$DetectedFormats = @("zip", "exe", "tar") +if (Get-Command git -ErrorAction SilentlyContinue) { $DetectedFormats += "git" } +if (Get-Command zstd -ErrorAction SilentlyContinue) { $DetectedFormats += "zst" } +if (Get-Command 7z -ErrorAction SilentlyContinue) { $DetectedFormats += "7z" } +$UrlParams = "formats=$($DetectedFormats -join ',')&libc=msvc" $PkgInstallPwsh = "$HOME\.local\tmp\$exename.install.ps1" Invoke-DownloadUrl -Force -URL $PKG_URL -Params $UrlParams -Path $PkgInstallPwsh diff --git a/webi/webi.sh b/webi/webi.sh index beaabc6..c077eae 100755 --- a/webi/webi.sh +++ b/webi/webi.sh @@ -40,6 +40,9 @@ __webi_main() { if [ -n "$(command -v git)" ]; then my_ext="git,$my_ext" fi + if [ -n "$(command -v unzstd)" ] || [ -n "$(command -v zstd)" ]; then + my_ext="zst,$my_ext" + fi if [ -n "$(command -v unxz)" ]; then my_ext="xz,$my_ext" fi