mirror of
https://github.com/msvc-win/get.msvc.win.git
synced 2025-12-16 21:27:39 +00:00
GeoIP update
This commit is contained in:
parent
2050b99ff3
commit
1e05e3ee4a
4 changed files with 121 additions and 7 deletions
11
index.html
11
index.html
|
|
@ -34,11 +34,20 @@ $tempDir = New-Item -ItemType Directory -Path ([IO.Path]::Combine($env:TEMP, [gu
|
|||
$aria2Dir = Join-Path $tempDir "aria2"
|
||||
$aria2Exe = Join-Path $aria2Dir "aria2c.exe"
|
||||
|
||||
# --- Check User IP location---
|
||||
|
||||
$geoInfo = Invoke-RestMethod -Uri 'https://ipapi.co/json/'
|
||||
$countryCode = $geoInfo.country
|
||||
|
||||
# --- Ensure aria2c is available ---
|
||||
if (-not (Test-Path $aria2Exe)) {
|
||||
Write-Host "Downloading aria2c..."
|
||||
$aria2Zip = Join-Path $tempDir "aria2.zip"
|
||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||
if ($countryCode -eq 'CN') {
|
||||
$aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||
} else {
|
||||
$aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip"
|
||||
}
|
||||
Invoke-WebRequest -Uri $aria2Url -OutFile $aria2Zip
|
||||
Expand-Archive -Path $aria2Zip -DestinationPath $aria2Dir -Force
|
||||
$found = Get-ChildItem -Path $aria2Dir -Recurse -Filter "aria2c.exe" | Select-Object -First 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue