From 28930e9da7342dcd95ddfe94d509e62b011a136f Mon Sep 17 00:00:00 2001 From: James Ruskin Date: Fri, 8 Sep 2023 08:46:52 +0100 Subject: [PATCH] (nomacs.portable) Fixes Update.ps1 (HTML Parsing) --- automatic/nomacs.portable/update.ps1 | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/automatic/nomacs.portable/update.ps1 b/automatic/nomacs.portable/update.ps1 index 0ad32c25a2f..987ecdad588 100644 --- a/automatic/nomacs.portable/update.ps1 +++ b/automatic/nomacs.portable/update.ps1 @@ -1,6 +1,4 @@ -import-module au - -$releases = 'https://github.com/nomacs/nomacs/releases' +Import-Module AU function global:au_SearchReplace { @{ @@ -23,14 +21,14 @@ function global:au_SearchReplace { function global:au_BeforeUpdate { Get-RemoteFiles -NoSuffix -Purge } function global:au_GetLatest { - $download_page = Invoke-WebRequest -Uri $releases -UseBasicParsing - $url = $download_page.links | ? href -like '*/nomacs-*.zip' | % href | select -First 1 - $version = $url -split '\/' | select -Last 1 -Skip 1 + $latestRelease = Get-GitHubRelease -Owner nomacs -Name nomacs + $url = $latestRelease.assets.Where{$_.name -like 'nomacs-*.zip'}[0].browser_download_url + $version = $latestRelease.tag_name.TrimStart('v') @{ Version = $version - URL64 = "https://github.com/${url}" - ReleaseNotes = "https://github.com/nomacs/nomacs/releases/tag/${version}" - FileName = $url -split '/' | select -last 1 + URL64 = $url + ReleaseNotes = $latestRelease.html_url + FileName = $url -split '/' | Select-Object -last 1 } }