Skip to content

Commit

Permalink
[skip ci] Merge pull request #107 from rednek46/master
Browse files Browse the repository at this point in the history
[skip ci] Added optional - Remove upgrade button.
  • Loading branch information
Nuzair46 authored Jan 5, 2021
2 parents 2fd081a + deb25a4 commit 2646584
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
24 changes: 24 additions & 0 deletions BlockTheSpot.bat
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Author: @rednek46

$SpotifyDirectory = "$env:APPDATA\Spotify"
$SpotifyExecutable = "$SpotifyDirectory\Spotify.exe"
$SpotifyApps = "$SpotifyDirectory\Apps"

Write-Host 'Stopping Spotify...'`n
Stop-Process -Name Spotify
Expand Down Expand Up @@ -71,8 +72,21 @@ try {
Write-Output $_
Sleep
}
try {
$webClient.DownloadFile(
# Remote file URL
'https://github.com/mrpond/BlockTheSpot/files/5767943/zlink.zip',
# Local file path
"$PWD\zlink.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"

$spotifyInstalled = (Test-Path -LiteralPath $SpotifyExecutable)
if (-not $spotifyInstalled) {
Expand Down Expand Up @@ -110,8 +124,18 @@ if (!(test-path $SpotifyDirectory/chrome_elf.dll.bak)){

Write-Host 'Patching Spotify...'
$patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini"
$remup = "$PWD\zlink.spa"
Copy-Item -LiteralPath $patchFiles -Destination "$SpotifyDirectory"

$ch = Read-Host -Prompt "Optional - Remove Upgrade Button. (Y/N) "
if ($ch -eq 'y'){
move $SpotifyApps\zlink.spa $SpotifyApps\zlink.spa.bak >$null 2>&1
Copy-Item -LiteralPath $remup -Destination "$SpotifyApps"
} else{
Write-Host @'
Won't remove Upgrade Button.
'@`n
}
$tempDirectory = $PWD
Pop-Location

Expand Down
2 changes: 2 additions & 0 deletions uninstall.bat
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,7 @@ 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
pause

0 comments on commit 2646584

Please sign in to comment.