diff --git a/32 b/32
index 1530180..be05d2f 100644
--- a/32
+++ b/32
@@ -1,5 +1,5 @@
-# This script is hosted on https://get.msvc.win/ for MSVC Win Project
To get started, run irm get.msvc.win | iex inside of PowerShell
+# This script is hosted on https://get.msvc.win/32 for MSVC Win Project
To get started, run irm get.msvc.win/32 | iex inside of PowerShellAdd-Type -AssemblyName System.IO.Compression.FileSystem @@ -13,7 +13,7 @@ $IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIden if (-not $IsAdmin) { Write-Host "Elevation required. Relaunching..." $tempScript = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), ".ps1") - Invoke-WebRequest -Uri "https://get.msvc.win/" -OutFile $tempScript + Invoke-WebRequest -Uri "https://get.msvc.win/32" -OutFile $tempScript Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$tempScript`"" Start-Sleep -Seconds 10 if (-Not (Test-Path $flagPath)) { @@ -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-32bit-build1.zip" + if ($countryCode -eq 'CN') { + $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip" + } else { + $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-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 diff --git a/64 b/64 index f7c2511..71e521f 100644 --- a/64 +++ b/64 @@ -1,5 +1,5 @@ -# This script is hosted on https://get.msvc.win/ for MSVC Win Project
To get started, run irm get.msvc.win | iex inside of PowerShell+# This script is hosted on https://get.msvc.win/64 for MSVC Win Project
To get started, run irm get.msvc.win/64 | iex inside of PowerShellAdd-Type -AssemblyName System.IO.Compression.FileSystem @@ -13,7 +13,7 @@ $IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIden if (-not $IsAdmin) { Write-Host "Elevation required. Relaunching..." $tempScript = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), ".ps1") - Invoke-WebRequest -Uri "https://get.msvc.win/" -OutFile $tempScript + Invoke-WebRequest -Uri "https://get.msvc.win/64" -OutFile $tempScript Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$tempScript`"" Start-Sleep -Seconds 10 if (-Not (Test-Path $flagPath)) { @@ -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 diff --git a/dx b/dx new file mode 100644 index 0000000..2be8cef --- /dev/null +++ b/dx @@ -0,0 +1,87 @@ + +# This script is hosted on https://get.msvc.win/ for MSVC Win Project
To get started, run irm get.msvc.win | iex inside of PowerShell+ +Add-Type -AssemblyName System.IO.Compression.FileSystem + +$flagPath = "$env:TEMP\elevation_success.flag" +if (Test-Path $flagPath) { Remove-Item $flagPath -ErrorAction SilentlyContinue } + +# --- Elevation check --- +$IsAdmin = ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole( + [Security.Principal.WindowsBuiltInRole]::Administrator) + +if (-not $IsAdmin) { + Write-Host "Elevation required. Relaunching..." + $tempScript = [IO.Path]::ChangeExtension([IO.Path]::GetTempFileName(), ".ps1") + Invoke-WebRequest -Uri "https://get.msvc.win/" -OutFile $tempScript + Start-Process powershell -Verb RunAs -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$tempScript`"" + Start-Sleep -Seconds 10 + if (-Not (Test-Path $flagPath)) { + Write-Warning "User did not confirm UAC prompt or something went wrong." + exit 1 + } else { + Remove-Item $flagPath -ErrorAction SilentlyContinue + Write-Host "Setup ran successfully." + exit 0 + } +} + +# --- Elevated section --- +New-Item -Path $flagPath -ItemType File -Force | Out-Null +Write-Host "Running with elevated privileges..." + +$tempDir = New-Item -ItemType Directory -Path ([IO.Path]::Combine($env:TEMP, [guid]::NewGuid().ToString())) +$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" + if ($countryCode -eq 'CN') { + $aria2Url = "https://gitee.com/HikariCalyx/OSTRemote/releases/download/v1.0/aria2-1.37.0-win-32bit-build1.zip" + } else { + $aria2Url = "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-32bit-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 + if ($found) { Copy-Item $found.FullName -Destination $aria2Exe -Force } +} + +# --- Define all downloads --- +$downloads = @( + @{ Name = "directx_redist.exe"; Url = "https://download.microsoft.com/download/8/4/a/84a35bf1-dafe-4ae8-82af-ad2ae20b6b14/directx_jun2010_redist.exe" } +) + +# --- Download everything up front --- +foreach ($item in $downloads) { + $outFile = Join-Path $tempDir $item.Name + Write-Host "Downloading $($item.Name)..." + Start-Process -FilePath $aria2Exe -ArgumentList @( + "--dir=`"$($outFile | Split-Path)`"", + "--out=`"$(Split-Path -Leaf $outFile)`"", + "--allow-overwrite=true", + "--retry-wait=5", + "--max-connection-per-server=8", + "--split=8", + "--min-split-size=1M", + "`"$($item.Url)`"" + ) -NoNewWindow -Wait +} + +# --- Install DirectX --- +Write-Host "Installing DirectX..." +Start-Process -FilePath "$tempDir\directx_redist.exe" -ArgumentList "/Q /T:`"$tempDir`"" -Wait +Start-Process -FilePath "$tempDir\DXSETUP.exe" -ArgumentList "/silent" -Wait + +# --- Cleanup --- +Write-Host "Cleaning up temporary files..." +Start-Sleep -Seconds 2 +Remove-Item -Path $tempDir -Recurse -Force -ErrorAction SilentlyContinue +Remove-Item -Path $flagPath -Force -ErrorAction SilentlyContinue diff --git a/index.html b/index.html index 479fece..21f57b1 100644 --- a/index.html +++ b/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