From c980de9acfad711feb9ff8fbda253ba50eeb459b Mon Sep 17 00:00:00 2001 From: amd64fox Date: Sat, 3 Sep 2022 12:13:38 +0300 Subject: [PATCH] Update - added blocking of audio ads and billboards on the main page - bts patch is disabled by default - added more information about SpotX in "About Spotify" tab --- Install.ps1 | 49 +++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 8 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 601a2c6..84b2836 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -78,6 +78,9 @@ param [Parameter(HelpMessage = 'Do not create desktop shortcut.')] [switch]$no_shortcut, + [Parameter(HelpMessage = 'Use bts patch.')] + [switch]$bts, + [Parameter(HelpMessage = 'Select the desired language to use for installation. Default is the detected system language.')] [Alias('l')] [string]$Language @@ -255,7 +258,7 @@ if ($line) { } # Sending a statistical web query to cutt.ly -#$ErrorActionPreference = 'SilentlyContinue' +$ErrorActionPreference = 'SilentlyContinue' $cutt_url = "https://cutt.ly/DK8UQub" try { $ProgressPreference = 'SilentlyContinue' @@ -538,11 +541,13 @@ if ($premium) { Write-Host ($lang).Prem`n } if (!($premium)) { - 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() + if ($bts) { + 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" @@ -725,7 +730,7 @@ if ($leveldb) { } # Create backup chrome_elf.dll -if (!(Test-Path -LiteralPath $chrome_elf_bak) -and !($premium)) { +if (!(Test-Path -LiteralPath $chrome_elf_bak) -and !($premium) -and $bts) { Move-Item $chrome_elf $chrome_elf_bak } @@ -855,6 +860,10 @@ function Helper($paramname) { } "OffadsonFullscreen" { $offadson_fullscreen = @{ + # Removing a billboard on the homepage + Bilboard = '.(\?\[xB\(n.leaderboard,)', 'false$1' + # Removing audio ads + AidioAds = '(case 0:)return this.enabled=...+?(;case 4:this.subscription=this.audioApi).+?(;case 5)', '$1$2.cosmosConnector.increaseStreamTime(-100000000000)$3' # Removing an empty block EmptyBlockAd = 'adsEnabled:!0', 'adsEnabled:!1' # Fullscreen act., removing upgrade menu, button @@ -869,6 +878,9 @@ function Helper($paramname) { # Removing the track download quality switch DownloadQuality = 'xe\(...\)\)\)\)...createElement\(....{filterMatchQuery:.....get\(.desktop.settings.downloadQuality.title.\).+?xe' , 'xe' } + if ($bts) { + $offadson_fullscreen.Remove('Bilboard'), $offadson_fullscreen.Remove('AidioAds') + } #if (!($testconnect)) { # $offadson_fullscreen.Remove('ConnectUnlock'), $offadson_fullscreen.Remove('ConnectUnlock2'), # $offadson_fullscreen.Remove('ConnectUnlock3'), $offadson_fullscreen.Remove('ConnectUnlock4') @@ -1021,7 +1033,7 @@ function Helper($paramname) { Write-Host ($lang).ModSpoti`n # Patching files -if (!($premium)) { +if (!($premium) -and $bts) { $patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini" Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory" } @@ -1293,6 +1305,27 @@ If (Test-Path $xpui_spa_patch) { $writer.Write([System.Environment]::NewLine + '// Patched by SpotX') $writer.Close() + + # Add discriptions (xpui-desktop-modals.js) + $entry_xpui_desktop_modals = $zip.GetEntry('xpui-desktop-modals.js') + $reader = New-Object System.IO.StreamReader($entry_xpui_desktop_modals.Open()) + $xpuiContents_xpui_desktop_modals = $reader.ReadToEnd() + $reader.Close() + + $about = "`$1`"

More about SpotX

`"}),`$1`'Github`'}),`$1`'FAQ'}),`$1`'Telegram channel`'}),`$1`'Create ` + an issue report`'}),`$1`"
`"}),`$1`"

DISCLAIMER

`"}),`$1`"SpotX is a modified version of the official Spotify client, provided as an evaluation version, you use it at your own risk.`"})" + + $xpuiContents_xpui_desktop_modals = $xpuiContents_xpui_desktop_modals ` + -replace '(..createElement\(....,{source:).....get\("about.copyright",.\),paragraphClassName:.}\)', $about + $writer = New-Object System.IO.StreamWriter($entry_xpui_desktop_modals.Open()) + $writer.BaseStream.SetLength(0) + $writer.Write($xpuiContents_xpui_desktop_modals) + $writer.Close() + # Disable Sentry (vendor~xpui.js) $entry_vendor_xpui = $zip.GetEntry('vendor~xpui.js') $reader = New-Object System.IO.StreamReader($entry_vendor_xpui.Open())