Skip to content

Commit

Permalink
login fix for older versions
Browse files Browse the repository at this point in the history
  • Loading branch information
amd64fox committed Sep 17, 2024
1 parent b7dc969 commit 5908ad2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 10 deletions.
Binary file added res/login.spa
Binary file not shown.
37 changes: 27 additions & 10 deletions run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -388,31 +388,42 @@ $online = ($onlineFull -split ".g")[0]

function Get {
param (
[Parameter(Mandatory = $true)]
[string]$Url,
[int]$MaxRetries = 3,
[int]$RetrySeconds = 3
[int]$RetrySeconds = 3,
[string]$OutputPath
)

$retries = 0
$params = @{
Uri = $Url
TimeoutSec = 15
}

if ($OutputPath) {
$params['OutFile'] = $OutputPath
}

while ($retries -lt $MaxRetries) {
for ($i = 0; $i -lt $MaxRetries; $i++) {
try {
return Invoke-RestMethod -Uri $Url
$response = Invoke-RestMethod @params
return $response
}
catch {
Write-Warning "Request failed: $_"
$retries++
Start-Sleep -Seconds $RetrySeconds
Write-Warning "Attempt $($i+1) of $MaxRetries failed: $_"
if ($i -lt $MaxRetries - 1) {
Start-Sleep -Seconds $RetrySeconds
}
}
}

Write-Host
Write-Host "ERROR: " -ForegroundColor Red -NoNewline; Write-Host "Failed to retrieve data from $Url" -ForegroundColor White
Write-Host

Write-Host
return $null

}


function incorrectValue {

Write-Host ($lang).Incorrect"" -ForegroundColor Red -NoNewline
Expand Down Expand Up @@ -1807,6 +1818,12 @@ if ($rexex1 -and $rexex2 -and $rexex3) {
# Binary patch
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
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }

Expand Down

0 comments on commit 5908ad2

Please sign in to comment.