From 785cdb2963ad079a27738fb0a7b5535fec49ff94 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Wed, 26 Apr 2023 21:32:35 +0200 Subject: [PATCH] custom blockthespot installation to use winget instead of .exe from spotify.com --- windows/blockthespot.bat | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/windows/blockthespot.bat b/windows/blockthespot.bat index 55da679..91aec48 100644 --- a/windows/blockthespot.bat +++ b/windows/blockthespot.bat @@ -1,16 +1,32 @@ @ECHO OFF +:: Install latest version of spotify +ECHO Installe la derniere version de spotify +winget install -he Spotify.Spotify + +:: Close spotify +PowerShell -Command "Stop-Process -Name Spotify -ErrorAction SilentlyContinue" + :: Patch spotify -PowerShell -Command "[Net.ServicePointManager]::SecurityProtocol =" ^ - "[Net.SecurityProtocolType]::Tls12; Invoke-Expression """"&" ^ - "{ $(Invoke-WebRequest -UseBasicParsing" ^ - "'https://raw.githubusercontent.com/mrpond/BlockTheSpot/master/install.ps1')" ^ - "} -UninstallSpotifyStoreEdition -UpdateSpotify"""" +ECHO Patch spotify avec BlockTheSpot +PowerShell -Command "cd $HOME;" ^ + "$url_elf = 'https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip';" ^ + "$dest_elf = Join-Path -Path $PWD -ChildPath 'chrome_elf.zip';" ^ + "$spotifyDirectory = Join-Path -Path $env:APPDATA -ChildPath 'Spotify';" ^ + "$spotifyExecutable = Join-Path -Path $spotifyDirectory -ChildPath 'Spotify.exe';" ^ + "Invoke-WebRequest -Uri $url_elf -OutFile $dest_elf;" ^ + "Expand-Archive -Force -LiteralPath $dest_elf -DestinationPath $PWD | Wait-Process;" ^ + "Remove-Item -LiteralPath $dest_elf -Force;" ^ + "$patchFiles = (Join-Path -Path $PWD -ChildPath 'dpapi.dll')," ^ + "(Join-Path -Path $PWD -ChildPath 'config.ini');" ^ + "Copy-Item -LiteralPath $patchFiles -Destination $spotifyDirectory;" ^ + "Remove-Item -LiteralPath $patchFiles;" ^ + "Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable" :: Delete newly created Spotify shortcut -DEL %HOMEPATH%\Desktop\Spotify.lnk +DEL %HOMEPATH%\Desktop\Spotify.lnk 2>NUL ie4uinit -show -ECHO Raccourci sur le bureau detruit +ECHO Suppression du raccourci du bureau PAUSE EXIT /B