From c9dce8cca77e4ec5db1bb6ddb81192c47a4f046d Mon Sep 17 00:00:00 2001 From: Aaron Parker Date: Wed, 20 Mar 2024 22:43:29 +1100 Subject: [PATCH] Address #642 Update standard user agent to Microsoft Edge on Windows, and Google Bot --- Evergreen/Evergreen.json | 87 ++++++++++--------- .../Private/Invoke-EvergreenRestMethod.ps1 | 2 +- .../Private/Invoke-EvergreenWebRequest.ps1 | 2 +- .../Private/Resolve-InvokeWebRequest.ps1 | 2 +- Evergreen/Private/Save-File.ps1 | 2 +- Evergreen/Public/Save-EvergreenApp.ps1 | 2 +- Evergreen/Public/Test-EvergreenApp.ps1 | 2 +- 7 files changed, 53 insertions(+), 46 deletions(-) diff --git a/Evergreen/Evergreen.json b/Evergreen/Evergreen.json index 603a7ec3..c90b4913 100644 --- a/Evergreen/Evergreen.json +++ b/Evergreen/Evergreen.json @@ -1,41 +1,48 @@ { - "Preferences": { - "ErrorAction": "Stop" - }, - "Filters": { - "WindowsInstallers": "\\.exe$|\\.msi$|\\.msp$|\\.zip$", - "Filename": "(([a-zA-Z0-9\\s_\\.\\-\\(\\):])+(.exe|.msi|.msp|.zip))" - }, - "Properties": { - "SourceForge": [ - "release", - "platform_releases" - ], - "GitHub": [ - "assets", - "assets_url", - "author", - "body", - "created_at", - "draft", - "html_url", - "id", - "name", - "node_id", - "prerelease", - "published_at", - "tag_name", - "tarball_url", - "target_commitish", - "upload_url", - "url", - "zipball_url" - ] - }, - "Uri": { - "Project": "https://github.com/aaronparker/evergreen/", - "Docs": "https://stealthpuppy.com/evergreen/", - "Issues": "https://stealthpuppy.com/evergreen/issues/", - "Info": "https://stealthpuppy.com/evergreen/troubleshoot/" - } -} + "Preferences": { + "ErrorAction": "Stop" + }, + "UserAgent": { + "Base": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.", + "Download": [ + "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.", + "Googlebot/2.1 (+http://www.google.com/bot.html)" + ] + }, + "Filters": { + "WindowsInstallers": "\\.exe$|\\.msi$|\\.msp$|\\.zip$", + "Filename": "(([a-zA-Z0-9\\s_\\.\\-\\(\\):])+(.exe|.msi|.msp|.zip))" + }, + "Properties": { + "SourceForge": [ + "release", + "platform_releases" + ], + "GitHub": [ + "assets", + "assets_url", + "author", + "body", + "created_at", + "draft", + "html_url", + "id", + "name", + "node_id", + "prerelease", + "published_at", + "tag_name", + "tarball_url", + "target_commitish", + "upload_url", + "url", + "zipball_url" + ] + }, + "Uri": { + "Project": "https://github.com/aaronparker/evergreen/", + "Docs": "https://stealthpuppy.com/evergreen/", + "Issues": "https://stealthpuppy.com/evergreen/issues/", + "Info": "https://stealthpuppy.com/evergreen/troubleshoot/" + } +} \ No newline at end of file diff --git a/Evergreen/Private/Invoke-EvergreenRestMethod.ps1 b/Evergreen/Private/Invoke-EvergreenRestMethod.ps1 index f7c453bd..4c7fee3f 100644 --- a/Evergreen/Private/Invoke-EvergreenRestMethod.ps1 +++ b/Evergreen/Private/Invoke-EvergreenRestMethod.ps1 @@ -38,7 +38,7 @@ function Invoke-EvergreenRestMethod { [Parameter()] [ValidateNotNullOrEmpty()] - [System.String] $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome, + [System.String] $UserAgent = $script:resourceStrings.UserAgent.Base, [Parameter()] [System.Management.Automation.SwitchParameter] $SkipCertificateCheck diff --git a/Evergreen/Private/Invoke-EvergreenWebRequest.ps1 b/Evergreen/Private/Invoke-EvergreenWebRequest.ps1 index 2391b863..7ee4d8e6 100644 --- a/Evergreen/Private/Invoke-EvergreenWebRequest.ps1 +++ b/Evergreen/Private/Invoke-EvergreenWebRequest.ps1 @@ -30,7 +30,7 @@ function Invoke-EvergreenWebRequest { [Parameter()] [ValidateNotNullOrEmpty()] - [System.String] $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome, + [System.String] $UserAgent = $script:resourceStrings.UserAgent.Base, [Parameter()] [System.Management.Automation.SwitchParameter] $Raw, diff --git a/Evergreen/Private/Resolve-InvokeWebRequest.ps1 b/Evergreen/Private/Resolve-InvokeWebRequest.ps1 index ede89b2d..961a7852 100644 --- a/Evergreen/Private/Resolve-InvokeWebRequest.ps1 +++ b/Evergreen/Private/Resolve-InvokeWebRequest.ps1 @@ -13,7 +13,7 @@ function Resolve-InvokeWebRequest { [Parameter(Position = 1)] [ValidateNotNullOrEmpty()] - [System.String] $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome, + [System.String] $UserAgent = $script:resourceStrings.UserAgent.Base, [Parameter(Position = 2)] [ValidateNotNullOrEmpty()] diff --git a/Evergreen/Private/Save-File.ps1 b/Evergreen/Private/Save-File.ps1 index 0a9b31d9..2a58592d 100644 --- a/Evergreen/Private/Save-File.ps1 +++ b/Evergreen/Private/Save-File.ps1 @@ -20,7 +20,7 @@ Uri = $Uri OutFile = $OutFile UseBasicParsing = $True - UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome + UserAgent = $script:resourceStrings.UserAgent.Base } if (Test-PSCore) { $params.SslProtocol = "Tls12" diff --git a/Evergreen/Public/Save-EvergreenApp.ps1 b/Evergreen/Public/Save-EvergreenApp.ps1 index cfc0fa0c..c14b0c45 100644 --- a/Evergreen/Public/Save-EvergreenApp.ps1 +++ b/Evergreen/Public/Save-EvergreenApp.ps1 @@ -40,7 +40,7 @@ Function Save-EvergreenApp { [Parameter()] [ValidateNotNullOrEmpty()] - [System.String] $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome, + [System.String] $UserAgent = $script:resourceStrings.UserAgent.Base, [Parameter(Mandatory = $false)] [System.Management.Automation.SwitchParameter] $Force, diff --git a/Evergreen/Public/Test-EvergreenApp.ps1 b/Evergreen/Public/Test-EvergreenApp.ps1 index 0cc4f5d0..e37bbdca 100644 --- a/Evergreen/Public/Test-EvergreenApp.ps1 +++ b/Evergreen/Public/Test-EvergreenApp.ps1 @@ -23,7 +23,7 @@ Function Test-EvergreenApp { [Parameter()] [ValidateNotNullOrEmpty()] - [System.String] $UserAgent = [Microsoft.PowerShell.Commands.PSUserAgent]::Chrome, + [System.String] $UserAgent = $script:resourceStrings.UserAgent.Base, [Parameter(Mandatory = $False)] [System.Management.Automation.SwitchParameter] $Force,