mirror of
https://github.com/mrpond/BlockTheSpot.git
synced 2025-05-10 18:06:39 +02:00
Updated installation script (#445)
* updated install script * updated readme * added uninstall * no backups
This commit is contained in:
parent
aa87773aa1
commit
71391d8ec3
5 changed files with 314 additions and 129 deletions
4
BlockTheSpot.bat
Normal file
4
BlockTheSpot.bat
Normal file
|
@ -0,0 +1,4 @@
|
|||
@echo off
|
||||
powershell -Command "& {[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-WebRequest -UseBasicParsing https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1' | Invoke-Expression}"
|
||||
pause
|
||||
exit /b
|
59
README.md
59
README.md
|
@ -1,25 +1,58 @@
|
|||
[](https://ci.appveyor.com/project/mrpond/blockthespot/branch/master) [](https://discord.gg/p43cusgUPm)
|
||||
[](https://ci.appveyor.com/project/mrpond/blockthespot/branch/master) [](https://discord.gg/p43cusgUPm)
|
||||
|
||||
<center>
|
||||
<h1 align="center">BlockTheSpot</h1>
|
||||
<h4 align="center">A multi-purpose adblocker and skip-bypass for the <strong>Windows</strong> Spotify desktop application.</h4>
|
||||
<h5 align="center">Please support Spotify by purchasing premium</h5>
|
||||
<p align="center">
|
||||
<strong>Last updated:</strong> 01 April 2023<br>
|
||||
<strong>Last tested version:</strong> 1.2.8.923.g4f94bf0d
|
||||
</p>
|
||||
</center>
|
||||
|
||||
## BlockTheSpot is back!
|
||||
### Features:
|
||||
* Unlocks all premium features except downloads.
|
||||
* Lives through Spotify updates. No need to patch Spotify after every update anymore.
|
||||
|
||||
Doing things without modify xpui.spa, you don't need to running any .bat/powershell script!!
|
||||
#### Experimental features from developer mode
|
||||
- Click on the 2 dots in the top left corner of Spotify > Develop > Show debug window. Play around with the options.
|
||||
- Enable/disable feature by yourself in realtime and on demand.
|
||||
- Choose old/new theme(YLX).
|
||||
- Enable right sidebar.
|
||||
- Hide upgrade button on top bar.
|
||||
|
||||
Since BlockTheSpot will modify them (in memory) on the fly!!
|
||||
:warning: This mod is for the [**Desktop Application**](https://www.spotify.com/download/windows/) of Spotify on Windows only and **not the Microsoft Store version**.
|
||||
|
||||
A multi-purpose adblocker and skip-bypass for the Windows Spotify desktop application
|
||||
### Installation/Update:
|
||||
* Just download and run [BlockTheSpot.bat](https://raw.githack.com/mrpond/BlockTheSpot/master/BlockTheSpot.bat)
|
||||
|
||||
Please support Spotify by purchasing premium
|
||||
or
|
||||
|
||||
#### Just copy dpapi.dll and config.ini into spotify installation folder.
|
||||
#### Fully automated installation via PowerShell
|
||||
|
||||
### Killer feature built-in developer mode [Develop->Show Debug Window]
|
||||
- enable/disable feature by yourself in realtime and on demand
|
||||
- choose old/new theme(YLX)
|
||||
- enable right sidebar
|
||||
- default hide upgrade button on top bar
|
||||
```powershell
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; Invoke-Expression "& { $(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1') } -UninstallSpotifyStoreEdition -UpdateSpotify"
|
||||
```
|
||||
|
||||
#### Manual installation
|
||||
|
||||
1. Browse to your Spotify installation folder `%APPDATA%\Spotify`
|
||||
2. Rename `dpapi.dll` to `dpapi_bak.dll`. The naming is important.
|
||||
3. Download `chrome_elf.zip` from [releases](https://github.com/mrpond/BlockTheSpot/releases)
|
||||
4. Unzip `dpapi.dll` and `config.ini` to Spotify directory.
|
||||
|
||||
### Uninstall:
|
||||
* Just run [uninstall.bat](https://raw.githack.com/mrpond/BlockTheSpot/master/uninstall.bat)
|
||||
or
|
||||
* Reinstall Spotify
|
||||
|
||||
### Additional Notes:
|
||||
|
||||
* Installation script automatically detects if your Spotify client version is supported, or not. If the version is not supported, you will be prompted to update your Spotify client. To enforce client update, supply an optional parameter `UpdateSpotify` to the installation script.
|
||||
* [Spicetify](https://github.com/khanhas/spicetify-cli) users will need to reapply BlockTheSpot after applying a Spicetify themes/patches.
|
||||
* If the automatic install/uninstall scripts do not work, please contact [Nuzair46](https://github.com/Nuzair46).
|
||||
* For more support and discussions, join our [Discord server](https://discord.gg/p43cusgUPm).
|
||||
|
||||
and much more...
|
||||
|
||||
|
||||
|
||||
|
|
253
install.ps1
Normal file
253
install.ps1
Normal file
|
@ -0,0 +1,253 @@
|
|||
param (
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$UninstallSpotifyStoreEdition = (Read-Host -Prompt 'Uninstall Spotify Windows Store edition if it exists (Y/N)') -eq 'y',
|
||||
[Parameter()]
|
||||
[switch]
|
||||
$UpdateSpotify
|
||||
)
|
||||
|
||||
# Ignore errors from `Stop-Process`
|
||||
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
|
||||
|
||||
[System.Version] $minimalSupportedSpotifyVersion = '1.2.8.923'
|
||||
|
||||
function Get-File
|
||||
{
|
||||
param (
|
||||
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[System.Uri]
|
||||
$Uri,
|
||||
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[System.IO.FileInfo]
|
||||
$TargetFile,
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[Int32]
|
||||
$BufferSize = 1,
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateSet('KB, MB')]
|
||||
[String]
|
||||
$BufferUnit = 'MB',
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ValidateSet('KB, MB')]
|
||||
[Int32]
|
||||
$Timeout = 10000
|
||||
)
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$useBitTransfer = $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and ($PSVersionTable.PSVersion.Major -le 5) -and ((Get-Service -Name BITS).StartType -ne [System.ServiceProcess.ServiceStartMode]::Disabled)
|
||||
|
||||
if ($useBitTransfer)
|
||||
{
|
||||
Write-Information -MessageData 'Using a fallback BitTransfer method since you are running Windows PowerShell'
|
||||
Start-BitsTransfer -Source $Uri -Destination "$($TargetFile.FullName)"
|
||||
}
|
||||
else
|
||||
{
|
||||
$request = [System.Net.HttpWebRequest]::Create($Uri)
|
||||
$request.set_Timeout($Timeout) #15 second timeout
|
||||
$response = $request.GetResponse()
|
||||
$totalLength = [System.Math]::Floor($response.get_ContentLength() / 1024)
|
||||
$responseStream = $response.GetResponseStream()
|
||||
$targetStream = New-Object -TypeName ([System.IO.FileStream]) -ArgumentList "$($TargetFile.FullName)", Create
|
||||
switch ($BufferUnit)
|
||||
{
|
||||
'KB' { $BufferSize = $BufferSize * 1024 }
|
||||
'MB' { $BufferSize = $BufferSize * 1024 * 1024 }
|
||||
Default { $BufferSize = 1024 * 1024 }
|
||||
}
|
||||
Write-Verbose -Message "Buffer size: $BufferSize B ($($BufferSize/("1$BufferUnit")) $BufferUnit)"
|
||||
$buffer = New-Object byte[] $BufferSize
|
||||
$count = $responseStream.Read($buffer, 0, $buffer.length)
|
||||
$downloadedBytes = $count
|
||||
$downloadedFileName = $Uri -split '/' | Select-Object -Last 1
|
||||
while ($count -gt 0)
|
||||
{
|
||||
$targetStream.Write($buffer, 0, $count)
|
||||
$count = $responseStream.Read($buffer, 0, $buffer.length)
|
||||
$downloadedBytes = $downloadedBytes + $count
|
||||
Write-Progress -Activity "Downloading file '$downloadedFileName'" -Status "Downloaded ($([System.Math]::Floor($downloadedBytes/1024))K of $($totalLength)K): " -PercentComplete ((([System.Math]::Floor($downloadedBytes / 1024)) / $totalLength) * 100)
|
||||
}
|
||||
|
||||
Write-Progress -Activity "Finished downloading file '$downloadedFileName'"
|
||||
|
||||
$targetStream.Flush()
|
||||
$targetStream.Close()
|
||||
$targetStream.Dispose()
|
||||
$responseStream.Dispose()
|
||||
}
|
||||
}
|
||||
|
||||
function Test-SpotifyVersion
|
||||
{
|
||||
param (
|
||||
[Parameter(Mandatory, ValueFromPipelineByPropertyName)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[System.Version]
|
||||
$MinimalSupportedVersion,
|
||||
[Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)]
|
||||
[System.Version]
|
||||
$TestedVersion
|
||||
)
|
||||
|
||||
process
|
||||
{
|
||||
return ($MinimalSupportedVersion.CompareTo($TestedVersion) -le 0)
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host @'
|
||||
**********************************
|
||||
Authors: @Nuzair46, @KUTlime
|
||||
**********************************
|
||||
'@
|
||||
|
||||
$spotifyDirectory = Join-Path -Path $env:APPDATA -ChildPath 'Spotify'
|
||||
$spotifyExecutable = Join-Path -Path $spotifyDirectory -ChildPath 'Spotify.exe'
|
||||
$spotifyApps = Join-Path -Path $spotifyDirectory -ChildPath 'Apps'
|
||||
|
||||
[System.Version] $actualSpotifyClientVersion = (Get-ChildItem -LiteralPath $spotifyExecutable -ErrorAction:SilentlyContinue).VersionInfo.ProductVersionRaw
|
||||
|
||||
Write-Host "Stopping Spotify...`n"
|
||||
Stop-Process -Name Spotify
|
||||
Stop-Process -Name SpotifyWebHelper
|
||||
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7)
|
||||
{
|
||||
Import-Module Appx -UseWindowsPowerShell -WarningAction:SilentlyContinue
|
||||
}
|
||||
|
||||
if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic)
|
||||
{
|
||||
Write-Host "The Microsoft Store version of Spotify has been detected which is not supported.`n"
|
||||
|
||||
if ($UninstallSpotifyStoreEdition)
|
||||
{
|
||||
Write-Host "Uninstalling Spotify.`n"
|
||||
Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
|
||||
}
|
||||
else
|
||||
{
|
||||
Read-Host "Exiting...`nPress any key to exit..."
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location -LiteralPath $env:TEMP
|
||||
try
|
||||
{
|
||||
# Unique directory name based on time
|
||||
New-Item -Type Directory -Name "BlockTheSpot-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" |
|
||||
Convert-Path |
|
||||
Set-Location
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Output $_
|
||||
Read-Host 'Press any key to exit...'
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host "Downloading latest patch (chrome_elf.zip)...`n"
|
||||
$elfPath = Join-Path -Path $PWD -ChildPath 'chrome_elf.zip'
|
||||
try
|
||||
{
|
||||
$uri = 'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip'
|
||||
Get-File -Uri $uri -TargetFile "$elfPath"
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Output $_
|
||||
Start-Sleep
|
||||
}
|
||||
|
||||
Expand-Archive -Force -LiteralPath "$elfPath" -DestinationPath $PWD
|
||||
Remove-Item -LiteralPath "$elfPath" -Force
|
||||
|
||||
$spotifyInstalled = Test-Path -LiteralPath $spotifyExecutable
|
||||
$unsupportedClientVersion = ($actualSpotifyClientVersion | Test-SpotifyVersion -MinimalSupportedVersion $minimalSupportedSpotifyVersion) -eq $false
|
||||
|
||||
if (-not $UpdateSpotify -and $unsupportedClientVersion)
|
||||
{
|
||||
if ((Read-Host -Prompt 'In order to install Block the Spot, your Spotify client must be updated. Do you want to continue? (Y/N)') -ne 'y')
|
||||
{
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $spotifyInstalled -or $UpdateSpotify -or $unsupportedClientVersion)
|
||||
{
|
||||
Write-Host 'Downloading the latest Spotify full setup, please wait...'
|
||||
$spotifySetupFilePath = Join-Path -Path $PWD -ChildPath 'SpotifyFullSetup.exe'
|
||||
try
|
||||
{
|
||||
$uri = 'https://download.scdn.co/SpotifyFullSetup.exe'
|
||||
Get-File -Uri $uri -TargetFile "$spotifySetupFilePath"
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Output $_
|
||||
Read-Host 'Press any key to exit...'
|
||||
exit
|
||||
}
|
||||
New-Item -Path $spotifyDirectory -ItemType:Directory -Force | Write-Verbose
|
||||
|
||||
[System.Security.Principal.WindowsPrincipal] $principal = [System.Security.Principal.WindowsIdentity]::GetCurrent()
|
||||
$isUserAdmin = $principal.IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
|
||||
Write-Host 'Running installation...'
|
||||
if ($isUserAdmin)
|
||||
{
|
||||
Write-Host
|
||||
Write-Host 'Creating scheduled task...'
|
||||
$apppath = 'powershell.exe'
|
||||
$taskname = 'Spotify install'
|
||||
$action = New-ScheduledTaskAction -Execute $apppath -Argument "-NoLogo -NoProfile -Command & `'$spotifySetupFilePath`'"
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date)
|
||||
$settings = New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -WakeToRun
|
||||
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName $taskname -Settings $settings -Force | Write-Verbose
|
||||
Write-Host 'The install task has been scheduled. Starting the task...'
|
||||
Start-ScheduledTask -TaskName $taskname
|
||||
Start-Sleep -Seconds 2
|
||||
Write-Host 'Unregistering the task...'
|
||||
Unregister-ScheduledTask -TaskName $taskname -Confirm:$false
|
||||
Start-Sleep -Seconds 2
|
||||
}
|
||||
else
|
||||
{
|
||||
Start-Process -FilePath "$spotifySetupFilePath"
|
||||
}
|
||||
|
||||
while ($null -eq (Get-Process -Name Spotify -ErrorAction SilentlyContinue))
|
||||
{
|
||||
# Waiting until installation complete
|
||||
Start-Sleep -Milliseconds 100
|
||||
}
|
||||
|
||||
|
||||
Write-Host 'Stopping Spotify...Again'
|
||||
|
||||
Stop-Process -Name Spotify
|
||||
Stop-Process -Name SpotifyWebHelper
|
||||
Stop-Process -Name SpotifyFullSetup
|
||||
}
|
||||
|
||||
Write-Host 'Patching Spotify...'
|
||||
$patchFiles = (Join-Path -Path $PWD -ChildPath 'dpapi.dll'), (Join-Path -Path $PWD -ChildPath 'config.ini')
|
||||
|
||||
Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
|
||||
|
||||
$tempDirectory = $PWD
|
||||
Pop-Location
|
||||
|
||||
Remove-Item -LiteralPath $tempDirectory -Recurse
|
||||
|
||||
Write-Host 'Patching Complete, starting Spotify...'
|
||||
|
||||
Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable
|
||||
Write-Host 'Done.'
|
116
simple.bat
116
simple.bat
|
@ -1,116 +0,0 @@
|
|||
;;;===,,,@echo off
|
||||
;;;===,,,findstr /v "^;;;===,,," "%~f0" > "%~dp0ps.ps1"
|
||||
;;;===,,,PowerShell.exe -ExecutionPolicy Bypass -Command "& '%~dp0ps.ps1'"
|
||||
;;;===,,,del /s /q "%~dp0ps.ps1" >NUL 2>&1
|
||||
;;;===,,,pause
|
||||
# Ignore errors from `Stop-Process`
|
||||
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = 'SilentlyContinue'
|
||||
|
||||
write-host @'
|
||||
*****************
|
||||
Author: @rednek46
|
||||
*****************
|
||||
'@
|
||||
|
||||
$SpotifyDirectory = "$env:APPDATA\Spotify"
|
||||
$SpotifyExecutable = "$SpotifyDirectory\Spotify.exe"
|
||||
|
||||
Write-Host 'Stopping Spotify...'`n
|
||||
Stop-Process -Name Spotify
|
||||
Stop-Process -Name SpotifyWebHelper
|
||||
|
||||
if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) {
|
||||
Write-Host @'
|
||||
The Microsoft Store version of Spotify has been detected which is not supported.
|
||||
'@`n
|
||||
$ch = Read-Host -Prompt "Uninstall Spotify Windows Store edition (Y/N) "
|
||||
if ($ch -eq 'y'){
|
||||
Write-Host @'
|
||||
Uninstalling Spotify.
|
||||
'@`n
|
||||
Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
|
||||
} else{
|
||||
Write-Host @'
|
||||
Exiting...
|
||||
'@`n
|
||||
Pause
|
||||
exit
|
||||
}
|
||||
}
|
||||
|
||||
Push-Location -LiteralPath $env:TEMP
|
||||
try {
|
||||
# Unique directory name based on time
|
||||
New-Item -Type Directory -Name "BlockTheSpot-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" `
|
||||
| Convert-Path `
|
||||
| Set-Location
|
||||
} catch {
|
||||
Write-Output $_
|
||||
Pause
|
||||
exit
|
||||
}
|
||||
|
||||
Write-Host 'Downloading latest patch (chrome_elf.zip)...'`n
|
||||
$webClient = New-Object -TypeName System.Net.WebClient
|
||||
try {
|
||||
$webClient.DownloadFile(
|
||||
# Remote file URL
|
||||
'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip',
|
||||
# Local file path
|
||||
"$PWD\chrome_elf.zip"
|
||||
)
|
||||
} catch {
|
||||
Write-Output $_
|
||||
Sleep
|
||||
}
|
||||
Expand-Archive -Force -LiteralPath "$PWD\chrome_elf.zip" -DestinationPath $PWD
|
||||
Remove-Item -LiteralPath "$PWD\chrome_elf.zip"
|
||||
|
||||
$spotifyInstalled = (Test-Path -LiteralPath $SpotifyExecutable)
|
||||
if (-not $spotifyInstalled) {
|
||||
Write-Host @'
|
||||
Spotify installation was not detected.
|
||||
Downloading Latest Spotify full setup, please wait...
|
||||
'@
|
||||
try {
|
||||
$webClient.DownloadFile(
|
||||
# Remote file URL
|
||||
'https://download.scdn.co/SpotifyFullSetup.exe',
|
||||
# Local file path
|
||||
"$PWD\SpotifyFullSetup.exe"
|
||||
)
|
||||
} catch {
|
||||
Write-Output $_
|
||||
Pause
|
||||
exit
|
||||
}
|
||||
mkdir $SpotifyDirectory >$null 2>&1
|
||||
Write-Host 'Running installation...'
|
||||
Start-Process -FilePath "$PWD\SpotifyFullSetup.exe"
|
||||
Write-Host 'Stopping Spotify...Again'
|
||||
while ((Get-Process -name Spotify -ErrorAction SilentlyContinue) -eq $null){
|
||||
#waiting until installation complete
|
||||
}
|
||||
Stop-Process -Name Spotify >$null 2>&1
|
||||
Stop-Process -Name SpotifyWebHelper >$null 2>&1
|
||||
Stop-Process -Name SpotifyFullSetup >$null 2>&1
|
||||
}
|
||||
|
||||
#if (!(test-path $SpotifyDirectory/chrome_elf.dll.bak)){
|
||||
# move $SpotifyDirectory\chrome_elf.dll $SpotifyDirectory\chrome_elf.dll.bak >$null 2>&1
|
||||
#}
|
||||
|
||||
Write-Host 'Patching Spotify...'
|
||||
$patchFiles = "$PWD\dpapi.dll", "$PWD\config.ini"
|
||||
Copy-Item -LiteralPath $patchFiles -Destination "$SpotifyDirectory"
|
||||
|
||||
$tempDirectory = $PWD
|
||||
Pop-Location
|
||||
|
||||
Remove-Item -Recurse -LiteralPath $tempDirectory
|
||||
|
||||
Write-Host 'Patching Complete, starting Spotify...'
|
||||
Start-Process -WorkingDirectory $SpotifyDirectory -FilePath $SpotifyExecutable
|
||||
Write-Host 'Done.'
|
||||
|
||||
exit
|
11
uninstall.bat
Normal file
11
uninstall.bat
Normal file
|
@ -0,0 +1,11 @@
|
|||
@echo off
|
||||
echo *****************
|
||||
echo Author: @rednek46
|
||||
echo *****************
|
||||
echo Removing Patch
|
||||
if exist "%APPDATA%\Spotify\dpapi.dll" (
|
||||
del /s /q "%APPDATA%\Spotify\dpapi.dll" > NUL 2>&1
|
||||
) else (
|
||||
echo done
|
||||
)
|
||||
pause
|
Loading…
Add table
Add a link
Reference in a new issue