param ( [Parameter(HelpMessage = 'Remove podcasts from homepage.')] [switch]$podcasts_off, [Parameter(HelpMessage = 'Do not remove podcasts from homepage.')] [switch]$podcasts_on, [Parameter(HelpMessage = 'Block Spotify automatic updates.')] [switch]$block_update_on, [Parameter(HelpMessage = 'Do not block Spotify automatic updates.')] [switch]$block_update_off, [Parameter(HelpMessage = 'Enable clear cache.')] [switch]$cache_on, [Parameter(HelpMessage = 'Specify the number of days. Default is 7 days.')] [int16]$number_days = 7, [Parameter(HelpMessage = 'Do not enable cache clearing.')] [switch]$cache_off, [Parameter(HelpMessage = 'Automatic uninstallation of Spotify MS if it was found.')] [switch]$confirm_uninstall_ms_spoti, [Parameter(HelpMessage = 'Overwrite outdated or unsupported version of Spotify with the recommended version.')] [switch]$confirm_spoti_recomended_over, [Parameter(HelpMessage = 'Uninstall outdated or unsupported version of Spotify and install the recommended version.')] [switch]$confirm_spoti_recomended_unistall, [Parameter(HelpMessage = 'Installation without ad blocking for premium accounts.')] [switch]$premium, [Parameter(HelpMessage = 'Automatic launch of Spotify after installation is complete.')] [switch]$start_spoti, [Parameter(HelpMessage = 'Disable all experimental features.')] [switch]$exp_off, [Parameter(HelpMessage = 'Do not hide the icon of collaborations in playlists.')] [switch]$hide_col_icon_off, [Parameter(HelpMessage = 'Do not enable the made for you button on the left sidebar.')] [switch]$made_for_you_off, [Parameter(HelpMessage = 'Do not enable new search.')] [switch]$new_search_off, [Parameter(HelpMessage = 'Do not enable enhance playlist.')] [switch]$enhance_playlist_off, [Parameter(HelpMessage = 'Do not enable enhance liked songs.')] [switch]$enhance_like_off, [Parameter(HelpMessage = 'Do not enable new discography on artist.')] [switch]$new_artist_pages_off, [Parameter(HelpMessage = 'Do not enable new lyrics.')] [switch]$new_lyrics_off, [Parameter(HelpMessage = 'Do not enable exception playlists from recommendations.')] [switch]$ignore_in_recommendations_off, [Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')] [Alias('l')] [string]$Language ) # Ignore errors from `Stop-Process` $PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue function Format-LanguageCode { <# .SYNOPSIS Normalizes and confirms support of the selected language. .DESCRIPTION Normalizes the language code to the two letter form and verifies that the language is supported by the script. If the language is unsupported by the script, it defaults to English. .PARAMETER LanguageCode Enter the desired language, language code, or culture code. #> [CmdletBinding()] [OutputType([string])] param ( [string]$LanguageCode ) begin { $supportLanguages = @( 'en', 'ru' ) } process { # Trim the language code down to two letter code. switch -Regex ($LanguageCode) { '^en' { $returnCode = 'en' break } '^(ru|py)' { $returnCode = 'ru' break } Default { $returnCode = $PSUICulture.Remove(2) break } } # Confirm that the language code is supported by this script. if ($returnCode -NotIn $supportLanguages) { # If the language code is not supported default to English. $returnCode = 'en' } } end { return $returnCode } } function Set-ScriptLanguageStrings { <# .SYNOPSIS Sets the language strings to be used. .DESCRIPTION Returns an object with language strings. Use the 'LanguageCode' switch to specify a language. .PARAMETER LanguageCode Specify the language to be used. Two letter language codes (ex: 'en' or 'ru'). .EXAMPLE PS C:\> Set-ScriptLanguage -LanguageCode 'en' #> [CmdletBinding()] [OutputType([object])] param ( [Parameter(Mandatory = $true, HelpMessage = 'Two letter language code.')] [string]$LanguageCode ) begin { # Define language strings. $langStringsEN = [PSCustomObject]@{ Author = "Author:" Incorrect = "Oops, an incorrect value," Incorrect2 = "enter again through " CuttError = "Request error in cutt" Download = "Error downloading" Download2 = "Will re-request in 5 seconds..." Download3 = "Error again" Download4 = "Try to check your internet connection and run the installation again" Download5 = "Downloading Spotify" StopScrpit = "Script is stopped" MsSpoti = "The Microsoft Store version of Spotify has been detected which is not supported" MsSpoti2 = "Uninstall Spotify Windows Store edition [Y/N]" MsSpoti3 = "Automatic uninstalling Spotify MS..." MsSpoti4 = "Uninstalling Spotify MS..." Prem = "Modification for premium account..." DownBts = "Downloading latest patch BTS..." OldV = "Found outdated version of Spotify" OldV2 = "Your Spotify {0} version is outdated, it is recommended to upgrade to {1}" OldV3 = "Want to update ? [Y/N]" AutoUpd = "Automatic update to the recommended version" DelOrOver = "Do you want to uninstall the current version of {0} or install over it? Y [Uninstall] / N [Install Over]" DelOld = "Uninstalling old Spotify..." NewV = "Unsupported version of Spotify found" NewV2 = "Your Spotify {0} version hasn't been tested yet, currently it's a stable {1} version" NewV3 = "Do you want to continue with {0} version (errors possible) ? [Y/N]" Recom = "Do you want to install the recommended {0} version ? [Y/N]" DelNew = "Uninstalling an untested Spotify..." DownSpoti = "Downloading and installing Spotify" DownSpoti2 = "Please wait..." PodcatsOff = "Off Podcasts" PodcastsOn = "On Podcasts" PodcatsSelect = "Want to turn off podcasts ? [Y/N]" DowngradeNote = "It is recommended to block because there was a downgrade of Spotify" UpdBlock = "Updates blocked" UpdUnblock = "Updates are not blocked" UpdSelect = "Want to block updates ? [Y/N]" CacheOn = "Clear cache enabled ({0})" CacheOff = "Clearing the cache is not enabled" CacheSelect = "Want to set up automatic cache cleanup? [Y/N]" CacheDays = "Cache older: XX days to be cleared " CacheDays2 = "Enter the number of days from 1 to 100" NoVariable = "Didn't find variable" NoVariable2 = "in xpui.js" NoVariable3 = "in licenses.html" NoVariable4 = "in html" ModSpoti = "Patching Spotify..." Error = "Error" FileLocBroken = "Location of Spotify files is broken, uninstall the client and run the script again" Spicetify = "Spicetify detected" NoRestore = "SpotX has already been installed, xpui.js and xpui.css not found. `nPlease uninstall Spotify client and run Install.bat again" ExpOff = "Experimental features disabled" NoRestore2 = "SpotX has already been installed, xpui.bak not found. `nPlease uninstall Spotify client and run Install.bat again" UpdateBlocked = "Spotify updates are already blocked" UpdateError = "Failed to block updates" NoSpotifyExe = "Could not find Spotify.exe" InstallComplete = "installation completed" } $langStringsRU = [PSCustomObject]@{ Author = "Автор:" Incorrect = "Ой, некорректное значение," Incorrect2 = "повторите ввод через" CuttError = "Ошибка запроса в cutt" Download = "Ошибка загрузки" Download2 = "Повторный запрос через 5 секунд..." Download3 = "Опять ошибка" Download4 = "Попробуйте проверить подключение к интернету и снова запустить установку" Download5 = "Загрузка Spotify" StopScrpit = "Cкрипт остановлен" MsSpoti = "Обнаружена версия Spotify из Microsoft Store, которая не поддерживается" MsSpoti2 = "Хотите удалить Spotify Microsoft Store ? [Y/N]" MsSpoti3 = "Автоматическое удаление Spotify MS..." MsSpoti4 = "Удаление Spotify MS..." Prem = "Модификация для премиум аккаунта..." DownBts = "Загружаю последний патч BTS..." OldV = "Найдена устаревшая версия Spotify" OldV2 = "Ваша версия Spotify {0} устарела, рекомендуется обновиться до {1}" OldV3 = "Обновить ? [Y/N]" AutoUpd = "Автоматическое обновление до рекомендуемой версии" DelOrOver = "Вы хотите удалить текущую версию {0} или установить поверх нее? Y [Удалить] / N [Поверх]" DelOld = "Удаление устаревшего Spotify..." NewV = "Найдена неподдерживаемая версия Spotify" NewV2 = "Ваша версия Spotify {0} еще не тестировалась, стабильная версия сейчас {1}" NewV3 = "Хотите продолжить с {0} (возможны ошибки) ? [Y/N]" Recom = "Хотите установить рекомендуемую {0} версию ? [Y/N]" DelNew = "Удаление неподдерживаемого Spotify..." DownSpoti = "Загружаю и устанавливаю Spotify" DownSpoti2 = "Пожалуйста подождите..." PodcatsOff = "Подкасты отключены" PodcastsOn = "Подкасты не отключены" PodcatsSelect = "Хотите отключить подкасты ? [Y/N]" DowngradeNote = "Рекомендуется заблокировать т.к. было понижение версии Spotify" UpdBlock = "Обновления заблокированы" UpdUnblock = "Обновления не заблокированы" UpdSelect = "Хотите заблокировать обновления ? [Y/N]" CacheOn = "Очистка кеша включена ({0})" CacheOff = "Очистка кеша не включена" CacheSelect = "Хотите установить автоматическую очистку кеша ? [Y/N]" CacheDays = "Кэш старше: XX дней будет очищен" CacheDays2 = "Пожалуйста, введите количество дней от 1 до 100" NoVariable = "Не нашел переменную" NoVariable2 = "в xpui.js" NoVariable3 = "в licenses.html" NoVariable4 = "в html" NoVariable5 = "в ru.json" ModSpoti = "Модифицирую Spotify..." Error = "Ошибка" FileLocBroken = "Расположение файлов Spotify нарушено, удалите клиент и снова запустите скрипт" Spicetify = "Обнаружен Spicetify" NoRestore = "SpotX уже был установлен, но файлы для восстановления xpui.js.bak и xpui.css.bak не найдены. `nУдалите клиент Spotify и снова запустите Install.bat" ExpOff = "Экспереметальные функции отключены" NoRestore2 = "SpotX уже был установлен, но файл для восстановления xpui.bak не найден. `nУдалите клиент Spotify и снова запустите Install.bat" UpdateBlocked = "Обновления Spotify уже заблокированы" UpdateError = "Не удалось заблокировать обновления" NoSpotifyExe = "Spotify.exe не найден" InstallComplete = "Установка завершена" } } process { # Assign language strings. switch ($LangCode) { 'en' { $langStrings = $langStringsEN break } 'ru' { $langStrings = $langStringsRU break } Default { # Default to English if unable to find a match. $langStrings = $langStringsEN break } } } end { return $langStrings } } # Set language code for script. $langCode = Format-LanguageCode -LanguageCode $Language # Set script language strings. $lang = Set-ScriptLanguageStrings -LanguageCode $langCode # Set variable 'ru'. if ($langCode -eq 'ru') { $ru = $true } Write-Host "*****************" Write-Host ($lang).Author"" -NoNewline Write-Host "@Amd64fox" -ForegroundColor DarkYellow Write-Host "*****************"`n $ErrorActionPreference = 'SilentlyContinue' $cutt_url = "https://cutt.ly/DK8UQub" try { Invoke-WebRequest -Uri $cutt_url | Out-Null } catch { Start-Sleep -Milliseconds 2000 try { Invoke-WebRequest -Uri $cutt_url | Out-Null } catch { Write-Host ($lang).CuttError`n -ForegroundColor RED } } $spotifyDirectory = "$env:APPDATA\Spotify" $spotifyDirectory2 = "$env:LOCALAPPDATA\Spotify" $spotifyExecutable = "$spotifyDirectory\Spotify.exe" $chrome_elf = "$spotifyDirectory\chrome_elf.dll" $chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll" $cache_folder = "$env:APPDATA\Spotify\cache" $spotifyUninstall = "$env:TEMP\SpotifyUninstall.exe" $upgrade_client = $false function incorrectValue { Write-Host ($lang).Incorrect"" -ForegroundColor Red -NoNewline Write-Host ($lang).Incorrect2"" -NoNewline Start-Sleep -Milliseconds 1000 Write-Host "3" -NoNewline Start-Sleep -Milliseconds 1000 Write-Host " 2" -NoNewline Start-Sleep -Milliseconds 1000 Write-Host " 1" Start-Sleep -Milliseconds 1000 Clear-Host } function Check_verison_clients($param2) { # checking the recommended version for spotx if ($param2 -eq "online") { $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars $readme = Invoke-WebRequest -UseBasicParsing -Uri https://raw.githubusercontent.com/amd64fox/SpotX/main/README.md $v = $readme.RawContent | Select-String "Recommended official version \[\d+\.\d+\.\d+\.\d+\]" -AllMatches $ver = $v.Matches.Value $ver = $ver -replace 'Recommended official version \[(\d+\.\d+\.\d+\.\d+)\]', '$1' return $ver } # Check version Spotify offline if ($param2 -eq "offline") { $check_offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion return $check_offline } } function unlockFolder { $ErrorActionPreference = 'SilentlyContinue' $block_File_update = "$env:LOCALAPPDATA\Spotify\Update" $Check_folder = Get-ItemProperty -Path $block_File_update | Select-Object Attributes $folder_update_access = Get-Acl $block_File_update # Check folder Update if it exists if ($Check_folder -match '\bDirectory\b') { # If the rights of the Update folder are blocked, then unblock if ($folder_update_access.AccessToString -match 'Deny') { ($ACL = Get-Acl $block_File_update).access | ForEach-Object { $Users = $_.IdentityReference $ACL.PurgeAccessRules($Users) } $ACL | Set-Acl $block_File_update } } } function downloadScripts($param1) { $webClient = New-Object -TypeName System.Net.WebClient if ($param1 -eq "Desktop") { Import-Module BitsTransfer $ver = Check_verison_clients -param2 "online" $l = "$PWD\links.tsv" $old = [IO.File]::ReadAllText($l) $links = $old -match "https:\/\/upgrade.scdn.co\/upgrade\/client\/win32-x86\/spotify_installer-$ver\.g[0-9a-f]{8}-[0-9]{1,3}\.exe" $links = $Matches.Values } if ($ru -and $param1 -eq "cache-spotify") { $links2 = "https://raw.githubusercontent.com/amd64fox/SpotX/main/scripts/cache/cache_spotify_ru.ps1" } if (!($ru) -and $param1 -eq "cache-spotify" ) { $links2 = "https://raw.githubusercontent.com/amd64fox/SpotX/main/scripts/cache/cache_spotify.ps1" } $web_Url_prev = "https://github.com/mrpond/BlockTheSpot/releases/latest/download/chrome_elf.zip", $links, ` $links2, "https://raw.githubusercontent.com/amd64fox/SpotX/main/scripts/cache/hide_window.vbs", ` "https://raw.githubusercontent.com/amd64fox/SpotX/main/scripts/cache/run_ps.bat", "https://docs.google.com/spreadsheets/d/e/2PACX-1vSFN2hWu4UO-ZWyVe8wlP9c0JsrduA49xBnRmSLOt8SWaOfIpCwjDLKXMTWJQ5aKj3WakQv6-Hnv9rz/pub?gid=0&single=true&output=tsv" $local_Url_prev = "$PWD\chrome_elf.zip", "$PWD\SpotifySetup.exe", "$cache_folder\cache_spotify.ps1", "$cache_folder\hide_window.vbs", "$cache_folder\run_ps.bat", "$PWD\links.tsv" $web_name_file_prev = "chrome_elf.zip", "SpotifySetup.exe", "cache_spotify.ps1", "hide_window.vbs", "run_ps.bat", "links.tsv" switch ( $param1 ) { "BTS" { $web_Url = $web_Url_prev[0]; $local_Url = $local_Url_prev[0]; $web_name_file = $web_name_file_prev[0] } "Desktop" { $web_Url = $web_Url_prev[1]; $local_Url = $local_Url_prev[1]; $web_name_file = $web_name_file_prev[1] } "cache-spotify" { $web_Url = $web_Url_prev[2]; $local_Url = $local_Url_prev[2]; $web_name_file = $web_name_file_prev[2] } "hide_window" { $web_Url = $web_Url_prev[3]; $local_Url = $local_Url_prev[3]; $web_name_file = $web_name_file_prev[3] } "run_ps" { $web_Url = $web_Url_prev[4]; $local_Url = $local_Url_prev[4]; $web_name_file = $web_name_file_prev[4] } "links.tsv" { $web_Url = $web_Url_prev[5]; $local_Url = $local_Url_prev[5]; $web_name_file = $web_name_file_prev[5] } } if ($param1 -eq "Desktop") { try { if (curl.exe -V) { $curl_check = $true } } catch { $curl_check = $false } $vernew = Check_verison_clients -param2 "online" } try { if ($param1 -eq "Desktop" -and $curl_check) { curl.exe $web_Url -o $local_Url --progress-bar --retry 3 --ssl-no-revoke } if ($param1 -eq "Desktop" -and $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) { Start-BitsTransfer -Source $web_Url -Destination $local_Url -DisplayName ($lang).Download5 -Description "$vernew " } if ($param1 -eq "Desktop" -and $null -eq (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) { $webClient.DownloadFile($web_Url, $local_Url) } if ($param1 -ne "Desktop") { $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars $webClient.DownloadFile($web_Url, $local_Url) } } catch [System.Management.Automation.MethodInvocationException] { Write-Host "" Write-Host ($lang).Download $web_name_file -ForegroundColor RED $Error[0].Exception Write-Host "" Write-Host ($lang).Download2`n Start-Sleep -Milliseconds 5000 try { if ($param1 -eq "Desktop" -and $curl_check) { curl.exe $web_Url -o $local_Url --progress-bar --retry 3 --ssl-no-revoke } if ($param1 -eq "Desktop" -and $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) { Start-BitsTransfer -Source $web_Url -Destination $local_Url -DisplayName ($lang).Download5 -Description "$vernew " } if ($param1 -eq "Desktop" -and $null -eq (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) { $webClient.DownloadFile($web_Url, $local_Url) } if ($param1 -ne "Desktop") { $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars $webClient.DownloadFile($web_Url, $local_Url) } } catch [System.Management.Automation.MethodInvocationException] { Write-Host ($lang).Download3 -ForegroundColor RED $Error[0].Exception Write-Host "" Write-Host ($lang).Download4`n ($lang).StopScrpit $tempDirectory = $PWD Pop-Location Start-Sleep -Milliseconds 200 Remove-Item -Recurse -LiteralPath $tempDirectory Pause Exit } } } function DesktopFolder { # If the default Dekstop folder does not exist, then try to find it through the registry. $ErrorActionPreference = 'SilentlyContinue' if (Test-Path "$env:USERPROFILE\Desktop") { $desktop_folder = "$env:USERPROFILE\Desktop" } $regedit_desktop_folder = Get-ItemProperty -Path "Registry::HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\" $regedit_desktop = $regedit_desktop_folder.'{754AC886-DF64-4CBA-86B5-F7FBF4FBCEF5}' if (!(Test-Path "$env:USERPROFILE\Desktop")) { $desktop_folder = $regedit_desktop } return $desktop_folder } # add Tls12 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 Stop-Process -Name Spotify if ($PSVersionTable.PSVersion.major -ge 7) { Import-Module Appx -UseWindowsPowerShell -WarningAction:SilentlyContinue } # Check version Windows $win_os = (get-itemproperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ProductName).ProductName $win11 = $win_os -match "\windows 11\b" $win10 = $win_os -match "\windows 10\b" $win8_1 = $win_os -match "\windows 8.1\b" $win8 = $win_os -match "\windows 8\b" if ($win11 -or $win10 -or $win8_1 -or $win8) { # Remove Spotify Windows Store If Any if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) { Write-Host ($lang).MsSpoti`n if (!($confirm_uninstall_ms_spoti)) { do { $ch = Read-Host -Prompt ($lang).MsSpoti2"" Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_uninstall_ms_spoti) { $ch = 'y' } if ($ch -eq 'y') { $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars if ($confirm_uninstall_ms_spoti) { Write-Host ($lang).MsSpoti3`n } if (!($confirm_uninstall_ms_spoti)) { Write-Host ($lang).MsSpoti4`n } Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage } if ($ch -eq 'n') { Read-Host ($lang).StopScrpit Pause Exit } } } # Unique directory name based on time Push-Location -LiteralPath $env:TEMP New-Item -Type Directory -Name "SpotX_Temp-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" | Convert-Path | Set-Location if ($premium) { Write-Host ($lang).Prem`n } if (!($premium)) { Write-Host ($lang).DownBts`n downloadScripts -param1 "BTS" Add-Type -Assembly 'System.IO.Compression.FileSystem' $zip = [System.IO.Compression.ZipFile]::Open("$PWD\chrome_elf.zip", 'read') [System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zip, $PWD) $zip.Dispose() } downloadScripts -param1 "links.tsv" $online = Check_verison_clients -param2 "online" $spotifyInstalled = (Test-Path -LiteralPath $spotifyExecutable) if ($spotifyInstalled) { $offline = Check_verison_clients -param2 "offline" if ($online -gt $offline) { if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) { Write-Host ($lang).OldV`n } if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { do { Write-Host (($lang).OldV2 -f $offline, $online) $ch = Read-Host -Prompt ($lang).OldV3 Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) { $ch = 'y' Write-Host ($lang).AutoUpd`n } if ($ch -eq 'y') { $upgrade_client = $true if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { do { $ch = Read-Host -Prompt (($lang).DelOrOver -f $offline) Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_spoti_recomended_unistall) { $ch = 'y' } if ($confirm_spoti_recomended_over) { $ch = 'n' } if ($ch -eq 'y') { Write-Host ($lang).DelOld`n unlockFolder cmd /c $spotifyExecutable /UNINSTALL /SILENT wait-process -name SpotifyUninstall Start-Sleep -Milliseconds 200 if (Test-Path $spotifyDirectory) { Remove-Item -Recurse -Force -LiteralPath $spotifyDirectory } if (Test-Path $spotifyDirectory2) { Remove-Item -Recurse -Force -LiteralPath $spotifyDirectory2 } if (Test-Path $spotifyUninstall ) { Remove-Item -Recurse -Force -LiteralPath $spotifyUninstall } } if ($ch -eq 'n') { $ch = $null } } if ($ch -eq 'n') { $downgrading = $true } } if ($online -lt $offline) { if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) { Write-Host ($lang).NewV`n } if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { do { Write-Host (($lang).NewV2 -f $offline, $online) $ch = Read-Host -Prompt (($lang).NewV3 -f $offline) Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) { $ch = 'n' } if ($ch -eq 'y') { $upgrade_client = $false } if ($ch -eq 'n') { if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { do { $ch = Read-Host -Prompt (($lang).Recom -f $online) Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) { $ch = 'y' Write-Host ($lang).AutoUpd`n } if ($ch -eq 'y') { $upgrade_client = $true $downgrading = $true if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) { do { $ch = Read-Host -Prompt (($lang).DelOrOver -f $offline) Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($confirm_spoti_recomended_unistall) { $ch = 'y' } if ($confirm_spoti_recomended_over) { $ch = 'n' } if ($ch -eq 'y') { Write-Host ($lang).DelNew`n unlockFolder cmd /c $spotifyExecutable /UNINSTALL /SILENT wait-process -name SpotifyUninstall Start-Sleep -Milliseconds 200 if (Test-Path $spotifyDirectory) { Remove-Item -Recurse -Force -LiteralPath $spotifyDirectory } if (Test-Path $spotifyDirectory2) { Remove-Item -Recurse -Force -LiteralPath $spotifyDirectory2 } if (Test-Path $spotifyUninstall ) { Remove-Item -Recurse -Force -LiteralPath $spotifyUninstall } } if ($ch -eq 'n') { $ch = $null } } if ($ch -eq 'n') { Write-Host ($lang).StopScrpit $tempDirectory = $PWD Pop-Location Start-Sleep -Milliseconds 200 Remove-Item -Recurse -LiteralPath $tempDirectory Pause Exit } } } } # If there is no client or it is outdated, then install if (-not $spotifyInstalled -or $upgrade_client) { Write-Host ($lang).DownSpoti"" -NoNewline Write-Host $online -ForegroundColor Green Write-Host ($lang).DownSpoti2`n # Delete old version files of Spotify before installing, leave only profile files $ErrorActionPreference = 'SilentlyContinue' Stop-Process -Name Spotify Start-Sleep -Milliseconds 600 unlockFolder Start-Sleep -Milliseconds 200 Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs', 'cache' | Remove-Item -Recurse -Force Start-Sleep -Milliseconds 200 # Client download downloadScripts -param1 "Desktop" Write-Host "" Start-Sleep -Milliseconds 200 # Client installation Start-Process -FilePath explorer.exe -ArgumentList $PWD\SpotifySetup.exe while (-not (get-process | Where-Object { $_.ProcessName -eq 'SpotifySetup' })) {} wait-process -name SpotifySetup wait-process -name SpotifySetup Stop-Process -Name Spotify } # Delete the leveldb folder (Fixes bug with incorrect experimental features for some accounts) $leveldb = (Test-Path -LiteralPath "$spotifyDirectory2\Browser\Local Storage\leveldb") if ($leveldb) { $ErrorActionPreference = 'SilentlyContinue' remove-item "$spotifyDirectory2\Browser\Local Storage\leveldb" -Recurse -Force } # Create backup chrome_elf.dll if (!(Test-Path -LiteralPath $chrome_elf_bak) -and !($premium)) { Move-Item $chrome_elf $chrome_elf_bak } $ch = $null if ($podcasts_off) { Write-Host ($lang).PodcatsOff`n $ch = 'y' } if ($podcasts_on) { Write-Host ($lang).PodcastsOn`n $ch = 'n' } if (!($podcasts_off) -and !($podcasts_on)) { do { $ch = Read-Host -Prompt ($lang).PodcatsSelect Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($ch -eq 'y') { $podcast_off = $true } $ch = $null if ($downgrading) { $upd = "`n" + [string]($lang).DowngradeNote } else { $upd = "" } if ($block_update_on) { Write-Host ($lang).UpdBlock`n $ch = 'y' } if ($block_update_off) { Write-Host ($lang).UpdUnblock`n $ch = 'n' } if (!($block_update_on) -and !($block_update_off)) { do { $text_upd = [string]($lang).UpdSelect + $upd $ch = Read-Host -Prompt $text_upd Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') } if ($ch -eq 'y') { $block_update = $true } $ch = $null if ($cache_on) { Write-Host (($lang).CacheOn -f $number_days)`n $cache_install = $true } if ($cache_off) { Write-Host ($lang).CacheOff`n $ErrorActionPreference = 'SilentlyContinue' $desktop_folder = DesktopFolder if (Test-Path -LiteralPath $cache_folder) { remove-item $cache_folder -Recurse -Force remove-item $desktop_folder\Spotify.lnk -Recurse -Force } } if (!($cache_on) -and !($cache_off)) { do { $ch = Read-Host -Prompt ($lang).CacheSelect Write-Host "" if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } } while ($ch -notmatch '^y$|^n$') if ($ch -eq 'y') { $cache_install = $true do { Write-Host ($lang).CacheDays $ch = Read-Host -Prompt ($lang).CacheDays2 Write-Host "" if (!($ch -match "^[1-9][0-9]?$|^100$")) { incorrectValue } } while ($ch -notmatch '^[1-9][0-9]?$|^100$') if ($ch -match "^[1-9][0-9]?$|^100$") { $number_days = $ch } } if ($ch -eq 'n') { $ErrorActionPreference = 'SilentlyContinue' $desktop_folder = DesktopFolder if (Test-Path -LiteralPath $cache_folder) { remove-item $cache_folder -Recurse -Force remove-item $desktop_folder\Spotify.lnk -Recurse -Force } } } function OffPodcasts { # Turn off podcasts $podcasts_off1 = 'withQueryParameters\(e\){return this.queryParameters=e,this}', 'withQueryParameters(e){return this.queryParameters=(e.types?{...e, types: e.types.split(",").filter(_ => !["episode","show"].includes(_)).join(",")}:e),this}' $podcasts_off2 = ',this[.]enableShows=[a-z]' if ($xpui_js -match $podcasts_off1[0]) { $xpui_js = $xpui_js -replace $podcasts_off1[0], $podcasts_off1[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off1[0] "($lang).NoVariable2 } if ($xpui_js -match $podcasts_off2) { $xpui_js = $xpui_js -replace $podcasts_off2, "" } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off2 "($lang).NoVariable2 } $xpui_js } function OffAdsOnFullscreen { # Removing an empty block $empty_block_ad = 'adsEnabled:!0', 'adsEnabled:!1' # Full screen mode activation and removing "Upgrade to premium" menu, upgrade button $full_screen = '(return|.=.=>)"free"===(.+?)(return|.=.=>)"premium"===', '$1"premium"===$2$3"free"===' # Disabling a playlist sponsor $playlist_ad_off = "allSponsorships" if ($xpui_js -match $empty_block_ad[0]) { $xpui_js = $xpui_js -replace $empty_block_ad[0], $empty_block_ad[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$empty_block_ad[0] "($lang).NoVariable2 } if ($xpui_js -match $full_screen[0]) { $xpui_js = $xpui_js -replace $full_screen[0], $full_screen[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$full_screen[0] "($lang).NoVariable2 } if ($xpui_js -match $playlist_ad_off) { $xpui_js = $xpui_js -replace $playlist_ad_off, "" } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$playlist_ad_off "($lang).NoVariable2 } $xpui_js } function OffRujs { # Remove all languages except En and Ru from xpui.js $rus_js = '(JSON.parse\(.{)("en":"English \(English\)".*\(Vietnamese\)"})', '$1"en":"English (English)","ru":"Русский (Russian)"}' if ($xpui_js -match $rus_js[0]) { $xpui_js = $xpui_js -replace $rus_js[0], $rus_js[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$rus_js[0] "($lang).NoVariable2 } $xpui_js } function ExpFeature { # Experimental Feature if (!($made_for_you_off)) { $exp_features1 = '(Show "Made For You" entry point in the left sidebar.,default:)(!1)', '$1!0' } if (!($new_search_off)) { $exp_features2 = '(Enable the new Search with chips experience",default:)(!1)', '$1!0' } $exp_features3 = '(Enable Liked Songs section on Artist page",default:)(!1)', '$1!0' $exp_features4 = '(Enable block users feature in clientX",default:)(!1)', '$1!0' $exp_features5 = '(Enables quicksilver in-app messaging modal",default:)(!0)', '$1!1' $exp_features6 = '(With this enabled, clients will check whether tracks have lyrics available",default:)(!1)', '$1!0' $exp_features7 = '(Enables new playlist creation flow in Web Player and DesktopX",default:)(!1)', '$1!0' $exp_features14 = '(Adds a search box so users are able to filter playlists when trying to add songs to a playlist using the contextmenu",default:)(!1)', '$1!0' if (!($enhance_playlist_off)) { $exp_features8 = '(Enable Enhance Playlist UI and functionality for end-users",default:)(!1)', '$1!0' } if (!($new_artist_pages_off)) { $exp_features9 = '(Enable a condensed disography shelf on artist pages",default:)(!1)', '$1!0' } if (!($new_lyrics_off)) { $exp_features10 = '(Enable Lyrics match labels in search results",default:)(!1)', '$1!0' } if (!($ignore_in_recommendations_off)) { $exp_features11 = '(Enable Ignore In Recommendations for desktop and web",default:)(!1)', '$1!0' } $exp_features12 = '(Enable Playlist Permissions flows for Prod",default:)(!1)', '$1!0' if (!($enhance_like_off)) { $exp_features13 = '(Enable Enhance Liked Songs UI and functionality",default:)(!1)', '$1!0' } if (!($made_for_you_off)) { if ($xpui_js -match $exp_features1[0]) { $xpui_js = $xpui_js -replace $exp_features1[0], $exp_features1[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features1[0] "($lang).NoVariable2 } } if (!($new_search_off)) { if ($xpui_js -match $exp_features2[0]) { $xpui_js = $xpui_js -replace $exp_features2[0], $exp_features2[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features2[0] "($lang).NoVariable2 } } if ($xpui_js -match $exp_features3[0]) { $xpui_js = $xpui_js -replace $exp_features3[0], $exp_features3[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features3[0] "($lang).NoVariable2 } if ($xpui_js -match $exp_features4[0]) { $xpui_js = $xpui_js -replace $exp_features4[0], $exp_features4[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features4[0] "($lang).NoVariable2 } if ($xpui_js -match $exp_features5[0]) { $xpui_js = $xpui_js -replace $exp_features5[0], $exp_features5[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features5[0] "($lang).NoVariable2 } if ($xpui_js -match $exp_features6[0]) { $xpui_js = $xpui_js -replace $exp_features6[0], $exp_features6[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features6[0] "($lang).NoVariable2 } if ($xpui_js -match $exp_features7[0]) { $xpui_js = $xpui_js -replace $exp_features7[0], $exp_features7[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features7[0] "($lang).NoVariable2 } if (!($enhance_playlist_off)) { if ($xpui_js -match $exp_features8[0]) { $xpui_js = $xpui_js -replace $exp_features8[0], $exp_features8[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features8[0] "($lang).NoVariable2 } } if (!($new_artist_pages_off)) { if ($xpui_js -match $exp_features9[0]) { $xpui_js = $xpui_js -replace $exp_features9[0], $exp_features9[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features9[0] "($lang).NoVariable2 } } if (!($new_lyrics_off)) { if ($xpui_js -match $exp_features10[0]) { $xpui_js = $xpui_js -replace $exp_features10[0], $exp_features10[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features10[0] "($lang).NoVariable2 } } if (!($ignore_in_recommendations_off)) { if ($xpui_js -match $exp_features11[0]) { $xpui_js = $xpui_js -replace $exp_features11[0], $exp_features11[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features11[0] "($lang).NoVariable2 } } if ($xpui_js -match $exp_features12[0]) { $xpui_js = $xpui_js -replace $exp_features12[0], $exp_features12[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features12[0] "($lang).NoVariable2 } if (!($enhance_like_off)) { if ($xpui_js -match $exp_features13[0]) { $xpui_js = $xpui_js -replace $exp_features13[0], $exp_features13[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features13[0] "($lang).NoVariable2 } } if ($xpui_js -match $exp_features14[0]) { $xpui_js = $xpui_js -replace $exp_features14[0], $exp_features14[1] } else { Write-Host ($lang).NoVariable"" -ForegroundColor red -NoNewline; Write-Host "`$exp_features14[0] "($lang).NoVariable2 } $xpui_js } function ContentsHtml { # Минификация html $html_lic_min1 = '