Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
DanGough committed Aug 10, 2022
2 parents cf17dde + 28578ab commit d4878bf
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Nevergreen/Apps/Get-AdobeAcrobat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ foreach ($Platform in $Platforms) {
$SearchCount = 5

do {
$ReleaseURL = Get-Link -Uri $ReleaseURL -MatchProperty outerHTML -Pattern '>Next' -PrefixParent
$ReleaseURL = Get-Link -Uri $ReleaseURL -Headers @{"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"} -MatchProperty outerHTML -Pattern '>Next' -PrefixParent

$URL = Get-Link -Uri $ReleaseURL -MatchProperty href -Pattern $Platform.Pattern
$URL = Get-Link -Uri $ReleaseURL -Headers @{"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"} -MatchProperty href -Pattern $Platform.Pattern
if ($URL) {
$Version = ($URL | Get-Version -Pattern '(\d{8,12}).+msp') -replace '(\d{2})(\d{3})(\d+)','$1.$2.$3'
New-NevergreenApp -Name 'Adobe Acrobat' -Version $Version -Uri $URL -Architecture $Platform.Architecture -Language $Platform.Language -Type 'Msp'
Expand Down
4 changes: 2 additions & 2 deletions Nevergreen/Apps/Get-AdobeAcrobatReader.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ foreach ($Platform in $Platforms) {
$SearchCount = 5

do {
$ReleaseURL = Get-Link -Uri $ReleaseURL -MatchProperty outerHTML -Pattern '>Next' -PrefixParent
$ReleaseURL = Get-Link -Uri $ReleaseURL -Headers @{"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"} -MatchProperty outerHTML -Pattern '>Next' -PrefixParent

$URL = Get-Link -Uri $ReleaseURL -MatchProperty href -Pattern $Platform.Pattern
$URL = Get-Link -Uri $ReleaseURL -Headers @{"accept-language"="en-GB,en;q=0.9,en-US;q=0.8"} -MatchProperty href -Pattern $Platform.Pattern
if ($URL) {
$Version = ($URL | Get-Version -Pattern '(\d{8,12}).+msp') -replace '(\d{2})(\d{3})(\d+)','$1.$2.$3'
New-NevergreenApp -Name 'Adobe Acrobat Reader' -Version $Version -Uri $URL -Architecture $Platform.Architecture -Language $Platform.Language -Type 'Msp'
Expand Down
5 changes: 5 additions & 0 deletions Nevergreen/Private/Get-Link.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ function Get-Link {
[Parameter(
Mandatory = $false)]
[String] $UserAgent,
[System.Collections.Hashtable] $Headers,
[Switch] $PrefixDomain,
[Switch] $PrefixParent
)
Expand All @@ -83,6 +84,10 @@ function Get-Link {
$ParamHash.UserAgent = $UserAgent
}

if ($Headers) {
$ParamHash.Headers = $Headers
}

try {
$Response = Invoke-WebRequest @ParamHash

Expand Down
7 changes: 6 additions & 1 deletion Nevergreen/Private/Resolve-Uri.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ function Resolve-Uri {
[Parameter(
Mandatory = $false,
Position = 1)]
[String] $UserAgent
[String] $UserAgent,
[System.Collections.Hashtable] $Headers
)

begin {
Expand All @@ -67,6 +68,10 @@ function Resolve-Uri {
$ParamHash.UserAgent = $UserAgent
}

if ($Headers) {
$ParamHash.Headers = $Headers
}

$Response = Invoke-WebRequest @ParamHash

if ($IsCoreCLR) {
Expand Down

0 comments on commit d4878bf

Please sign in to comment.