From d927c80ac05c5f9ffb005b8ce6f56df896e66e2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=9D=A4=E6=98=AF=E7=BA=B1=E9=9B=BE=E9=85=B1=E5=93=9F?= =?UTF-8?q?=EF=BD=9E?= <49941141+Dragon1573@users.noreply.github.com> Date: Sat, 27 Jun 2026 18:59:43 +0800 Subject: [PATCH 1/2] feat: add package task for bee-san.RustScan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com> --- Tasks/bee-san.RustScan/Config.yaml | 3 ++ Tasks/bee-san.RustScan/Script.ps1 | 60 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 Tasks/bee-san.RustScan/Config.yaml create mode 100644 Tasks/bee-san.RustScan/Script.ps1 diff --git a/Tasks/bee-san.RustScan/Config.yaml b/Tasks/bee-san.RustScan/Config.yaml new file mode 100644 index 0000000000..e42f0a6947 --- /dev/null +++ b/Tasks/bee-san.RustScan/Config.yaml @@ -0,0 +1,3 @@ +Type: PackageTask +WinGetIdentifier: bee-san.RustScan +Skip: false diff --git a/Tasks/bee-san.RustScan/Script.ps1 b/Tasks/bee-san.RustScan/Script.ps1 new file mode 100644 index 0000000000..e31b19817d --- /dev/null +++ b/Tasks/bee-san.RustScan/Script.ps1 @@ -0,0 +1,60 @@ +$RepoOwner = 'bee-san' +$RepoName = 'RustScan' + +$Object1 = Invoke-GitHubApi -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases/latest" + +# Version +$this.CurrentState.Version = $Object1.tag_name -creplace '^v' + +# Installer +$installerFiles = $Object1.assets.Where({ $_.name.EndsWith('.exe.zip') }) +Write-Output $installerFiles +# x86 installer file +$this.CurrentState.Installer += [ordered]@{ + InstallerUrl = $installerFiles.Where({ $_.name.StartsWith('x86') })[0].browser_download_url | ConvertTo-UnescapedUri + Architecture = 'x86' +} +# x64 installer file +$this.CurrentState.Installer += [ordered]@{ + InstallerUrl = $installerFiles.Where({ $_.name.StartsWith('x86_64-') })[0].browser_download_url | ConvertTo-UnescapedUri + Architecture = 'x64' +} + +switch -Regex ($this.Check()) { + 'New|Changed|Updated' { + try { + # ReleaseTime + $this.CurrentState.ReleaseTime = $Object1.published_at.ToUniversalTime() + + if (-not [string]::IsNullOrWhiteSpace($Object1.body)) { + # ReleaseNotes (en-US) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'en-US' + Key = 'ReleaseNotes' + Value = $Object1.body | Convert-MarkdownToHtml -Extensions 'advanced', 'emojis', 'hardlinebreak' | Get-TextContent | Format-Text + } + } else { + $this.Log("No ReleaseNotes (en-US) for version $($this.CurrentState.Version)", 'Warning') + } + + # ReleaseNotesUrl (en-US) + $this.CurrentState.Locale += [ordered]@{ + Locale = 'en-US' + Key = 'ReleaseNotesUrl' + Value = $Object1.html_url + } + } catch { + $_ | Out-Host + $this.Log($_, 'Warning') + } + + $this.Print() + $this.Write() + } + 'Changed|Updated' { + $this.Message() + } + 'Updated' { + $this.Submit() + } +} From 4abac218f35713a9a7fc32e93f32e359a8725d2e Mon Sep 17 00:00:00 2001 From: SpecterShell <56779163+SpecterShell@users.noreply.github.com> Date: Sun, 5 Jul 2026 00:49:29 +0800 Subject: [PATCH 2/2] Refactor --- Tasks/bee-san.RustScan/Script.ps1 | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/Tasks/bee-san.RustScan/Script.ps1 b/Tasks/bee-san.RustScan/Script.ps1 index e31b19817d..a038b85db8 100644 --- a/Tasks/bee-san.RustScan/Script.ps1 +++ b/Tasks/bee-san.RustScan/Script.ps1 @@ -1,23 +1,20 @@ -$RepoOwner = 'bee-san' -$RepoName = 'RustScan' - -$Object1 = Invoke-GitHubApi -Uri "https://api.github.com/repos/${RepoOwner}/${RepoName}/releases/latest" +$Object1 = Invoke-GitHubApi -Uri 'https://api.github.com/repos/bee-san/RustScan/releases/latest' # Version -$this.CurrentState.Version = $Object1.tag_name -creplace '^v' +$this.CurrentState.Version = $Object1.tag_name -replace '^v' # Installer -$installerFiles = $Object1.assets.Where({ $_.name.EndsWith('.exe.zip') }) -Write-Output $installerFiles -# x86 installer file $this.CurrentState.Installer += [ordered]@{ - InstallerUrl = $installerFiles.Where({ $_.name.StartsWith('x86') })[0].browser_download_url | ConvertTo-UnescapedUri - Architecture = 'x86' + Architecture = 'x86' + InstallerType = 'zip' + NestedInstallerType = 'portable' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.zip') -and $_.name.StartsWith('x86-') -and $_.name -match 'windows' }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri } -# x64 installer file $this.CurrentState.Installer += [ordered]@{ - InstallerUrl = $installerFiles.Where({ $_.name.StartsWith('x86_64-') })[0].browser_download_url | ConvertTo-UnescapedUri - Architecture = 'x64' + Architecture = 'x64' + InstallerType = 'zip' + NestedInstallerType = 'portable' + InstallerUrl = $Object1.assets.Where({ $_.name.EndsWith('.zip') -and $_.name.StartsWith('x86_64') -and $_.name -match 'windows' }, 'First')[0].browser_download_url | ConvertTo-UnescapedUri } switch -Regex ($this.Check()) {