From 1b59c44d8dc11ad54cb84e8d424075a62ad7d3e0 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Tue, 30 Nov 2021 20:39:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=B0=D1=81=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=20(=D0=BF=D0=BE=20=D0=B6=D0=B5=D0=BB=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D1=8E)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Install_rus.ps1 | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Install_rus.ps1 b/Install_rus.ps1 index b5c382d..e7ae9fb 100644 --- a/Install_rus.ps1 +++ b/Install_rus.ps1 @@ -16,6 +16,7 @@ Write-Host "*****************" $SpotifyDirectory = "$env:APPDATA\Spotify" $SpotifyExecutable = "$SpotifyDirectory\Spotify.exe" +$Podcasts_off = $false Stop-Process -Name Spotify @@ -158,6 +159,28 @@ Remove-Item -Recurse -LiteralPath $tempDirectory + + +do { + $ch = Read-Host -Prompt "Хотите отключить подкасты ? (Y/N)" + if (!($ch -eq 'n' -or $ch -eq 'y')) { + + Write-Host "Ой, некорректное значение, " -ForegroundColor Red -NoNewline + Write-Host "повторите ввод через..." -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 + } +} +while ($ch -notmatch '^y$|^n$') +if ($ch -eq 'y') { $Podcasts_off = $true } + + # Мофифицируем файлы $xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa" @@ -182,6 +205,12 @@ If (Test-Path $xpui_js_patch) { <# Removing "Upgrade to premium" menu #> -replace 'visible:!e}[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.createElement[(]{1}[A-Za-z]{2}[,]{1}null[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.', $menu_split_js ` <# Disabling a playlist sponsor #> -replace "allSponsorships", "" + # Disable Podcast + if ($Podcasts_off) { + $new_js = $new_js ` + -replace '"album,playlist,artist,show,station,episode"', '"album,playlist,artist,station"' -replace ',this[.]enableShows=[a-z]', "" + } + Set-Content -Path $xpui_js_patch -Force -Value $new_js add-content -Path $xpui_js_patch -Value '// Patched by SpotX' -passthru | Out-Null $contentjs = [System.IO.File]::ReadAllText($xpui_js_patch) @@ -230,7 +259,13 @@ If (Test-Path $xpui_spa_patch) { <# Removing an empty block #> -replace 'adsEnabled:!0', 'adsEnabled:!1' ` <# Removing "Upgrade to premium" menu #> -replace 'visible:!e}[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.createElement[(]{1}[A-Za-z]{2}[,]{1}null[)]{1}[,]{1}[A-Za-z]{1}[(]{1}[)]{1}.', $menu_split_js ` <# Disabling a playlist sponsor #> -replace "allSponsorships", "" ` - <# Disable Logging #> -replace "sp://logging/v3/\w+", "" + <# Disable Logging #> -replace "sp://logging/v3/\w+", "" + + # Disable Podcast + if ($Podcasts_off) { + $xpuiContents = $xpuiContents ` + -replace '"album,playlist,artist,show,station,episode"', '"album,playlist,artist,station"' -replace ',this[.]enableShows=[a-z]', "" + } $writer = New-Object System.IO.StreamWriter($entry_xpui.Open()) $writer.BaseStream.SetLength(0)