mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2026-08-24 15:16:50 +00:00
fix(autoupdate): Ensure GitHub API requests use token (#6535)
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
- **scoop-uninstall:** Correct `-Global` Switch ([#6454](https://github.com/ScoopInstaller/Scoop/issues/6454))
|
||||
- **scoop-update:** Force sync tags w/ remote branch while scoop update ([#6439](https://github.com/ScoopInstaller/Scoop/issues/6439))
|
||||
- **autoupdate:** Use origin URL to handle URLs with fragment in GitHub mode ([#6455](https://github.com/ScoopInstaller/Scoop/issues/6455))
|
||||
- **autoupdate:** Ensure GitHub API requests use token ([#6535](https://github.com/ScoopInstaller/Scoop/issues/6535))
|
||||
- **buckets|scoop-info:** Switch git log date format to ISO 8601 to avoid locale issues ([#6446](https://github.com/ScoopInstaller/Scoop/issues/6446))
|
||||
- **scoop-version:** Fix logic error caused by missing brackets ([#6463](https://github.com/ScoopInstaller/Scoop/issues/6463))
|
||||
- **getopt:** Teach getopt to respect the `--%` token ([#6477](https://github.com/ScoopInstaller/Scoop/issues/6477))
|
||||
|
||||
@@ -118,6 +118,12 @@ function find_hash_in_json([String] $url, [Hashtable] $substitutions, [String] $
|
||||
$wc = New-Object Net.Webclient
|
||||
$wc.Headers.Add('Referer', (strip_filename $url))
|
||||
$wc.Headers.Add('User-Agent', (Get-UserAgent))
|
||||
|
||||
if (($url -match '^https?://api\.github\.com/.*') -and (Get-GitHubToken)) {
|
||||
$wc.Headers.Add('Authorization', "Bearer $(Get-GitHubToken)")
|
||||
$wc.Headers.Add('X-GitHub-Api-Version', '2022-11-28')
|
||||
}
|
||||
|
||||
$data = $wc.DownloadData($url)
|
||||
$ms = New-Object System.IO.MemoryStream
|
||||
$ms.Write($data, 0, $data.Length)
|
||||
|
||||
Reference in New Issue
Block a user