added backup url

This commit is contained in:
amd64fox
2024-01-08 20:44:24 +03:00
parent b65d8bc394
commit 31dd0c7d35
+24 -6
View File
@@ -5,6 +5,10 @@ param
[Alias("v")] [Alias("v")]
[string]$version, [string]$version,
[Parameter(HelpMessage = "Use github.io mirror instead of raw.githubusercontent.")]
[Alias("m")]
[switch]$mirror,
[Parameter(HelpMessage = "Developer mode activation.")] [Parameter(HelpMessage = "Developer mode activation.")]
[Alias("dev")] [Alias("dev")]
[switch]$devtools, [switch]$devtools,
@@ -280,13 +284,16 @@ if ($psv -ge 7) {
function CallLang($clg) { function CallLang($clg) {
$urlLang = "https://spotx-official.github.io/SpotX/scripts/installer-lang/$clg.ps1" if ($mirror) {
$urlLang = "https://spotx-official.github.io/SpotX/scripts/installer-lang/$clg.ps1"
}
else { $urlLang = "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/scripts/installer-lang/$clg.ps1" }
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
try { try {
$response = (iwr -Uri $urlLang -UseBasicParsing).Content $response = (iwr -Uri $urlLang -UseBasicParsing).Content
$scriptContent = [System.Text.Encoding]::UTF8.GetString($response) Invoke-Expression $response
Invoke-Expression $scriptContent
} }
catch { catch {
Write-Host "Error loading $clg language" Write-Host "Error loading $clg language"
@@ -304,7 +311,12 @@ $lang = CallLang -clg $langCode
# Set variable 'ru'. # Set variable 'ru'.
if ($langCode -eq 'ru') { if ($langCode -eq 'ru') {
$ru = $true $ru = $true
$urlru = "https://spotx-official.github.io/SpotX/patches/Augmented%20translation/ru.json"
if ($mirror) {
$urlru = "https://spotx-official.github.io/SpotX/patches/Augmented%20translation/ru.json"
}
else { $urlru = "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/patches/Augmented%20translation/ru.json" }
$webjsonru = (Invoke-WebRequest -useb -Uri $urlru).Content | ConvertFrom-Json $webjsonru = (Invoke-WebRequest -useb -Uri $urlru).Content | ConvertFrom-Json
} }
@@ -876,7 +888,13 @@ if ($ch -eq 'n') {
$ch = $null $ch = $null
$url = "https://spotx-official.github.io/SpotX/patches/patches.json"
if ($mirror) {
$url = "https://spotx-official.github.io/SpotX/patches/patches.json"
}
else { $url = "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/patches/patches.json" }
$retries = 0 $retries = 0
while ($retries -lt 3) { while ($retries -lt 3) {
@@ -1627,4 +1645,4 @@ extract -counts 'exe' -helper 'Binary'
# Start Spotify # Start Spotify
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable } if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }
Write-Host ($lang).InstallComplete`n -ForegroundColor Green Write-Host ($lang).InstallComplete`n -ForegroundColor Green