From 9447a264b79d512205b77a704f4187199b812d40 Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Sun, 12 Sep 2021 00:20:11 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=BF=D1=82=D0=B8=D0=BC=D0=B8=D0=B7?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F=20=D0=BA=D0=BE=D0=B4=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Install_rus.ps1 | 35 ++++++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/Install_rus.ps1 b/Install_rus.ps1 index ddd8661..666b995 100644 --- a/Install_rus.ps1 +++ b/Install_rus.ps1 @@ -8,12 +8,10 @@ if (!($tsl_check -match '^tls12$' )) { } -Write-Host "********************" +Write-Host "*****************" Write-Host "Автор: " -NoNewline -Write-Host "@Nuzair46" -ForegroundColor DarkYellow -Write-Host "Модификация: " -NoNewline -Write-Host "@Amd64fox" -ForegroundColor DarkYellow -Write-Host "********************" +Write-Host "@amd64fox" -ForegroundColor DarkYellow +Write-Host "*****************" $SpotifyDirectory = "$env:APPDATA\Spotify" @@ -164,11 +162,23 @@ Remove-Item -Recurse -LiteralPath $tempDirectory # Removing an empty block, "Upgrade button", "Upgrade to premium" menu Rename-Item -path $env:APPDATA\Spotify\Apps\xpui.spa -NewName $env:APPDATA\Spotify\Apps\xpui.zip -Expand-Archive $env:APPDATA\Spotify\Apps\xpui.zip -DestinationPath $env:APPDATA\Spotify\Apps\temporary +if (Test-Path $env:APPDATA\Spotify\Apps\temporary) { + Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse +} +New-Item -Path $env:APPDATA\Spotify\Apps\temporary -ItemType Directory | Out-Null + +# Достаем из архива 2 файла +$shell = New-Object -Com Shell.Application +$shell.NameSpace("$(resolve-path $env:APPDATA\Spotify\Apps\xpui.zip)").Items() | where Name -eq "xpui.js" | ? { + $shell.NameSpace("$env:APPDATA\Spotify\Apps\temporary").copyhere($_) } +$shell.NameSpace("$(resolve-path $env:APPDATA\Spotify\Apps\xpui.zip)").Items() | where Name -eq "xpui-routes-offline-browse.css" | ? { + $shell.NameSpace("$env:APPDATA\Spotify\Apps\temporary").copyhere($_) } + + # Делает резервную копию xpui.spa, также если бейкап устарел то заменяет старую на новую версию $xpui_js_last_write_time = dir $env:APPDATA\Spotify\Apps\temporary\xpui.js -File -Recurse -$xpui_licenses_last_write_time = dir $env:APPDATA\Spotify\Apps\temporary\licenses.html -File -Recurse +$xpui_licenses_last_write_time = dir $env:APPDATA\Spotify\Apps\temporary\xpui-routes-offline-browse.css -File -Recurse if ($xpui_licenses_last_write_time.LastWriteTime -eq $xpui_js_last_write_time.LastWriteTime) { @@ -177,6 +187,8 @@ if ($xpui_licenses_last_write_time.LastWriteTime -eq $xpui_js_last_write_time.La } Copy $env:APPDATA\Spotify\Apps\xpui.zip $env:APPDATA\Spotify\Apps\xpui.bak } + + $file_js = Get-Content $env:APPDATA\Spotify\Apps\temporary\xpui.js -Raw If (!($file_js -match 'patched by spotx')) { $file_js -match '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}.' | Out-Null @@ -190,6 +202,7 @@ If (!($file_js -match 'patched by spotx')) { Compress-Archive -Path $env:APPDATA\Spotify\Apps\temporary\xpui.js -Update -DestinationPath $env:APPDATA\Spotify\Apps\xpui.zip } + <# # Удаление меню (РЕЗЕРВНЫЙ) $file_css = Get-Content $env:APPDATA\Spotify\Apps\temporary\xpui.css -Raw @@ -204,13 +217,17 @@ If (!($file_css -match 'patched by spotx')) { } #> + Rename-Item -path $env:APPDATA\Spotify\Apps\xpui.zip -NewName $env:APPDATA\Spotify\Apps\xpui.spa Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse + + # Shortcut bug $ErrorActionPreference = 'SilentlyContinue' If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) { + $source = "$env:APPDATA\Spotify\Spotify.exe" $target = "$env:USERPROFILE\Desktop\Spotify.lnk" $WorkingDir = "$env:APPDATA\Spotify" @@ -218,8 +235,8 @@ If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) { $Shortcut = $WshShell.CreateShortcut($target) $Shortcut.WorkingDirectory = $WorkingDir $Shortcut.TargetPath = $source - $Shortcut.Save() -} + $Shortcut.Save() +}