Update install.ps1
This commit is contained in:
parent
d8302b110b
commit
29fe64ed42
1 changed files with 39 additions and 5 deletions
44
install.ps1
44
install.ps1
|
|
@ -1,4 +1,4 @@
|
||||||
# SteamDaddy One-Click Installer — github.com/Contrary7/SteamDaddy-Backup
|
# SteamDaddy One-Click Installer — contrary7.duckdns.org/contrary/steamdaddy
|
||||||
# Safe community patcher for Steam games. Not malware.
|
# Safe community patcher for Steam games. Not malware.
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
|
@ -16,10 +16,23 @@ if (-not $isAdmin) {
|
||||||
# Running from pipe (irm|iex) — save to temp file first, then re-launch with -File
|
# Running from pipe (irm|iex) — save to temp file first, then re-launch with -File
|
||||||
# This avoids spawning a child process whose command line contains "irm ... | iex"
|
# This avoids spawning a child process whose command line contains "irm ... | iex"
|
||||||
$tmpScript = Join-Path $env:TEMP "SteamDaddy_Install.ps1"
|
$tmpScript = Join-Path $env:TEMP "SteamDaddy_Install.ps1"
|
||||||
(New-Object System.Net.WebClient).DownloadFile(
|
$scriptUrls = @(
|
||||||
|
"https://contrary7.duckdns.org/contrary/steamdaddy/raw/branch/main/install.ps1",
|
||||||
"https://raw.githubusercontent.com/Contrary7/SteamDaddy-Backup/main/install_b.ps1",
|
"https://raw.githubusercontent.com/Contrary7/SteamDaddy-Backup/main/install_b.ps1",
|
||||||
$tmpScript
|
"https://codeberg.org/Contrary/SteamDaddy/raw/branch/main/install.ps1"
|
||||||
)
|
)
|
||||||
|
$elevateSaved = $false
|
||||||
|
foreach ($sUrl in $scriptUrls) {
|
||||||
|
try {
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
(New-Object System.Net.WebClient).DownloadFile($sUrl, $tmpScript)
|
||||||
|
if ((Test-Path $tmpScript) -and (Get-Item $tmpScript).Length -gt 500) {
|
||||||
|
$elevateSaved = $true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
if (-not $elevateSaved) { throw "Could not fetch elevation script from DuckDNS or fallbacks." }
|
||||||
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$tmpScript`"" -Verb RunAs -ErrorAction Stop
|
Start-Process powershell.exe -ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$tmpScript`"" -Verb RunAs -ErrorAction Stop
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
@ -31,7 +44,11 @@ if (-not $isAdmin) {
|
||||||
Write-Host "[SteamDaddy] Fetching latest release..." -ForegroundColor Cyan
|
Write-Host "[SteamDaddy] Fetching latest release..." -ForegroundColor Cyan
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$downloadUrl = "https://github.com/Contrary7/SteamDaddy-Backup/releases/latest/download/SteamDaddy.exe"
|
$candidateUrls = @(
|
||||||
|
"https://contrary7.duckdns.org/contrary/steamdaddy/releases/download/latest/SteamDaddy.exe",
|
||||||
|
"https://github.com/Contrary7/SteamDaddy-Backup/releases/latest/download/SteamDaddy.exe",
|
||||||
|
"https://codeberg.org/Contrary/SteamDaddy/releases/download/latest/SteamDaddy.exe"
|
||||||
|
)
|
||||||
|
|
||||||
$desktop = [Environment]::GetFolderPath("Desktop")
|
$desktop = [Environment]::GetFolderPath("Desktop")
|
||||||
$destPath = Join-Path $desktop "SteamDaddy.exe"
|
$destPath = Join-Path $desktop "SteamDaddy.exe"
|
||||||
|
|
@ -214,7 +231,24 @@ try {
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "[SteamDaddy] Downloading SteamDaddy.exe to Desktop..." -ForegroundColor Magenta
|
Write-Host "[SteamDaddy] Downloading SteamDaddy.exe to Desktop..." -ForegroundColor Magenta
|
||||||
Invoke-WebRequest -Uri $downloadUrl -OutFile $destPath -UseBasicParsing
|
$downloadSuccess = $false
|
||||||
|
foreach ($cUrl in $candidateUrls) {
|
||||||
|
try {
|
||||||
|
Write-Host "[SteamDaddy] Attempting download from: $cUrl" -ForegroundColor Cyan
|
||||||
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
Invoke-WebRequest -Uri $cUrl -OutFile $destPath -UseBasicParsing -TimeoutSec 20
|
||||||
|
if ((Test-Path $destPath) -and (Get-Item $destPath).Length -gt 1000000) {
|
||||||
|
$downloadSuccess = $true
|
||||||
|
Write-Host "[SteamDaddy] Download completed successfully!" -ForegroundColor Green
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
Write-Host "[SteamDaddy] Mirror failed, trying next fallback..." -ForegroundColor DarkYellow
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (-not $downloadSuccess) {
|
||||||
|
throw "Failed to download SteamDaddy.exe from all mirrors."
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "[SteamDaddy] Launching SteamDaddy..." -ForegroundColor Green
|
Write-Host "[SteamDaddy] Launching SteamDaddy..." -ForegroundColor Green
|
||||||
Start-Process $destPath
|
Start-Process $destPath
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue