From 337ca91a6083d7a90965ca165558a98ff6c9918f Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Tue, 21 May 2024 11:11:11 +1000 Subject: [PATCH] Add Proxyman --- Evergreen/Apps/Get-Proxyman.ps1 | 37 ++++++++++++++++++++++ Evergreen/Manifests/Proxyman.json | 26 +++++++++++++++ Evergreen/Shared/Get-GitHubRepoRelease.ps1 | 1 + 3 files changed, 64 insertions(+) create mode 100644 Evergreen/Apps/Get-Proxyman.ps1 create mode 100644 Evergreen/Manifests/Proxyman.json diff --git a/Evergreen/Apps/Get-Proxyman.ps1 b/Evergreen/Apps/Get-Proxyman.ps1 new file mode 100644 index 00000000..fb8d830e --- /dev/null +++ b/Evergreen/Apps/Get-Proxyman.ps1 @@ -0,0 +1,37 @@ +function Get-Proxyman { + <# + .NOTES + Author: Aaron Parker + Twitter: @stealthpuppy + #> + [OutputType([System.Management.Automation.PSObject])] + [CmdletBinding(SupportsShouldProcess = $false)] + param ( + [Parameter(Mandatory = $false, Position = 0)] + [ValidateNotNull()] + [System.Management.Automation.PSObject] + $res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1]) + ) + + # Pass the repo releases API URL and return a formatted object + # Return the version only because the download is tagged as Linux + $params = @{ + Uri = $res.Get.Update.Uri + MatchVersion = $res.Get.Update.MatchVersion + Filter = $res.Get.Update.MatchFileTypes + ReturnVersionOnly = $true + } + $LatestVersion = Get-GitHubRepoRelease @params + + # Resolve the evergreen download URL + $Url = Resolve-SystemNetWebRequest -Uri $res.Get.Download.Uri + + # Return a formatted object to the pipeline + [PSCustomObject]@{ + Version = $LatestVersion.Version + Date = $Url.LastModified.ToShortDateString() + Size = $Url.ContentLength + Type = Get-FileType -File $Url.ResponseUri.AbsoluteUri + URI = $Url.ResponseUri.AbsoluteUri + } | Write-Output +} diff --git a/Evergreen/Manifests/Proxyman.json b/Evergreen/Manifests/Proxyman.json new file mode 100644 index 00000000..716fe72d --- /dev/null +++ b/Evergreen/Manifests/Proxyman.json @@ -0,0 +1,26 @@ +{ + "Name": "Proxyman", + "Source": "https://proxyman.io/", + "Get": { + "Update": { + "Uri": "https://api.github.com/repos/ProxymanApp/proxyman-windows-linux/releases/latest", + "MatchVersion": "(\\d+(\\.\\d+){1,4}).*", + "MatchFileTypes": "\\.exe$|\\.msi$" + }, + "Download": { + "Uri": "https://proxyman.io/release/windows/Proxyman_latest.dmg" + } + }, + "Install": { + "Setup": "", + "Preinstall": "", + "Physical": { + "Arguments": "/quiet /norestart", + "PostInstall": [] + }, + "Virtual": { + "Arguments": "/quiet /norestart", + "PostInstall": [] + } + } +} \ No newline at end of file diff --git a/Evergreen/Shared/Get-GitHubRepoRelease.ps1 b/Evergreen/Shared/Get-GitHubRepoRelease.ps1 index 56a73aa6..46505480 100644 --- a/Evergreen/Shared/Get-GitHubRepoRelease.ps1 +++ b/Evergreen/Shared/Get-GitHubRepoRelease.ps1 @@ -194,6 +194,7 @@ function Get-GitHubRepoRelease { Size = $asset.size URI = $asset.browser_download_url } + Write-Verbose -Message "$($MyInvocation.MyCommand): Matching platform 'Windows' against: $($PSObject.Platform)." if ($PSObject.Platform -eq "Windows") { Write-Output -InputObject $PSObject }