mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-04-11 17:37:21 +10:00
BIN
res/login.spa
Normal file
BIN
res/login.spa
Normal file
Binary file not shown.
37
run.ps1
37
run.ps1
@@ -388,31 +388,42 @@ $online = ($onlineFull -split ".g")[0]
|
|||||||
|
|
||||||
function Get {
|
function Get {
|
||||||
param (
|
param (
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
[string]$Url,
|
[string]$Url,
|
||||||
[int]$MaxRetries = 3,
|
[int]$MaxRetries = 3,
|
||||||
[int]$RetrySeconds = 3
|
[int]$RetrySeconds = 3,
|
||||||
|
[string]$OutputPath
|
||||||
)
|
)
|
||||||
|
|
||||||
$retries = 0
|
$params = @{
|
||||||
|
Uri = $Url
|
||||||
|
TimeoutSec = 15
|
||||||
|
}
|
||||||
|
|
||||||
while ($retries -lt $MaxRetries) {
|
if ($OutputPath) {
|
||||||
|
$params['OutFile'] = $OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
for ($i = 0; $i -lt $MaxRetries; $i++) {
|
||||||
try {
|
try {
|
||||||
return Invoke-RestMethod -Uri $Url
|
$response = Invoke-RestMethod @params
|
||||||
|
return $response
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Warning "Request failed: $_"
|
Write-Warning "Attempt $($i+1) of $MaxRetries failed: $_"
|
||||||
$retries++
|
if ($i -lt $MaxRetries - 1) {
|
||||||
Start-Sleep -Seconds $RetrySeconds
|
Start-Sleep -Seconds $RetrySeconds
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host
|
Write-Host
|
||||||
Write-Host "ERROR: " -ForegroundColor Red -NoNewline; Write-Host "Failed to retrieve data from $Url" -ForegroundColor White
|
Write-Host "ERROR: " -ForegroundColor Red -NoNewline; Write-Host "Failed to retrieve data from $Url" -ForegroundColor White
|
||||||
Write-Host
|
Write-Host
|
||||||
|
|
||||||
return $null
|
return $null
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function incorrectValue {
|
function incorrectValue {
|
||||||
|
|
||||||
Write-Host ($lang).Incorrect"" -ForegroundColor Red -NoNewline
|
Write-Host ($lang).Incorrect"" -ForegroundColor Red -NoNewline
|
||||||
@@ -1807,6 +1818,12 @@ if ($rexex1 -and $rexex2 -and $rexex3) {
|
|||||||
# Binary patch
|
# Binary patch
|
||||||
extract -counts 'exe' -helper 'Binary'
|
extract -counts 'exe' -helper 'Binary'
|
||||||
|
|
||||||
|
# fix login for old versions
|
||||||
|
if ([version]$offline -ge [version]"1.1.87.612" -and [version]$offline -le [version]"1.2.5.1006") {
|
||||||
|
$login_spa = Join-Path (Join-Path $env:APPDATA 'Spotify\Apps') 'login.spa'
|
||||||
|
Get -Url (Get-Link -e "/res/login.spa") -OutputPath $login_spa
|
||||||
|
}
|
||||||
|
|
||||||
# Start Spotify
|
# Start Spotify
|
||||||
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }
|
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user