Skip to content

Commit

Permalink
Merge pull request #652 from aaronparker/apps
Browse files Browse the repository at this point in the history
Apps
  • Loading branch information
aaronparker authored Apr 9, 2024
2 parents 052eece + 08042c3 commit 18540a0
Show file tree
Hide file tree
Showing 41 changed files with 725 additions and 248 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"adotcoop",
"Airtame",
"Akeo",
"ALLUSER",
"Anki",
"architecturekey",
"Artifex",
Expand Down
37 changes: 23 additions & 14 deletions Evergreen/Apps/Get-1Password.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-1Password {
function Get-1Password {
<#
.SYNOPSIS
Get the current version and download URL for 1Password 8 and later.
Expand All @@ -11,7 +11,7 @@ Function Get-1Password {
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $False)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
Expand All @@ -23,23 +23,32 @@ Function Get-1Password {
ContentType = $res.Get.Update.ContentType
}
$updateFeed = Invoke-EvergreenRestMethod @params
if ($Null -ne $updateFeed) {
if ($updateFeed.available -eq 1) {
if ($updateFeed.available -eq 1) {

# Output the object to the pipeline
foreach ($item in $updateFeed) {
$PSObject = [PSCustomObject] @{
Version = $item.version
URI = $($item.sources | Select-Object -Index (Get-Random -Minimum 0 -Maximum 2)).url
}
Write-Output -InputObject $PSObject
# Output the object to the pipeline from the update feed
foreach ($item in $updateFeed) {

# Pick a URL from the list of returns URLs
# $Url = $($item.sources | Select-Object -Index (Get-Random -Minimum 0 -Maximum 2)).url
$Url = $item.sources | Where-Object { $_.name -eq $res.Get.Update.CDN } | Select-Object -ExpandProperty "url"

$PSObject = [PSCustomObject] @{
Version = $item.version
Type = Get-FileType -File $Url
URI = $Url
}
Write-Output -InputObject $PSObject
}
else {
Write-Warning -Message "$($MyInvocation.MyCommand): failed to find an available from: $($res.Get.Update.Uri)."

# Output the MSI version of the 1Password installer
$PSObject = [PSCustomObject] @{
Version = $item.version
Type = Get-FileType -File $res.Get.Download.Uri
URI = $res.Get.Download.Uri
}
Write-Output -InputObject $PSObject
}
else {
Write-Error -Message "$($MyInvocation.MyCommand): unable to retrieve content from $($res.Get.Update.Uri)."
Write-Warning -Message "$($MyInvocation.MyCommand): failed to find an available from: $($res.Get.Update.Uri)."
}
}
38 changes: 38 additions & 0 deletions Evergreen/Apps/Get-1PasswordCLI.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
function Get-1PasswordCLI {
<#
.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])
)

# Get latest version and download latest release via update API
$params = @{
Uri = $res.Get.Update.Uri
ContentType = $res.Get.Update.ContentType
}
$updateFeed = Invoke-EvergreenRestMethod @params
if ($updateFeed.available -eq 1) {

# Output the object to the pipeline
foreach ($Architecture in $res.Get.Download.Uri.GetEnumerator()) {
$PSObject = [PSCustomObject] @{
Version = $updateFeed.version
Architecture = $Architecture.Name
Type = Get-FileType -File $res.Get.Download.Uri[$Architecture.Name]
URI = $res.Get.Download.Uri[$Architecture.Name] -replace $res.Get.Download.ReplaceText, $updateFeed.version
}
Write-Output -InputObject $PSObject
}
}
else {
Write-Warning -Message "$($MyInvocation.MyCommand): failed to find an available from: $($res.Get.Update.Uri)."
}
}
2 changes: 1 addition & 1 deletion Evergreen/Apps/Get-ESETPROTECTServer.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Get-ESETPROTECTServer {

# Find all the supported languages because the versions can be different per language
$Languages = $InfoData.Language | Select-Object -Unique
Write-Verbose -Message "$($MyInvocation.MyCommand): Found $($Language.Count) languages."
Write-Verbose -Message "$($MyInvocation.MyCommand): Found $($Languages.Count) languages."

# Step through each of the supported languages
foreach ($Language in $Languages) {
Expand Down
24 changes: 24 additions & 0 deletions Evergreen/Apps/Get-Flameshot.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Get-Flameshot {
<#
.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
$params = @{
Uri = $res.Get.Uri
MatchVersion = $res.Get.MatchVersion
Filter = $res.Get.MatchFileTypes
}
$object = Get-GitHubRepoRelease @params
Write-Output -InputObject $object
}
24 changes: 24 additions & 0 deletions Evergreen/Apps/Get-GrafanaAgent.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
function Get-GrafanaAgent {
<#
.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
$params = @{
Uri = $res.Get.Uri
MatchVersion = $res.Get.MatchVersion
Filter = $res.Get.MatchFileTypes
}
$object = Get-GitHubRepoRelease @params
Write-Output -InputObject $object
}
2 changes: 1 addition & 1 deletion Evergreen/Apps/Get-KubernetesKubectl.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function Get-KubernetesKubectl {
# Build the download links for each platform & architecture
foreach ($DownloadUri in $res.Get.Download.Uri.GetEnumerator()) {
[PSCustomObject] @{
Version = $Version
Version = $Version.TrimStart("v")
Architecture = $DownloadUri.Name.Split("_")[1]
Platform = $DownloadUri.Name.Split("_")[0]
URI = $DownloadUri.Value -replace $res.Get.Download.ReplaceVersionText, $Version
Expand Down
44 changes: 29 additions & 15 deletions Evergreen/Apps/Get-Microsoft365Apps.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-Microsoft365Apps {
function Get-Microsoft365Apps {
<#
.SYNOPSIS
Returns the latest Microsoft 365 Apps version number for each channel and download.
Expand All @@ -8,34 +8,48 @@ Function Get-Microsoft365Apps {
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $False)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get the channels for the Microsoft 365 Apps
$params = @{
Uri = $res.Get.Update.Channels
ContentType = $res.Get.Update.ContentType
}
$Channels = Invoke-EvergreenRestMethod @params

# Get the latest version details for the Microsoft 365 Apps
$params = @{
Uri = $res.Get.Update.Uri
ContentType = $res.Get.Update.ContentType
}
$Updates = Invoke-EvergreenRestMethod @params

ForEach ($Update in $Updates) {
# Walk through the channels to match versions and return details
foreach ($Channel in $Channels) {
$Item = $Updates | Where-Object { $_.channelId -eq $Channel.name }
if ($Item) {

# Find the release date for this version
$Date = ($Update.officeVersions | Where-Object { $_.legacyVersion -eq $Update.latestVersion }).availabilityDate
# Find the release date for this version
$OfficeVersion = $Item.officeVersions | Where-Object { $_.legacyVersion -eq $Item.latestVersion }

# Build and array of the latest release and download URLs
$PSObject = [PSCustomObject] @{
Version = $Update.latestVersion
Channel = $Update.channelId
Name = $res.Get.Update.ChannelNames.$($Update.channelId)
Date = [System.DateTime]$Date
URI = $res.Get.Download.Uri
# Build and array of the latest release and download URLs
$PSObject = [PSCustomObject] @{
Version = $Item.latestVersion
ReleaseVersion = $OfficeVersion.releaseVersion
Channel = $Channel.name
Name = $Channel.displayName
Date = ConvertTo-DateTime -DateTime $OfficeVersion.availabilityDate -Pattern $res.Get.Update.DateTime
EOSDate = ConvertTo-DateTime -DateTime $OfficeVersion.endOfSupportDate -Pattern $res.Get.Update.DateTime
URI = $res.Get.Download.Uri
}
Write-Output -InputObject $PSObject
}
Write-Output -InputObject $PSObject
}
}
81 changes: 25 additions & 56 deletions Evergreen/Apps/Get-MicrosoftTeams.ps1
Original file line number Diff line number Diff line change
@@ -1,70 +1,39 @@
Function Get-MicrosoftTeams {
function Get-MicrosoftTeams {
<#
.SYNOPSIS
Returns the available Microsoft Teams versions and download URIs.
.NOTES
Author: Aaron Parker
Twitter: @stealthpuppy
https://teams.microsoft.com/desktopclient/installer/windows/x64
https://teams.microsoft.com/desktopclient/installer/windows/x86
https://teams.microsoft.com/desktopclient/installer/windows/arm64
Returns the available Microsoft Teams 2 versions and download URIs.
#>
[OutputType([System.Management.Automation.PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $False)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Step through each release ring
ForEach ($ring in $res.Get.Update.Rings.GetEnumerator()) {

# Read the JSON and convert to a PowerShell object. Return the release version of Teams
Write-Verbose -Message "$($MyInvocation.MyCommand): Query ring: $($ring.Name): $($res.Get.Update.Rings[$ring.Key])."
$params = @{
Uri = $res.Get.Update.Uri -replace $res.Get.Update.ReplaceText, $res.Get.Update.Rings[$ring.Key]
UserAgent = $res.Get.Update.UserAgent
}
$updateFeed = Invoke-EvergreenRestMethod @params

# Read the JSON and build an array of platform, channel, version
If ($Null -ne $updateFeed) {

# Match version number
$Version = [RegEx]::Match($updateFeed.releasesPath, $res.Get.Update.MatchVersion).Captures.Groups[1].Value
Write-Verbose -Message "$($MyInvocation.MyCommand): Found version: $Version."

# Step through each architecture
ForEach ($Architecture in $res.Get.Download.Architecture) {

# Query for the installer
$params = @{
Uri = $res.Get.Download.Uri -replace $res.Get.Download.ReplaceText.architecture, $Architecture -replace $res.Get.Download.ReplaceText.ring, $res.Get.Update.Rings[$ring.Key]
UserAgent = $res.Get.Update.UserAgent
}
$Uri = Invoke-EvergreenRestMethod @params
Write-Verbose -Message "$($MyInvocation.MyCommand): Found installer: $Uri."

# Build the output object and output object to the pipeline
If ($Null -ne $Uri) {

ForEach ($extension in $res.Get.Download.Extensions) {
$Uri = $Uri -replace ".exe$", $extension
$PSObject = [PSCustomObject] @{
Version = $Version
Ring = $ring.Name
Architecture = Get-Architecture -String $Uri
Type = [System.IO.Path]::GetExtension($Uri).Split(".")[-1]
URI = $Uri
}
Write-Output -InputObject $PSObject
}
# Query for the download/update feed
$Feed = Invoke-EvergreenRestMethod -Uri $res.Get.Update.Uri
if ($null -ne $Feed) {

foreach ($Release in $res.Get.Update.Releases.GetEnumerator()) {

# Query the feed for each release type and expand the architectures in that release
foreach ($Item in ($Feed.BuildSettings.$($Release.Value) | `
Get-Member -MemberType "NoteProperty" | `
Select-Object -ExpandProperty "Name" | `
Where-Object { $_ -in $res.Get.Download.Architecture })) {

# Output the version object
$PSObject = [PSCustomObject] @{
Version = $Feed.BuildSettings.$($Release.Value).$Item.latestVersion
Release = $Release.Name
Architecture = $Item
Type = Get-FileType -File $Feed.BuildSettings.$($Release.Value).$Item.buildLink
URI = $Feed.BuildSettings.$($Release.Value).$Item.buildLink
}
Write-Output -InputObject $PSObject
}
}
}
Expand Down
Loading

0 comments on commit 18540a0

Please sign in to comment.