From a32f1a89fe8312af832c4b38cc4e2929469066d9 Mon Sep 17 00:00:00 2001 From: amd64fox Date: Thu, 21 Jul 2022 20:13:39 +0300 Subject: [PATCH] Update - up 1.1.90.859 - improved algorithm for restoring files when refusing to re-block updates --- Install.ps1 | 19 ++++++++++++++++++- README.md | 34 +++++++++++++++++----------------- 2 files changed, 35 insertions(+), 18 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index db7653f..b0d8e3e 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -325,6 +325,7 @@ catch { $spotifyDirectory = "$env:APPDATA\Spotify" $spotifyDirectory2 = "$env:LOCALAPPDATA\Spotify" $spotifyExecutable = "$spotifyDirectory\Spotify.exe" +$exe_bak = "$spotifyDirectory\Spotify.bak" $chrome_elf = "$spotifyDirectory\chrome_elf.dll" $chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll" $cache_folder = "$env:APPDATA\Spotify\cache" @@ -361,6 +362,11 @@ function Check_verison_clients($param2) { $check_offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion return $check_offline } + # Check version Spotify.bak + if ($param2 -eq "Spotify.bak") { + $check_offline_bak = (Get-Item $exe_bak).VersionInfo.FileVersion + return $check_offline_bak + } } function unlockFolder { @@ -814,6 +820,16 @@ if (!($block_update_on) -and !($block_update_off)) { } if ($ch -eq 'y') { $block_update = $true } +if ($ch -eq 'n') { + $ErrorActionPreference = 'SilentlyContinue' + $exe_onl_fn = Check_verison_clients -param2 "offline" + $exe_bak_fn = Check_verison_clients -param2 'Spotify.bak' + if ((Test-Path -LiteralPath $exe_bak) -and $exe_onl_fn -eq $exe_bak_fn) { + Remove-Item $spotifyExecutable -Recurse -Force + Rename-Item $exe_bak $spotifyExecutable + } +} + $ch = $null if ($cache_on) { @@ -1460,7 +1476,6 @@ if ($block_update) { if ($update_test_exe) { $exe = "$env:APPDATA\Spotify\Spotify.exe" - $exe_bak = "$env:APPDATA\Spotify\Spotify.bak" $ANSI = [Text.Encoding]::GetEncoding(1251) $old = [IO.File]::ReadAllText($exe, $ANSI) @@ -1468,6 +1483,8 @@ if ($block_update) { Write-Host ($lang).UpdateBlocked`n } elseif ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") { + Remove-Item $exe_bak -Recurse -Force + Start-Sleep -Milliseconds 150 copy-Item $exe $exe_bak $new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update' [IO.File]::WriteAllText($exe, $new, $ANSI) diff --git a/README.md b/README.md index d9488db..aca696d 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@

System requirements

- OS: Windows 7-11 -- Spotify: Recommended official version [1.1.90.855](https://cutt.ly/8EH6NuH) +- Spotify: Recommended official version [1.1.90.859](https://cutt.ly/8EH6NuH) - For Windows Desktop only (Microsoft store version is not suitable). - PowerShell: 3 or higher @@ -42,17 +42,17 @@
Usual installation

-

During installation, you need to confirm some actions, also contains:

+ #### During installation, you need to confirm some actions, also contains: - All [experimental features](https://github.com/amd64fox/SpotX/discussions/50) included

-* Just download and run [Install.bat](https://raw.githack.com/amd64fox/SpotX/main/Install.bat) +#### Just download and run [Install.bat](https://raw.githack.com/amd64fox/SpotX/main/Install.bat) or -- Run The following command in PowerShell: +#### Run The following command in PowerShell: ```ps1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content | iex @@ -63,7 +63,7 @@ or
Automated basic installation

-

Automated basic installation without confirmation, what does it do?

+ #### Automated basic installation without confirmation, what does it do? - Automatic removal of Spotify MS if it was found - Automatic installation of the recommended version of Spotify (if another client has already been found, it will be installed over) @@ -71,11 +71,11 @@ or

-- Just download and run [Install_Basic.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Basic.bat) +#### Just download and run [Install_Basic.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Basic.bat) or -- Run The following command in PowerShell: +#### Run The following command in PowerShell: ```ps1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $((iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content) } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_on -cache_off -block_update_off -exp_standart -hide_col_icon_off -start_spoti" @@ -97,11 +97,11 @@ or

-- Just download and run [Install_Auto.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Auto.bat) +#### Just download and run [Install_Auto.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Auto.bat) or -- Run The following command in PowerShell: +#### Run The following command in PowerShell: ```ps1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $((iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content) } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -cache_off -block_update_on -start_spoti" @@ -111,7 +111,7 @@ or
Installing with Scoop

-

Installing SpotX via the Scoop package manager includes:

+ #### Installing SpotX via the Scoop package manager includes: - Automatic removal of Spotify MS if it was found - Automatic installation of the recommended version of Spotify (if another client has already been found, it will be installed over) @@ -121,19 +121,19 @@ or

-

Installing SpotX with Scoop

+#### Installing SpotX with Scoop Just run these commands in the command prompt or powershell: - +

```scoop bucket add nonportable```
```scoop install spotx-np``` -

Updating SpotX with Scoop

+#### Updating SpotX with Scoop To update SpotX or check for updates run this command in the command prompt or powershell: ```scoop update spotx-np``` -

Uninstalling SpotX with Scoop

+#### Uninstalling SpotX with Scoop To fully uninstall SpotX and Spotify run this command in the command prompt or powershell: @@ -144,17 +144,17 @@ To fully uninstall SpotX and Spotify run this command in the command prompt or p
Installation for premium

-

Usual installation only without ad blocking, for those who have a premium account, also contains:

+ #### Usual installation only without ad blocking, for those who have a premium account, also contains: - All [experimental features](https://github.com/amd64fox/SpotX/discussions/50) included

-* Just download and run [Install_Prem.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Prem.bat) +#### Just download and run [Install_Prem.bat](https://raw.githack.com/amd64fox/SpotX/main/scripts/Install_Prem.bat) or -- Run The following command in PowerShell: +#### Run The following command in PowerShell: ```ps1 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $((iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content) } -premium"