Skip to content

Commit

Permalink
Some tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
niheaven committed Mar 21, 2022
1 parent 3c9e3a6 commit b07a47a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 22 deletions.
8 changes: 4 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## [Unreleased](https://github.com/ScoopInstaller/Scoop/compare/master...develop)

### Features

- **install:** Allow downloading from private repositories ([$4254](https://github.com/ScoopInstaller/Scoop/issues/4243))

### Bug Fixes

- **shim:** Manipulating shims with UTF8 encoding ([#4791](https://github.com/ScoopInstaller/Scoop/issues/4791), [#4813](https://github.com/ScoopInstaller/Scoop/issues/4813))
Expand All @@ -14,10 +18,6 @@
- **relpath:** Use `$PSScriptRoot` instead of `relpath` ([#4793](https://github.com/ScoopInstaller/Scoop/issues/4793))
- **reset_aliases:** Move core function of `reset_aliases` to `scoop` ([#4794](https://github.com/ScoopInstaller/Scoop/issues/4794))

### Features

- **install:** Update to allow for dowloading from private repositories ([$4254](https://github.com/ScoopInstaller/Scoop/issues/4243))

## [v0.1.0](https://github.com/ScoopInstaller/Scoop/compare/2021-12-26...v0.1.0) - 2022-03-01

### Features
Expand Down
32 changes: 16 additions & 16 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -387,26 +387,26 @@ function dl_with_cache_aria2($app, $version, $manifest, $architecture, $dir, $co

# download with filesize and progress indicator
function dl($url, $to, $cookies, $progress) {
$reqUrl = ($url -split "#")[0]
$wreq = [net.webrequest]::create($reqUrl)
if($wreq -is [net.httpwebrequest]) {
$wreq.useragent = Get-UserAgent
if (-not ($url -imatch "sourceforge\.net" -or $url -imatch "portableapps\.com")) {
$wreq.referer = strip_filename $url
$reqUrl = ($url -split '#')[0]
$wreq = [Net.WebRequest]::Create($reqUrl)
if ($wreq -is [Net.HttpWebRequest]) {
$wreq.UserAgent = Get-UserAgent
if (-not ($url -match 'sourceforge\.net' -or $url -match 'portableapps\.com')) {
$wreq.Referer = strip_filename $url
}
if ($url -imatch "api\.github\.com/repos") {
$wreq.accept = "application/octet-stream"
$wreq.headers["Authorization"] = "token $(get_config 'checkver_token')"
if ($url -match 'api\.github\.com/repos') {
$wreq.Accept = 'application/octet-stream'
$wreq.Headers['Authorization'] = "token $(get_config 'checkver_token')"
}
if($cookies) {
$wreq.headers.add('Cookie', (cookie_header $cookies))
if ($cookies) {
$wreq.Headers.Add('Cookie', (cookie_header $cookies))
}

$hosts = get_config "hosts"
if ($hosts) {
$hosts | Where-Object { $url -match $_.match } | ForEach-Object {
(ConvertFrom-StringData -StringData $_.headers).GetEnumerator() | ForEach-Object {
$wreq.headers[$_.Key] = $_.Value
$privateHosts = get_config 'private_hosts'
if ($privateHosts) {
$privateHosts | Where-Object { $url -match $_.match } | ForEach-Object {
(ConvertFrom-StringData -StringData $_.Headers).GetEnumerator() | ForEach-Object {
$wreq.Headers[$_.Key] = $_.Value
}
}
}
Expand Down
9 changes: 7 additions & 2 deletions libexec/scoop-config.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
#
# checkver_token:
# GitHub API token used to make authenticated requests.
# This is essential for checkver and similar functions
# to run without incurring rate limits.
# This is essential for checkver and similar functions to run without
# incurring rate limits and download from private repositories.
#
# virustotal_api_key:
# API key used for uploading/scanning files using virustotal.
Expand All @@ -96,6 +96,11 @@
# any target app process is running. Procedure here refers to reset/uninstall/update.
# When set to $true, Scoop only displays a warning message and continues procedure.
#
# private_hosts:
# Array of private hosts that need additional authentication.
# For example, if you want to access a private GitHub repository,
# you need to add the host to this list with 'match' and 'headers' strings.
#
# ARIA2 configuration
# -------------------
#
Expand Down

0 comments on commit b07a47a

Please sign in to comment.