feat: use canonical GitHub downloader release
This commit is contained in:
+77
-5
@@ -8,6 +8,9 @@ $ProgressPreference = "SilentlyContinue"
|
||||
$tempDir = "$env:TEMP\vserver-setup"
|
||||
$desktopPath = [Environment]::GetFolderPath("Desktop")
|
||||
$winrarPath = "C:\Program Files\WinRAR\WinRAR.exe"
|
||||
$giteaBaseUrl = "https://git.24-music.de"
|
||||
$githubApiBaseUrl = "https://api.github.com"
|
||||
$githubDownloaderRepo = "Sucukdeluxe/multi-debrid-downloader"
|
||||
$totalSteps = 18
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
|
||||
@@ -45,7 +48,7 @@ function Unrar-File {
|
||||
|
||||
function Get-Gitea-Latest-Asset {
|
||||
param($Repo, $Filter)
|
||||
$releaseApi = "https://git.24-music.de/api/v1/repos/Administrator/$Repo/releases?limit=1"
|
||||
$releaseApi = "$giteaBaseUrl/api/v1/repos/Administrator/$Repo/releases?limit=1"
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$wc.Headers.Add("User-Agent", "Mozilla/5.0")
|
||||
$release = ($wc.DownloadString($releaseApi) | ConvertFrom-Json)[0]
|
||||
@@ -56,6 +59,20 @@ function Get-Gitea-Latest-Asset {
|
||||
return $asset
|
||||
}
|
||||
|
||||
function Get-GitHub-Latest-Asset {
|
||||
param($Repo, $Filter)
|
||||
$releaseApi = "$githubApiBaseUrl/repos/$Repo/releases/latest"
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$wc.Headers.Add("User-Agent", "VServerSetup")
|
||||
$wc.Headers.Add("Accept", "application/vnd.github+json")
|
||||
$release = ($wc.DownloadString($releaseApi) | ConvertFrom-Json)
|
||||
$asset = $release.assets | Where-Object { $_.name -like $Filter -and $_.name -notlike "*.blockmap" } | Select-Object -First 1
|
||||
if ($asset) {
|
||||
Write-Host " Version: $($release.tag_name)" -ForegroundColor Gray
|
||||
}
|
||||
return $asset
|
||||
}
|
||||
|
||||
function Copy-Gitea-DataFile-To-Desktop {
|
||||
param($Repo, $Filter)
|
||||
try {
|
||||
@@ -111,6 +128,61 @@ function Install-Gitea-App {
|
||||
}
|
||||
}
|
||||
|
||||
function Install-GitHub-App {
|
||||
param($Name, $Repo, $StepNum, $DetectPaths, $ProcessName)
|
||||
Write-Host ""
|
||||
Write-Host "[$StepNum/$totalSteps] $Name..." -ForegroundColor Yellow
|
||||
|
||||
foreach ($p in $DetectPaths) {
|
||||
if (Test-Path $p) {
|
||||
Write-Host " Bereits installiert - ueberspringe." -ForegroundColor Gray
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
Write-Host " Hole neueste Version von GitHub..." -ForegroundColor Gray
|
||||
$asset = Get-GitHub-Latest-Asset -Repo $Repo -Filter "*Setup*.exe"
|
||||
if ($asset) {
|
||||
$installer = "$tempDir\$($asset.name)"
|
||||
if (Download-File -Url $asset.browser_download_url -Output $installer) {
|
||||
Write-Host " Installiere $Name (silent)..." -ForegroundColor Gray
|
||||
Start-Process -FilePath $installer -ArgumentList "/S" -Wait
|
||||
if ($ProcessName) {
|
||||
Start-Sleep -Seconds 3
|
||||
Stop-Process -Name $ProcessName -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Write-Host " $Name installiert!" -ForegroundColor Green
|
||||
}
|
||||
} else {
|
||||
Write-Host " FEHLER: Kein Setup-Asset im GitHub-Release gefunden" -ForegroundColor Red
|
||||
}
|
||||
} catch {
|
||||
Write-Host " FEHLER beim Abrufen des GitHub-Releases: $_" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
function Copy-GitHub-DataFile-To-Desktop {
|
||||
param($Repo, $Filter)
|
||||
try {
|
||||
$asset = Get-GitHub-Latest-Asset -Repo $Repo -Filter $Filter
|
||||
if (-not $asset) {
|
||||
Write-Host " WARNUNG: Kein Asset '$Filter' im GitHub-Release gefunden" -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
$destPath = Join-Path $desktopPath $asset.name
|
||||
if (Test-Path $destPath) {
|
||||
Write-Host " $($asset.name) bereits vorhanden - ueberspringe." -ForegroundColor Gray
|
||||
return
|
||||
}
|
||||
if (Download-File -Url $asset.browser_download_url -Output $destPath) {
|
||||
Write-Host " $($asset.name) auf Desktop!" -ForegroundColor Green
|
||||
}
|
||||
} catch {
|
||||
Write-Host " FEHLER beim Laden der GitHub-Datei: $_" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
|
||||
# 1. PYTHON
|
||||
Write-Host ""
|
||||
Write-Host "[1/$totalSteps] Python..." -ForegroundColor Yellow
|
||||
@@ -176,7 +248,7 @@ if (Test-Path "$desktopPath\G-Earth") {
|
||||
} else {
|
||||
try {
|
||||
Write-Host " Hole neueste Version von Gitea..." -ForegroundColor Gray
|
||||
$releaseApi = "https://git.24-music.de/api/v1/repos/Administrator/G-Earth/releases?limit=1"
|
||||
$releaseApi = "$giteaBaseUrl/api/v1/repos/Administrator/G-Earth/releases?limit=1"
|
||||
$wc = New-Object System.Net.WebClient
|
||||
$wc.Headers.Add("User-Agent", "Mozilla/5.0")
|
||||
$release = ($wc.DownloadString($releaseApi) | ConvertFrom-Json)
|
||||
@@ -470,12 +542,12 @@ Install-Gitea-App -Name "Multi-Hoster-Upload" -Repo "Multi-Hoster-Upload" `
|
||||
-ProcessName "Multi-Hoster-Upload"
|
||||
Copy-Gitea-DataFile-To-Desktop -Repo "Multi-Hoster-Upload" -Filter "*.mhu"
|
||||
|
||||
# 17. REAL-DEBRID-DOWNLOADER (von Gitea)
|
||||
Install-Gitea-App -Name "Real-Debrid-Downloader" -Repo "real-debrid-downloader" `
|
||||
# 17. REAL-DEBRID-DOWNLOADER (von GitHub)
|
||||
Install-GitHub-App -Name "Real-Debrid-Downloader" -Repo $githubDownloaderRepo `
|
||||
-StepNum 17 `
|
||||
-DetectPaths @("$env:LOCALAPPDATA\Programs\real-debrid-downloader\Real-Debrid-Downloader.exe", "$desktopPath\Real-Debrid-Downloader.lnk") `
|
||||
-ProcessName "Real-Debrid-Downloader"
|
||||
Copy-Gitea-DataFile-To-Desktop -Repo "real-debrid-downloader" -Filter "*.mdd"
|
||||
Copy-GitHub-DataFile-To-Desktop -Repo $githubDownloaderRepo -Filter "*.mdd"
|
||||
|
||||
# 18. WINDOWS EINSTELLUNGEN
|
||||
Write-Host ""
|
||||
|
||||
Reference in New Issue
Block a user