Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
rashil2000 committed Mar 21, 2022
1 parent b07a47a commit fdbf614
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
4 changes: 1 addition & 3 deletions lib/core.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1033,9 +1033,7 @@ function handle_special_urls($url)

# Github.com
if ($url -match 'github.com/(?<owner>[^/]+)/(?<repo>[^/]+)/releases/download/(?<tag>[^/]+)/(?<file>[^/#]+)(?<filename>.*)' -and ($token = get_config 'checkver_token')) {
$headers = @{
"Authorization" = "token $token"
}
$headers = @{ "Authorization" = "token $token" }
$privateUrl = "https://api.github.com/repos/$($Matches.owner)/$($Matches.repo)"
$assetUrl = "https://api.github.com/repos/$($Matches.owner)/$($Matches.repo)/releases/tags/$($Matches.tag)"

Expand Down
9 changes: 3 additions & 6 deletions lib/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -402,12 +402,9 @@ function dl($url, $to, $cookies, $progress) {
$wreq.Headers.Add('Cookie', (cookie_header $cookies))
}

$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
}
get_config 'private_hosts' | Where-Object { $url -match $_.match } | ForEach-Object {
(ConvertFrom-StringData -StringData $_.Headers).GetEnumerator() | ForEach-Object {
$wreq.Headers[$_.Key] = $_.Value
}
}
}
Expand Down

0 comments on commit fdbf614

Please sign in to comment.