mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-04-14 04:38:24 +10:00
Оптимизация кода
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user