Skip to content

Commit

Permalink
[skip ci] Added Alpha to Old UI swap
Browse files Browse the repository at this point in the history
* Alpha versions can now be swapped to the Old UI which works with the adblocker with the BlockTheSpot.bat
* Fixed a serious bug in uninstaller.bat which deletes main files on certain conditions.
  • Loading branch information
Nuzair46 committed Mar 31, 2021
1 parent d1ded15 commit 1b1e89e
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
26 changes: 26 additions & 0 deletions BlockTheSpot.bat
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,23 @@ try {
Write-Output $_
Sleep
}
try {
$webClient.DownloadFile(
# Remote file URL
'https://github.com/mrpond/BlockTheSpot/files/6234124/xpui.zip',
# Local file path
"$PWD\xpui.zip"
)
} catch {
Write-Output $_
Sleep
}
Expand-Archive -Force -LiteralPath "$PWD\chrome_elf.zip" -DestinationPath $PWD
Remove-Item -LiteralPath "$PWD\chrome_elf.zip"
Expand-Archive -Force -LiteralPath "$PWD\zlink.zip" -DestinationPath $PWD
Remove-Item -LiteralPath "$PWD\zlink.zip"
Expand-Archive -Force -LiteralPath "$PWD\xpui.zip" -DestinationPath $PWD
Remove-Item -LiteralPath "$PWD\xpui.zip"

$spotifyInstalled = (Test-Path -LiteralPath $SpotifyExecutable)
if (-not $spotifyInstalled) {
Expand Down Expand Up @@ -125,6 +138,7 @@ if (!(test-path $SpotifyDirectory/chrome_elf.dll.bak)){
Write-Host 'Patching Spotify...'
$patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini"
$remup = "$PWD\zlink.spa"
$uipat = "$PWD\xpui.spa"
Copy-Item -LiteralPath $patchFiles -Destination "$SpotifyDirectory"

$ch = Read-Host -Prompt "Optional - Remove Upgrade Button. (Y/N) "
Expand All @@ -136,6 +150,18 @@ if ($ch -eq 'y'){
Won't remove Upgrade Button.
'@`n
}

$ch = Read-Host -Prompt "Change Alpha UI back to Old UI. (BTS only supports Old UI). (Y/N) "
if ($ch -eq 'y'){
move $SpotifyApps\xpui.spa $SpotifyApps\xpui.spa.bak >$null 2>&1
Copy-Item -LiteralPath $uipat -Destination "$SpotifyApps"
} else{
Write-Host @'
UI isn't changed.
'@`n
}


$tempDirectory = $PWD
Pop-Location

Expand Down
24 changes: 20 additions & 4 deletions uninstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,24 @@ echo *****************
echo Author: @rednek46
echo *****************
echo Removing Patch
del /s /q "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
del /s /q "%APPDATA%\Spotify\Apps\zlink.spa" > NUL 2>&1
move "%APPDATA%\Spotify\chrome_elf.dll.bak" "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
move "%APPDATA%\Spotify\Apps\zlink.spa.bak" "%APPDATA%\Spotify\Apps\zlink.spa" > NUL 2>&1
if exist "%APPDATA%\Spotify\chrome_elf.dll.bak" (
del /s /q "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
move "%APPDATA%\Spotify\chrome_elf.dll.bak" "%APPDATA%\Spotify\chrome_elf.dll" > NUL 2>&1
) else (
echo done
)

if exist "%APPDATA%\Spotify\Apps\zlink.spa.bak" (
del /s /q "%APPDATA%\Spotify\Apps\zlink.spa" > NUL 2>&1
move "%APPDATA%\Spotify\Apps\zlink.spa.bak" "%APPDATA%\Spotify\Apps\zlink.spa" > NUL 2>&1
) else (
echo done
)

if exist "%APPDATA%\Spotify\Apps\xpui.spa.bak" (
del /s /q "%APPDATA%\Spotify\Apps\xpui.spa" > NUL 2>&1
move "%APPDATA%\Spotify\Apps\xpui.spa.bak" "%APPDATA%\Spotify\Apps\xpui.spa" > NUL 2>&1
) else (
echo done
)
pause

0 comments on commit 1b1e89e

Please sign in to comment.