- Added support for premium accounts https://github.com/amd64fox/SpotX/issues/53
 - Fixed some bugs when reinstalling Spotify
 - Added support for input parameters, for more flexible installation https://github.com/amd64fox/SpotX/issues/22
This commit is contained in:
amd64fox
2022-06-26 21:52:14 +03:00
parent 3e75024211
commit 79d251511b
6 changed files with 1630 additions and 1228 deletions

View File

@@ -1,3 +1,68 @@
param (
[Parameter()]
[switch]
$podcasts_off = $false,
[Parameter()]
[switch]
$podcasts_on = $false,
[Parameter()]
[switch]
$block_update_on = $false,
[Parameter()]
[switch]
$block_update_off = $false,
[Parameter()]
[switch]
$cache_on = $false,
[int] $number_days = 7,
[Parameter()]
[switch]
$cache_off = $false,
[Parameter()]
[switch]
$confirm_uninstall_ms_spoti = $false,
[Parameter()]
[switch]
$confirm_spoti_recomended_over = $false,
[Parameter()]
[switch]
$confirm_spoti_recomended_unistall = $false,
[Parameter()]
[switch]
$premium = $false,
[Parameter()]
[switch]
$start_spoti = $false,
[Parameter()]
[switch]
$exp_off = $false,
[Parameter()]
[switch]
$hide_col_icon_off = $false,
[Parameter()]
[switch]
$made_for_you_off = $false,
[Parameter()]
[switch]
$new_search_off = $false,
[Parameter()]
[switch]
$enhance_playlist_off = $false,
[Parameter()]
[switch]
$enhance_like_off = $false,
[Parameter()]
[switch]
$new_artist_pages_off = $false,
[Parameter()]
[switch]
$new_lyrics_off = $false,
[Parameter()]
[switch]
$ignore_in_recommendations_off = $false
)
# Ignore errors from `Stop-Process` # Ignore errors from `Stop-Process`
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue $PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
@@ -12,13 +77,10 @@ $spotifyDirectory2 = "$env:LOCALAPPDATA\Spotify"
$spotifyExecutable = "$spotifyDirectory\Spotify.exe" $spotifyExecutable = "$spotifyDirectory\Spotify.exe"
$chrome_elf = "$spotifyDirectory\chrome_elf.dll" $chrome_elf = "$spotifyDirectory\chrome_elf.dll"
$chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll" $chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll"
$block_File_update = "$env:LOCALAPPDATA\Spotify\Update"
$cache_folder = "$env:APPDATA\Spotify\cache" $cache_folder = "$env:APPDATA\Spotify\cache"
$spotifyUninstall = "$env:TEMP\SpotifyUninstall.exe"
$verPS = $PSVersionTable.PSVersion.major $verPS = $PSVersionTable.PSVersion.major
$upgrade_client = $false $upgrade_client = $false
$podcasts_off = $false
$block_update = $false
$cache_install = $false
function incorrectValue { function incorrectValue {
@@ -54,6 +116,7 @@ function Check_verison_clients($param2) {
function unlockFolder { function unlockFolder {
$ErrorActionPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue'
$block_File_update = "$env:LOCALAPPDATA\Spotify\Update"
$Check_folder = Get-ItemProperty -Path $block_File_update | Select-Object Attributes $Check_folder = Get-ItemProperty -Path $block_File_update | Select-Object Attributes
$folder_update_access = Get-Acl $block_File_update $folder_update_access = Get-Acl $block_File_update
@@ -147,9 +210,8 @@ function downloadScripts($param1) {
} }
catch [System.Management.Automation.MethodInvocationException] { catch [System.Management.Automation.MethodInvocationException] {
Write-Host "Error again, script stopped" -ForegroundColor RED Write-Host "Error again, script stopped"`n -ForegroundColor RED
$Error[0].Exception $Error[0].Exception
Write-Host ""
Write-Host "Try to check your internet connection and run the installation again."`n Write-Host "Try to check your internet connection and run the installation again."`n
$tempDirectory = $PWD $tempDirectory = $PWD
Pop-Location Pop-Location
@@ -187,8 +249,7 @@ Stop-Process -Name Spotify
if ($verPS -lt 3) { if ($verPS -lt 3) {
do { do {
Write-Host "Your version of PowerShell $verPS is not supported"`n Write-Host "Your version of PowerShell $verPS is not supported"`n
$ch = Read-Host -Prompt "Please read the instruction 'Outdated versions of PowerShell' `nOpen a page with instructions ? (Y/N)" $ch = Read-Host -Prompt "Please read the instruction 'Outdated versions of PowerShell' `nOpen a page with instructions ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
@@ -218,17 +279,22 @@ if ($win11 -or $win10 -or $win8_1 -or $win8) {
# Remove Spotify Windows Store If Any # Remove Spotify Windows Store If Any
if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) { if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) {
Write-Host 'The Microsoft Store version of Spotify has been detected which is not supported.'`n Write-Host 'The Microsoft Store version of Spotify has been detected which is not supported.'`n
if (!($confirm_uninstall_ms_spoti)) {
do { do {
$ch = Read-Host -Prompt "Uninstall Spotify Windows Store edition (Y/N) " $ch = Read-Host -Prompt "Uninstall Spotify Windows Store edition (Y/N) "`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_uninstall_ms_spoti) { $ch = 'y' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
$ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars
Write-Host 'Uninstalling Spotify...'`n if ($confirm_uninstall_ms_spoti) { Write-Host 'Automatic uninstalling Spotify MS...'`n }
if (!($confirm_uninstall_ms_spoti)) { Write-Host 'Uninstalling Spotify MS...'`n }
Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
} }
if ($ch -eq 'n') { if ($ch -eq 'n') {
@@ -242,14 +308,19 @@ if ($win11 -or $win10 -or $win8_1 -or $win8) {
Push-Location -LiteralPath $env:TEMP 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 New-Item -Type Directory -Name "SpotX_Temp-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" | Convert-Path | Set-Location
if ($premium) {
Write-Host 'Modification for premium account...'`n
}
if (!($premium)) {
Write-Host 'Downloading latest patch BTS...'`n Write-Host 'Downloading latest patch BTS...'`n
downloadScripts -param1 "BTS" downloadScripts -param1 "BTS"
downloadScripts -param1 "links.tsv"
Add-Type -Assembly 'System.IO.Compression.FileSystem' Add-Type -Assembly 'System.IO.Compression.FileSystem'
$zip = [System.IO.Compression.ZipFile]::Open("$PWD\chrome_elf.zip", 'read') $zip = [System.IO.Compression.ZipFile]::Open("$PWD\chrome_elf.zip", 'read')
[System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zip, $PWD) [System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zip, $PWD)
$zip.Dispose() $zip.Dispose()
}
downloadScripts -param1 "links.tsv"
$online = Check_verison_clients -param2 "online" $online = Check_verison_clients -param2 "online"
@@ -260,32 +331,45 @@ if ($spotifyInstalled) {
$offline = Check_verison_clients -param2 "offline" $offline = Check_verison_clients -param2 "offline"
if ($online -gt $offline) { if ($online -gt $offline) {
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
Write-Host "Found outdated version of Spotify"`n
}
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Your Spotify $offline version is outdated, it is recommended to upgrade to $online `nWant to update ? (Y/N)" $ch = Read-Host -Prompt "Your Spotify $offline version is outdated, it is recommended to upgrade to $online `nWant to update ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
$ch = 'y'
Write-Host "Automatic update to the recommended version"`n
}
if ($ch -eq 'y') { if ($ch -eq 'y') {
$upgrade_client = $true $upgrade_client = $true
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Do you want to uninstall the current version of $offline or install over it? Y [Uninstall] / N [Install Over]" $ch = Read-Host -Prompt "Do you want to uninstall the current version of $offline or install over it? Y [Uninstall] / N [Install Over]"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_unistall) { $ch = 'y' }
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
Write-Host "Uninstall Spotify..." Write-Host "Uninstalling old Spotify..."`n
Write-Host "" unlockFolder
cmd /c $spotifyExecutable /UNINSTALL /SILENT cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200 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') { $ch = $null }
} }
@@ -295,42 +379,58 @@ if ($spotifyInstalled) {
} }
if ($online -lt $offline) { if ($online -lt $offline) {
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
Write-Host "Unsupported version of Spotify found"`n
}
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Your Spotify $offline version hasn't been tested yet, currently it's a stable $online version. `nDo you want to continue with $offline version (errors possible) ? (Y/N)" $ch = Read-Host -Prompt "Your Spotify $offline version hasn't been tested yet, currently it's a stable $online version. `nDo you want to continue with $offline version (errors possible) ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') 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 'y') { $upgrade_client = $false }
if ($ch -eq 'n') { if ($ch -eq 'n') {
if (!($confirm_spoti_recomended_over) -or !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Do you want to install the recommended $online version ? (Y/N)" $ch = Read-Host -Prompt "Do you want to install the recommended $online version ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
$ch = 'y'
Write-Host "Automatic update to the recommended version"`n
}
if ($ch -eq 'y') { if ($ch -eq 'y') {
$upgrade_client = $true $upgrade_client = $true
$downgrading = $true $downgrading = $true
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Do you want to uninstall the current version of $offline or install over it? Y [Uninstall] / N [Install Over]" $ch = Read-Host -Prompt "Do you want to uninstall the current version of $offline or install over it? Y [Uninstall] / N [Install Over]"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_unistall) { $ch = 'y' }
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
Write-Host "Uninstall Spotify..." Write-Host "Uninstalling an untested Spotify..."`n
Write-Host "" unlockFolder
cmd /c $spotifyExecutable /UNINSTALL /SILENT cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200 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') { $ch = $null }
} }
@@ -360,7 +460,6 @@ if (-not $spotifyInstalled -or $upgrade_client) {
unlockFolder unlockFolder
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs', 'cache' | Remove-Item -Recurse -Force Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs', 'cache' | Remove-Item -Recurse -Force
Get-ChildItem $spotifyDirectory2 -Exclude 'Users' | Remove-Item -Recurse -Force
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
# Client download # Client download
@@ -389,44 +488,82 @@ if ($leveldb) {
} }
# Create backup chrome_elf.dll # Create backup chrome_elf.dll
if (!(Test-Path -LiteralPath $chrome_elf_bak)) { if (!(Test-Path -LiteralPath $chrome_elf_bak) -and !($premium)) {
Move-Item $chrome_elf $chrome_elf_bak Move-Item $chrome_elf $chrome_elf_bak
} }
$ch = $null
if ($podcasts_off) {
Write-Host "Off Podcasts"`n
$ch = 'y'
}
if ($podcasts_on) {
Write-Host "On Podcasts"`n
$ch = 'n'
}
if (!($podcasts_off) -and !($podcasts_on)) {
do { do {
$ch = Read-Host -Prompt "Want to turn off podcasts ? (Y/N)" $ch = Read-Host -Prompt "Want to turn off podcasts ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
if ($ch -eq 'y') { $podcasts_off = $true } }
if ($ch -eq 'y') { $podcast_off = $true }
$ch = $null
if ($downgrading) { $upd = "`nYou have had a downgrade of Spotify, it is recommended to block" } if ($downgrading) { $upd = "`nYou have had a downgrade of Spotify, it is recommended to block" }
else { $upd = "" } else { $upd = "" }
if ($block_update_on) {
Write-Host "Updates blocked"`n
$ch = 'y'
}
if ($block_update_off) {
Write-Host "Updates are not blocked"`n
$ch = 'n'
}
if (!($block_update_on) -and !($block_update_off)) {
do { do {
$ch = Read-Host -Prompt "Want to block updates ? (Y/N)$upd" $ch = Read-Host -Prompt "Want to block updates ? (Y/N)$upd"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($ch -eq 'y') { $block_update = $true } if ($ch -eq 'y') { $block_update = $true }
$ch = $null
if ($cache_on) {
Write-Host "Clear cache enabled ($number_days)"`n
$cache_install = $true
}
if ($cache_off) {
Write-Host "Clearing the cache is not enabled"`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 { do {
$ch = Read-Host -Prompt "Want to set up automatic cache cleanup? (Y/N)" $ch = Read-Host -Prompt "Want to set up automatic cache cleanup? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
if ($ch -eq 'y') { if ($ch -eq 'y') {
$cache_install = $true $cache_install = $true
do { do {
$ch = Read-Host -Prompt "Cache files that have not been used for more than XX days will be deleted. $ch = Read-Host -Prompt "Cache files that have not been used for more than XX days will be deleted.
Enter the number of days from 1 to 100" Enter the number of days from 1 to 100"`n
Write-Host ""
if (!($ch -match "^[1-9][0-9]?$|^100$")) { incorrectValue } if (!($ch -match "^[1-9][0-9]?$|^100$")) { incorrectValue }
} }
while ($ch -notmatch '^[1-9][0-9]?$|^100$') while ($ch -notmatch '^[1-9][0-9]?$|^100$')
@@ -441,6 +578,7 @@ if ($ch -eq 'n') {
remove-item $desktop_folder\Spotify.lnk -Recurse -Force remove-item $desktop_folder\Spotify.lnk -Recurse -Force
} }
} }
}
function OffPodcasts { function OffPodcasts {
@@ -473,39 +611,53 @@ function ExpFeature {
# Experimental Feature # Experimental Feature
$exp_features1 = '(Show "Made For You" entry point in the left sidebar.,default:)(!1)', '$1!0' if (!($made_for_you_off)) { $exp_features1 = '(Show "Made For You" entry point in the left sidebar.,default:)(!1)', '$1!0' }
$exp_features2 = '(Enable the new Search with chips experience",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_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_features4 = '(Enable block users feature in clientX",default:)(!1)', '$1!0'
$exp_features5 = '(Enables quicksilver in-app messaging modal",default:)(!0)', '$1!1' $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_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_features7 = '(Enables new playlist creation flow in Web Player and DesktopX",default:)(!1)', '$1!0'
$exp_features8 = '(Enable Enhance Playlist UI and functionality for end-users",default:)(!1)', '$1!0' if (!($enhance_playlist_off)) { $exp_features8 = '(Enable Enhance Playlist UI and functionality for end-users",default:)(!1)', '$1!0' }
$exp_features9 = '(Enable a condensed disography shelf on artist pages",default:)(!1)', '$1!0' if (!($new_artist_pages_off)) { $exp_features9 = '(Enable a condensed disography shelf on artist pages",default:)(!1)', '$1!0' }
$exp_features10 = '(Enable Lyrics match labels in search results",default:)(!1)', '$1!0' if (!($new_lyrics_off)) { $exp_features10 = '(Enable Lyrics match labels in search results",default:)(!1)', '$1!0' }
$exp_features11 = '(Enable Ignore In Recommendations for desktop and web",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' $exp_features12 = '(Enable Playlist Permissions flows for Prod",default:)(!1)', '$1!0'
#$exp_features13 = '(Enable Enhance Liked Songs UI and functionality",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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features1[0] in xpui.js" } if ($xpui_js -match $exp_features1[0]) { $xpui_js = $xpui_js -replace $exp_features1[0], $exp_features1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features1[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features2[0] in xpui.js" } if ($xpui_js -match $exp_features2[0]) { $xpui_js = $xpui_js -replace $exp_features2[0], $exp_features2[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features2[0] in xpui.js" }
}
if ($xpui_js -match $exp_features3[0]) { $xpui_js = $xpui_js -replace $exp_features3[0], $exp_features3[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features3[0] in xpui.js" } if ($xpui_js -match $exp_features3[0]) { $xpui_js = $xpui_js -replace $exp_features3[0], $exp_features3[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features3[0] in xpui.js" }
if ($xpui_js -match $exp_features4[0]) { $xpui_js = $xpui_js -replace $exp_features4[0], $exp_features4[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features4[0] in xpui.js" } if ($xpui_js -match $exp_features4[0]) { $xpui_js = $xpui_js -replace $exp_features4[0], $exp_features4[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features4[0] in xpui.js" }
if ($xpui_js -match $exp_features5[0]) { $xpui_js = $xpui_js -replace $exp_features5[0], $exp_features5[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features5[0] in xpui.js" } if ($xpui_js -match $exp_features5[0]) { $xpui_js = $xpui_js -replace $exp_features5[0], $exp_features5[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features5[0] in xpui.js" }
if ($xpui_js -match $exp_features6[0]) { $xpui_js = $xpui_js -replace $exp_features6[0], $exp_features6[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features6[0] in xpui.js" } if ($xpui_js -match $exp_features6[0]) { $xpui_js = $xpui_js -replace $exp_features6[0], $exp_features6[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features6[0] in xpui.js" }
if ($xpui_js -match $exp_features7[0]) { $xpui_js = $xpui_js -replace $exp_features7[0], $exp_features7[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features7[0] in xpui.js" } if ($xpui_js -match $exp_features7[0]) { $xpui_js = $xpui_js -replace $exp_features7[0], $exp_features7[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features7[0] in xpui.js" }
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features8[0] in xpui.js" } if ($xpui_js -match $exp_features8[0]) { $xpui_js = $xpui_js -replace $exp_features8[0], $exp_features8[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features8[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features9[0] in xpui.js" } if ($xpui_js -match $exp_features9[0]) { $xpui_js = $xpui_js -replace $exp_features9[0], $exp_features9[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features9[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features10[0] in xpui.js" } if ($xpui_js -match $exp_features10[0]) { $xpui_js = $xpui_js -replace $exp_features10[0], $exp_features10[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features10[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features11[0] in xpui.js" } if ($xpui_js -match $exp_features11[0]) { $xpui_js = $xpui_js -replace $exp_features11[0], $exp_features11[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features11[0] in xpui.js" }
}
if ($xpui_js -match $exp_features12[0]) { $xpui_js = $xpui_js -replace $exp_features12[0], $exp_features12[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features12[0] in xpui.js" } if ($xpui_js -match $exp_features12[0]) { $xpui_js = $xpui_js -replace $exp_features12[0], $exp_features12[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features12[0] in xpui.js" }
#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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features13[0] in xpui.js" } #if ($xpui_js -match $exp_features13[0]) { $xpui_js = $xpui_js -replace $exp_features13[0], $exp_features13[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features13[0] in xpui.js" }
#}
$xpui_js $xpui_js
} }
function ContentsHtml { function ContentsHtml {
# licenses.html minification # Minification
$html_lic_min1 = '<li><a href="#6eef7">zlib<\/a><\/li>\n(.|\n)*<\/p><!-- END CONTAINER DEPS LICENSES -->(<\/div>)' $html_lic_min1 = '<li><a href="#6eef7">zlib<\/a><\/li>\n(.|\n)*<\/p><!-- END CONTAINER DEPS LICENSES -->(<\/div>)'
$html_lic_min2 = " " $html_lic_min2 = " "
$html_lic_min3 = " " $html_lic_min3 = " "
@@ -522,10 +674,10 @@ function ContentsHtml {
Write-Host 'Patching Spotify...'`n Write-Host 'Patching Spotify...'`n
# Patching files # Patching files
if (!($premium)) {
$patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini" $patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini"
Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory" Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
}
$tempDirectory = $PWD $tempDirectory = $PWD
Pop-Location Pop-Location
@@ -600,13 +752,15 @@ if (Test-Path $xpui_js_patch) {
$reader.Close() $reader.Close()
# Turn off podcasts # Turn off podcasts
if ($Podcasts_off) { $xpui_js = OffPodcasts } if ($Podcast_off) { $xpui_js = OffPodcasts }
# Full screen mode activation and removing "Upgrade to premium" menu, upgrade button, disabling a playlist sponsor # Full screen mode activation and removing "Upgrade to premium" menu, upgrade button, disabling a playlist sponsor
if (!($premium)) {
$xpui_js = OffAdsOnFullscreen $xpui_js = OffAdsOnFullscreen
}
# Experimental Feature # Experimental Feature
$xpui_js = ExpFeature if ($exp_off) { Write-Host "Experimental features disabled"`n }
if (!($exp_off)) { $xpui_js = ExpFeature }
$writer = New-Object System.IO.StreamWriter -ArgumentList $xpui_js_patch $writer = New-Object System.IO.StreamWriter -ArgumentList $xpui_js_patch
$writer.BaseStream.SetLength(0) $writer.BaseStream.SetLength(0)
@@ -623,14 +777,18 @@ if (Test-Path $xpui_js_patch) {
$writer = New-Object System.IO.StreamWriter -ArgumentList $file_xpui_css $writer = New-Object System.IO.StreamWriter -ArgumentList $file_xpui_css
$writer.BaseStream.SetLength(0) $writer.BaseStream.SetLength(0)
$writer.Write($xpuiContents_xpui_css) $writer.Write($xpuiContents_xpui_css)
if (!($premium)) {
# Hide download icon on different pages # Hide download icon on different pages
$writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}') $writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}')
# Hide submenu item "download" # Hide submenu item "download"
$writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}') $writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}')
}
# Hide Collaborators icon # Hide Collaborators icon
if (!($hide_col_icon_off) -and !($exp_off)) {
$writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}') $writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}')
}
# Hide broken podcast menu # Hide broken podcast menu
if ($podcasts_off) { if ($podcast_off) {
$writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}') $writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}')
} }
$writer.Close() $writer.Close()
@@ -698,13 +856,15 @@ If (Test-Path $xpui_spa_patch) {
$reader.Close() $reader.Close()
# Turn off podcasts # Turn off podcasts
if ($podcasts_off) { $xpui_js = OffPodcasts } if ($podcast_off) { $xpui_js = OffPodcasts }
if (!($premium)) {
# Full screen mode activation and removing "Upgrade to premium" menu, upgrade button, disabling a playlist sponsor # Full screen mode activation and removing "Upgrade to premium" menu, upgrade button, disabling a playlist sponsor
$xpui_js = OffAdsOnFullscreen $xpui_js = OffAdsOnFullscreen
}
# Experimental Feature # Experimental Feature
$xpui_js = ExpFeature if ($exp_off) { Write-Host "Experimental features disabled"`n }
if (!($exp_off)) { $xpui_js = ExpFeature }
# Disabled logging # Disabled logging
$xpui_js = $xpui_js -replace "sp://logging/v3/\w+", "" $xpui_js = $xpui_js -replace "sp://logging/v3/\w+", ""
@@ -753,14 +913,18 @@ If (Test-Path $xpui_spa_patch) {
$writer = New-Object System.IO.StreamWriter($entry_xpui_css.Open()) $writer = New-Object System.IO.StreamWriter($entry_xpui_css.Open())
$writer.BaseStream.SetLength(0) $writer.BaseStream.SetLength(0)
$writer.Write($xpuiContents_xpui_css) $writer.Write($xpuiContents_xpui_css)
if (!($premium)) {
# Hide download icon on different pages # Hide download icon on different pages
$writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}') $writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}')
# Hide submenu item "download" # Hide submenu item "download"
$writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}') $writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}')
}
# Hide Collaborators icon # Hide Collaborators icon
if (!($hide_col_icon_off) -and !($exp_off)) {
$writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}') $writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}')
}
# Hide broken podcast menu # Hide broken podcast menu
if ($podcasts_off) { if ($podcast_off) {
$writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}') $writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}')
} }
$writer.Close() $writer.Close()
@@ -836,7 +1000,6 @@ If (Test-Path $xpui_spa_patch) {
$zip.Dispose() $zip.Dispose()
} }
# Shortcut Spotify.lnk # Shortcut Spotify.lnk
$ErrorActionPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue'
@@ -925,11 +1088,10 @@ if ($cache_install) {
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
Remove-item $infile -Recurse -Force Remove-item $infile -Recurse -Force
Rename-Item -path $outfile -NewName $infile Rename-Item -path $outfile -NewName $infile
Write-Host "installation completed"`n -ForegroundColor Green
exit
} }
} }
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }
Write-Host "installation completed"`n -ForegroundColor Green Write-Host "installation completed"`n -ForegroundColor Green
exit exit

View File

@@ -0,0 +1,6 @@
@echo off
powershell -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1')} -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -cache_off -block_update_on """" | Invoke-Expression"
pause
exit /b

View File

@@ -0,0 +1,6 @@
@echo off
powershell -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $(Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1')} -premium """" | Invoke-Expression"
pause
exit /b

View File

@@ -1,3 +1,68 @@
param (
[Parameter()]
[switch]
$podcasts_off = $false,
[Parameter()]
[switch]
$podcasts_on = $false,
[Parameter()]
[switch]
$block_update_on = $false,
[Parameter()]
[switch]
$block_update_off = $false,
[Parameter()]
[switch]
$cache_on = $false,
[int] $number_days = 7,
[Parameter()]
[switch]
$cache_off = $false,
[Parameter()]
[switch]
$confirm_uninstall_ms_spoti = $false,
[Parameter()]
[switch]
$confirm_spoti_recomended_over = $false,
[Parameter()]
[switch]
$confirm_spoti_recomended_unistall = $false,
[Parameter()]
[switch]
$premium = $false,
[Parameter()]
[switch]
$start_spoti = $false,
[Parameter()]
[switch]
$exp_off = $false,
[Parameter()]
[switch]
$hide_col_icon_off = $false,
[Parameter()]
[switch]
$made_for_you_off = $false,
[Parameter()]
[switch]
$new_search_off = $false,
[Parameter()]
[switch]
$enhance_playlist_off = $false,
[Parameter()]
[switch]
$enhance_like_off = $false,
[Parameter()]
[switch]
$new_artist_pages_off = $false,
[Parameter()]
[switch]
$new_lyrics_off = $false,
[Parameter()]
[switch]
$ignore_in_recommendations_off = $false
)
# Игнорировать ошибки из `Stop-Process` # Игнорировать ошибки из `Stop-Process`
$PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue $PSDefaultParameterValues['Stop-Process:ErrorAction'] = [System.Management.Automation.ActionPreference]::SilentlyContinue
@@ -12,13 +77,10 @@ $spotifyDirectory2 = "$env:LOCALAPPDATA\Spotify"
$spotifyExecutable = "$spotifyDirectory\Spotify.exe" $spotifyExecutable = "$spotifyDirectory\Spotify.exe"
$chrome_elf = "$spotifyDirectory\chrome_elf.dll" $chrome_elf = "$spotifyDirectory\chrome_elf.dll"
$chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll" $chrome_elf_bak = "$spotifyDirectory\chrome_elf_bak.dll"
$block_File_update = "$env:LOCALAPPDATA\Spotify\Update"
$cache_folder = "$env:APPDATA\Spotify\cache" $cache_folder = "$env:APPDATA\Spotify\cache"
$spotifyUninstall = "$env:TEMP\SpotifyUninstall.exe"
$verPS = $PSVersionTable.PSVersion.major $verPS = $PSVersionTable.PSVersion.major
$upgrade_client = $false $upgrade_client = $false
$podcasts_off = $false
$block_update = $false
$cache_install = $false
function incorrectValue { function incorrectValue {
@@ -54,6 +116,7 @@ function Check_verison_clients($param2) {
function unlockFolder { function unlockFolder {
$ErrorActionPreference = 'SilentlyContinue' $ErrorActionPreference = 'SilentlyContinue'
$block_File_update = "$env:LOCALAPPDATA\Spotify\Update"
$Check_folder = Get-ItemProperty -Path $block_File_update | Select-Object Attributes $Check_folder = Get-ItemProperty -Path $block_File_update | Select-Object Attributes
$folder_update_access = Get-Acl $block_File_update $folder_update_access = Get-Acl $block_File_update
@@ -147,9 +210,8 @@ function downloadScripts($param1) {
} }
catch [System.Management.Automation.MethodInvocationException] { catch [System.Management.Automation.MethodInvocationException] {
Write-Host "Опять ошибка, скрипт остановлен" -ForegroundColor RED Write-Host "Опять ошибка, скрипт остановлен"`n -ForegroundColor RED
$Error[0].Exception $Error[0].Exception
Write-Host ""
Write-Host "Попробуйте проверить подключение к интернету и снова запустить установку."`n Write-Host "Попробуйте проверить подключение к интернету и снова запустить установку."`n
$tempDirectory = $PWD $tempDirectory = $PWD
Pop-Location Pop-Location
@@ -187,8 +249,7 @@ Stop-Process -Name Spotify
if ($verPS -lt 3) { if ($verPS -lt 3) {
do { do {
Write-Host "Ваша версия PowerShell $verPS не поддерживается"`n Write-Host "Ваша версия PowerShell $verPS не поддерживается"`n
$ch = Read-Host -Prompt "Пожалуйста прочтите 'Outdated versions of PowerShell' `nОткрыть страницу с инструкцией ? (Y/N)" $ch = Read-Host -Prompt "Пожалуйста прочтите 'Outdated versions of PowerShell' `nОткрыть страницу с инструкцией ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
@@ -218,17 +279,22 @@ if ($win11 -or $win10 -or $win8_1 -or $win8) {
# Удалить Spotify Windows Store если он есть # Удалить Spotify Windows Store если он есть
if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) { if (Get-AppxPackage -Name SpotifyAB.SpotifyMusic) {
Write-Host 'Обнаружена версия Spotify из Microsoft Store, которая не поддерживается.'`n Write-Host 'Обнаружена версия Spotify из Microsoft Store, которая не поддерживается.'`n
if (!($confirm_uninstall_ms_spoti)) {
do { do {
$ch = Read-Host -Prompt "Хотите удалить Spotify Microsoft Store ? (Y/N) " $ch = Read-Host -Prompt "Хотите удалить Spotify Microsoft Store ? (Y/N) "`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_uninstall_ms_spoti) { $ch = 'y' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
$ProgressPreference = 'SilentlyContinue' # Скрывает Progress Bars $ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars
Write-Host 'Удаление Spotify...'`n if ($confirm_uninstall_ms_spoti) { Write-Host 'Автоматическое удаление Spotify MS...'`n }
if (!($confirm_uninstall_ms_spoti)) { Write-Host 'Удаление Spotify MS...'`n }
Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage Get-AppxPackage -Name SpotifyAB.SpotifyMusic | Remove-AppxPackage
} }
if ($ch -eq 'n') { if ($ch -eq 'n') {
@@ -242,14 +308,19 @@ if ($win11 -or $win10 -or $win8_1 -or $win8) {
Push-Location -LiteralPath $env:TEMP 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 New-Item -Type Directory -Name "SpotX_Temp-$(Get-Date -UFormat '%Y-%m-%d_%H-%M-%S')" | Convert-Path | Set-Location
if ($premium) {
Write-Host 'Модификация для премиум аккаунта...'`n
}
if (!($premium)) {
Write-Host 'Загружаю последний патч BTS...'`n Write-Host 'Загружаю последний патч BTS...'`n
downloadScripts -param1 "BTS" downloadScripts -param1 "BTS"
downloadScripts -param1 "links.tsv"
Add-Type -Assembly 'System.IO.Compression.FileSystem' Add-Type -Assembly 'System.IO.Compression.FileSystem'
$zip = [System.IO.Compression.ZipFile]::Open("$PWD\chrome_elf.zip", 'read') $zip = [System.IO.Compression.ZipFile]::Open("$PWD\chrome_elf.zip", 'read')
[System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zip, $PWD) [System.IO.Compression.ZipFileExtensions]::ExtractToDirectory($zip, $PWD)
$zip.Dispose() $zip.Dispose()
}
downloadScripts -param1 "links.tsv"
$online = Check_verison_clients -param2 "online" $online = Check_verison_clients -param2 "online"
@@ -260,32 +331,45 @@ if ($spotifyInstalled) {
$offline = Check_verison_clients -param2 "offline" $offline = Check_verison_clients -param2 "offline"
if ($online -gt $offline) { if ($online -gt $offline) {
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
Write-Host "Найдена устаревшая версия Spotify"`n
}
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Ваша версия Spotify $offline устарела, рекомендуется обновиться до $online `nОбновить ? (Y/N)" $ch = Read-Host -Prompt "Ваша версия Spotify $offline устарела, рекомендуется обновиться до $online `nОбновить ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
$ch = 'y'
Write-Host "Автоматическое обновление до рекомендуемой версии"`n
}
if ($ch -eq 'y') { if ($ch -eq 'y') {
$upgrade_client = $true $upgrade_client = $true
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Вы хотите удалить текущую версию $offline или установить поверх нее? Y [Удалить] / N [Поверх]" $ch = Read-Host -Prompt "Вы хотите удалить текущую версию $offline или установить поверх нее? Y [Удалить] / N [Поверх]"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_unistall) { $ch = 'y' }
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
Write-Host "Удаление Spotify..." Write-Host "Удаление устаревшего Spotify..."`n
Write-Host "" unlockFolder
cmd /c $spotifyExecutable /UNINSTALL /SILENT cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200 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') { $ch = $null }
} }
@@ -295,52 +379,68 @@ if ($spotifyInstalled) {
} }
if ($online -lt $offline) { if ($online -lt $offline) {
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
Write-Host "Найдена неподдерживаемая версия Spotify"`n
}
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Ваша версия Spotify $offline еще не тестировалась, стабильная версия сейчас $online. `nХотите продолжить с $offline (возможны ошибки) ? (Y/N)" $ch = Read-Host -Prompt "Ваша версия Spotify $offline еще не тестировалась, стабильная версия сейчас $online. `nХотите продолжить с $offline (возможны ошибки) ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') 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 'y') { $upgrade_client = $false }
if ($ch -eq 'n') { if ($ch -eq 'n') {
if (!($confirm_spoti_recomended_over) -or !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Хотите установить рекомендуемую $online версию ? (Y/N)" $ch = Read-Host -Prompt "Хотите установить рекомендуемую $online версию ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
$ch = 'y'
Write-Host "Автоматическое обновление до рекомендуемой версии"`n
}
if ($ch -eq 'y') { if ($ch -eq 'y') {
$upgrade_client = $true $upgrade_client = $true
$downgrading = $true $downgrading = $true
if (!($confirm_spoti_recomended_over) -and !($confirm_spoti_recomended_unistall)) {
do { do {
$ch = Read-Host -Prompt "Вы хотите удалить текущую версию $offline или установить поверх нее? Y [Удалить] / N [Поверх]" $ch = Read-Host -Prompt "Вы хотите удалить текущую версию $offline или установить поверх нее? Y [Удалить] / N [Поверх]"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { if (!($ch -eq 'n' -or $ch -eq 'y')) {
incorrectValue incorrectValue
} }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($confirm_spoti_recomended_unistall) { $ch = 'y' }
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') { if ($ch -eq 'y') {
Write-Host "Удаление Spotify..." Write-Host "Удаление неподдерживаемого Spotify..."`n
Write-Host "" unlockFolder
cmd /c $spotifyExecutable /UNINSTALL /SILENT cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200 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') { $ch = $null }
} }
if ($ch -eq 'n') { if ($ch -eq 'n') {
Write-Host "скрипт остановлен"
$tempDirectory = $PWD $tempDirectory = $PWD
Pop-Location Pop-Location
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
Remove-Item -Recurse -LiteralPath $tempDirectory Remove-Item -Recurse -LiteralPath $tempDirectory
Write-Host "скрипт остановлен"
Exit Exit
} }
} }
@@ -360,7 +460,6 @@ if (-not $spotifyInstalled -or $upgrade_client) {
unlockFolder unlockFolder
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs', 'cache' | Remove-Item -Recurse -Force Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs', 'cache' | Remove-Item -Recurse -Force
Get-ChildItem $spotifyDirectory2 -Exclude 'Users' | Remove-Item -Recurse -Force
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
# Загрузка клиента # Загрузка клиента
@@ -389,43 +488,82 @@ if ($leveldb) {
} }
# Создать резервную копию chrome_elf.dll # Создать резервную копию chrome_elf.dll
if (!(Test-Path -LiteralPath $chrome_elf_bak)) { if (!(Test-Path -LiteralPath $chrome_elf_bak) -and !($premium)) {
Move-Item $chrome_elf $chrome_elf_bak Move-Item $chrome_elf $chrome_elf_bak
} }
$ch = $null
if ($podcasts_off) {
Write-Host "Подкасты отключены"`n
$ch = 'y'
}
if ($podcasts_on) {
Write-Host "Подкасты не отключены"`n
$ch = 'n'
}
if (!($podcasts_off) -and !($podcasts_on)) {
do { do {
$ch = Read-Host -Prompt "Хотите отключить подкасты ? (Y/N)" $ch = Read-Host -Prompt "Хотите отключить подкасты ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
if ($ch -eq 'y') { $podcasts_off = $true } }
if ($ch -eq 'y') { $podcast_off = $true }
$ch = $null
if ($downgrading) { $upd = "`nУ вас было понижение версии Spotify, рекомендуется заблокировать" } if ($downgrading) { $upd = "`nУ вас было понижение версии Spotify, рекомендуется заблокировать" }
else { $upd = "" } else { $upd = "" }
if ($block_update_on) {
Write-Host "Обновления заблокированы"`n
$ch = 'y'
}
if ($block_update_off) {
Write-Host "Обновления не заблокированы"`n
$ch = 'n'
}
if (!($block_update_on) -and !($block_update_off)) {
do { do {
$ch = Read-Host -Prompt "Хотите заблокировать обновления ? (Y/N)$upd" $ch = Read-Host -Prompt "Хотите заблокировать обновления ? (Y/N)$upd"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
}
if ($ch -eq 'y') { $block_update = $true } if ($ch -eq 'y') { $block_update = $true }
$ch = $null
if ($cache_on) {
Write-Host "Очистка кеша включена ($number_days)"`n
$cache_install = $true
}
if ($cache_off) {
Write-Host "Очистска кеша не включена"`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 { do {
$ch = Read-Host -Prompt "Хотите установить автоматическую очистку кеша ? (Y/N)" $ch = Read-Host -Prompt "Хотите установить автоматическую очистку кеша ? (Y/N)"`n
Write-Host ""
if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue } if (!($ch -eq 'n' -or $ch -eq 'y')) { incorrectValue }
} }
while ($ch -notmatch '^y$|^n$') while ($ch -notmatch '^y$|^n$')
if ($ch -eq 'y') { if ($ch -eq 'y') {
$cache_install = $true $cache_install = $true
do { do {
$ch = Read-Host -Prompt "Файлы кэша, которые не использовались более XX дней, будут удалены. $ch = Read-Host -Prompt "Файлы кэша, которые не использовались более XX дней, будут удалены.
Пожалуйста, введите количество дней от 1 до 100" Пожалуйста, введите количество дней от 1 до 100"`n
Write-Host ""
if (!($ch -match "^[1-9][0-9]?$|^100$")) { incorrectValue } if (!($ch -match "^[1-9][0-9]?$|^100$")) { incorrectValue }
} }
while ($ch -notmatch '^[1-9][0-9]?$|^100$') while ($ch -notmatch '^[1-9][0-9]?$|^100$')
@@ -440,6 +578,7 @@ if ($ch -eq 'n') {
remove-item $desktop_folder\Spotify.lnk -Recurse -Force remove-item $desktop_folder\Spotify.lnk -Recurse -Force
} }
} }
}
function OffPodcasts { function OffPodcasts {
@@ -481,33 +620,47 @@ function ExpFeature {
# Эксперементальные фишки # Эксперементальные фишки
$exp_features1 = '(Show "Made For You" entry point in the left sidebar.,default:)(!1)', '$1!0' if (!($made_for_you_off)) { $exp_features1 = '(Show "Made For You" entry point in the left sidebar.,default:)(!1)', '$1!0' }
$exp_features2 = '(Enable the new Search with chips experience",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_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_features4 = '(Enable block users feature in clientX",default:)(!1)', '$1!0'
$exp_features5 = '(Enables quicksilver in-app messaging modal",default:)(!0)', '$1!1' $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_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_features7 = '(Enables new playlist creation flow in Web Player and DesktopX",default:)(!1)', '$1!0'
$exp_features8 = '(Enable Enhance Playlist UI and functionality for end-users",default:)(!1)', '$1!0' if (!($enhance_playlist_off)) { $exp_features8 = '(Enable Enhance Playlist UI and functionality for end-users",default:)(!1)', '$1!0' }
$exp_features9 = '(Enable a condensed disography shelf on artist pages",default:)(!1)', '$1!0' if (!($new_artist_pages_off)) { $exp_features9 = '(Enable a condensed disography shelf on artist pages",default:)(!1)', '$1!0' }
$exp_features10 = '(Enable Lyrics match labels in search results",default:)(!1)', '$1!0' if (!($new_lyrics_off)) { $exp_features10 = '(Enable Lyrics match labels in search results",default:)(!1)', '$1!0' }
$exp_features11 = '(Enable Ignore In Recommendations for desktop and web",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' $exp_features12 = '(Enable Playlist Permissions flows for Prod",default:)(!1)', '$1!0'
#$exp_features13 = '(Enable Enhance Liked Songs UI and functionality",default:)(!1)', '$1!0' #if (!($enhance_like_off)) {$exp_features13 = '(Enable Enhance Liked Songs UI and functionality",default:)(!1)', '$1!0'}
if ($xpui_js -match $exp_features1[0]) { $xpui_js = $xpui_js -replace $exp_features1[0], $exp_features1[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features1[0] в xpui.js" } if (!($made_for_you_off)) {
if ($xpui_js -match $exp_features2[0]) { $xpui_js = $xpui_js -replace $exp_features2[0], $exp_features2[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features2[0] в xpui.js" } if ($xpui_js -match $exp_features1[0]) { $xpui_js = $xpui_js -replace $exp_features1[0], $exp_features1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features1[0] in xpui.js" }
if ($xpui_js -match $exp_features3[0]) { $xpui_js = $xpui_js -replace $exp_features3[0], $exp_features3[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features3[0] в xpui.js" } }
if ($xpui_js -match $exp_features4[0]) { $xpui_js = $xpui_js -replace $exp_features4[0], $exp_features4[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features4[0] в xpui.js" } if (!($new_search_off)) {
if ($xpui_js -match $exp_features5[0]) { $xpui_js = $xpui_js -replace $exp_features5[0], $exp_features5[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features5[0] в xpui.js" } if ($xpui_js -match $exp_features2[0]) { $xpui_js = $xpui_js -replace $exp_features2[0], $exp_features2[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features2[0] in xpui.js" }
if ($xpui_js -match $exp_features6[0]) { $xpui_js = $xpui_js -replace $exp_features6[0], $exp_features6[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features6[0] в xpui.js" } }
if ($xpui_js -match $exp_features7[0]) { $xpui_js = $xpui_js -replace $exp_features7[0], $exp_features7[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features7[0] в xpui.js" } if ($xpui_js -match $exp_features3[0]) { $xpui_js = $xpui_js -replace $exp_features3[0], $exp_features3[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features3[0] in xpui.js" }
if ($xpui_js -match $exp_features8[0]) { $xpui_js = $xpui_js -replace $exp_features8[0], $exp_features8[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features8[0] в xpui.js" } if ($xpui_js -match $exp_features4[0]) { $xpui_js = $xpui_js -replace $exp_features4[0], $exp_features4[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features4[0] in xpui.js" }
if ($xpui_js -match $exp_features9[0]) { $xpui_js = $xpui_js -replace $exp_features9[0], $exp_features9[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features9[0] в xpui.js" } if ($xpui_js -match $exp_features5[0]) { $xpui_js = $xpui_js -replace $exp_features5[0], $exp_features5[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features5[0] in xpui.js" }
if ($xpui_js -match $exp_features10[0]) { $xpui_js = $xpui_js -replace $exp_features10[0], $exp_features10[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features10[0] в xpui.js" } if ($xpui_js -match $exp_features6[0]) { $xpui_js = $xpui_js -replace $exp_features6[0], $exp_features6[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features6[0] in xpui.js" }
if ($xpui_js -match $exp_features11[0]) { $xpui_js = $xpui_js -replace $exp_features11[0], $exp_features11[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features11[0] в xpui.js" } if ($xpui_js -match $exp_features7[0]) { $xpui_js = $xpui_js -replace $exp_features7[0], $exp_features7[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features7[0] in xpui.js" }
if ($xpui_js -match $exp_features12[0]) { $xpui_js = $xpui_js -replace $exp_features12[0], $exp_features12[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features12[0] в xpui.js" } if (!($enhance_playlist_off)) {
#if ($xpui_js -match $exp_features13[0]) { $xpui_js = $xpui_js -replace $exp_features13[0], $exp_features13[1] } else { Write-Host "Не нашел " -ForegroundColor red -NoNewline; Write-Host "переменную `$exp_features13[0] в xpui.js" } if ($xpui_js -match $exp_features8[0]) { $xpui_js = $xpui_js -replace $exp_features8[0], $exp_features8[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features8[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features9[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features10[0] in xpui.js" }
}
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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features11[0] in xpui.js" }
}
if ($xpui_js -match $exp_features12[0]) { $xpui_js = $xpui_js -replace $exp_features12[0], $exp_features12[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features12[0] in xpui.js" }
#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 "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$exp_features13[0] in xpui.js" }
#}
$xpui_js $xpui_js
} }
@@ -615,9 +768,10 @@ function RuTranslate {
Write-Host 'Модифицирую Spotify...'`n Write-Host 'Модифицирую Spotify...'`n
# Модифицируем файлы # Модифицируем файлы
if (!($premium)) {
$patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini" $patchFiles = "$PWD\chrome_elf.dll", "$PWD\config.ini"
Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory" Copy-Item -LiteralPath $patchFiles -Destination "$spotifyDirectory"
}
$tempDirectory = $PWD $tempDirectory = $PWD
Pop-Location Pop-Location
@@ -706,14 +860,15 @@ if (Test-Path $xpui_js_patch) {
$reader.Close() $reader.Close()
# Отключить подкасты # Отключить подкасты
if ($Podcasts_off) { $xpui_js = OffPodcasts } if ($Podcast_off) { $xpui_js = OffPodcasts }
# Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium", # Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium", отключиние спонсорской рекламы в некоторых плейлистах, удаление пустого рекламного блока.
# отключиние спонсорской рекламы в некоторых плейлистах, удаление пустого рекламного блока. if (!($premium)) {
$xpui_js = OffAdsOnFullscreen $xpui_js = OffAdsOnFullscreen
}
# Экспереметальные функции # Экспереметальные функции
$xpui_js = ExpFeature if ($exp_off) { Write-Host "Экспереметальные функции отключены"`n }
if (!($exp_off)) { $xpui_js = ExpFeature }
# Удалить из xpui.js все языки кроме En и Ru # Удалить из xpui.js все языки кроме En и Ru
$xpui_js = OffRujs $xpui_js = OffRujs
@@ -744,14 +899,18 @@ if (Test-Path $xpui_js_patch) {
$writer = New-Object System.IO.StreamWriter -ArgumentList $file_xpui_css $writer = New-Object System.IO.StreamWriter -ArgumentList $file_xpui_css
$writer.BaseStream.SetLength(0) $writer.BaseStream.SetLength(0)
$writer.Write($xpuiContents_xpui_css) $writer.Write($xpuiContents_xpui_css)
if (!($premium)) {
# Скрыть иконку скачивание на разных страницах # Скрыть иконку скачивание на разных страницах
$writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}') $writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH{display:none}')
# Скрыть подменю "загрузка" # Скрыть подменю "загрузка"
$writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}') $writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA{display:none}')
}
# Скрыть иконку соавторов # Скрыть иконку соавторов
if (!($hide_col_icon_off) -and !($exp_off)) {
$writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}') $writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}')
}
# Скрыть сломанное меню подкастов # Скрыть сломанное меню подкастов
if ($podcasts_off) { if ($podcast_off) {
$writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}') $writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"]{display:none}')
} }
$writer.Close() $writer.Close()
@@ -785,7 +944,6 @@ If (Test-Path $xpui_spa_patch) {
$zip.Dispose() $zip.Dispose()
if ($test_bak_spa) { if ($test_bak_spa) {
Remove-Item $xpui_spa_patch -Recurse -Force Remove-Item $xpui_spa_patch -Recurse -Force
Rename-Item $bak_spa $xpui_spa_patch Rename-Item $bak_spa $xpui_spa_patch
@@ -800,6 +958,12 @@ If (Test-Path $xpui_spa_patch) {
Write-Host "SpotX уже был установлен, xpui.bak не найден. `nУдалите клиент Spotify и снова запустите Install_Rus.bat, скрипт остановлен."`n Write-Host "SpotX уже был установлен, xpui.bak не найден. `nУдалите клиент Spotify и снова запустите Install_Rus.bat, скрипт остановлен."`n
exit exit
} }
$spotify_exe_bak_patch = "$env:APPDATA\Spotify\Spotify.bak"
$test_spotify_exe_bak = Test-Path -Path $spotify_exe_bak_patch
if ($test_spotify_exe_bak) {
Remove-Item $spotifyExecutable -Recurse -Force
Rename-Item $spotify_exe_bak_patch $spotifyExecutable
}
} }
$zip.Dispose() $zip.Dispose()
Copy-Item $xpui_spa_patch $env:APPDATA\Spotify\Apps\xpui.bak Copy-Item $xpui_spa_patch $env:APPDATA\Spotify\Apps\xpui.bak
@@ -837,14 +1001,16 @@ If (Test-Path $xpui_spa_patch) {
$reader.Close() $reader.Close()
# Отключить подкасты # Отключить подкасты
if ($podcasts_off) { $xpui_js = OffPodcasts } if ($podcast_off) { $xpui_js = OffPodcasts }
# Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium", if (!($premium)) {
# отключиние спонсорской рекламы в некоторых плейлистах, удаление пустого рекламного блока. # Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium", отключиние спонсорской рекламы в некоторых плейлистах, удаление пустого рекламного блока.
$xpui_js = OffAdsOnFullscreen $xpui_js = OffAdsOnFullscreen
}
# Экспереметальные функции # Экспереметальные функции
$xpui_js = ExpFeature if ($exp_off) { Write-Host "Экспереметальные функции отключены"`n }
if (!($exp_off)) { $xpui_js = ExpFeature }
# Удалить из xpui.js все языки кроме En и Ru # Удалить из xpui.js все языки кроме En и Ru
$xpui_js = OffRujs $xpui_js = OffRujs
@@ -896,14 +1062,18 @@ If (Test-Path $xpui_spa_patch) {
$writer = New-Object System.IO.StreamWriter($entry_xpui_css.Open()) $writer = New-Object System.IO.StreamWriter($entry_xpui_css.Open())
$writer.BaseStream.SetLength(0) $writer.BaseStream.SetLength(0)
$writer.Write($xpuiContents_xpui_css) $writer.Write($xpuiContents_xpui_css)
if (!($premium)) {
# Скрыть иконку скачивание на разных страницах # Скрыть иконку скачивание на разных страницах
$writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH {display: none}') $writer.Write([System.Environment]::NewLine + ' .BKsbV2Xl786X9a09XROH {display: none}')
# Скрыть подменю "загрузка" # Скрыть подменю "загрузка"
$writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA {display: none}') $writer.Write([System.Environment]::NewLine + ' button.wC9sIed7pfp47wZbmU6m.pzkhLqffqF_4hucrVVQA {display: none}')
}
# Скрыть иконку соавторов # Скрыть иконку соавторов
if (!($hide_col_icon_off) -and !($exp_off)) {
$writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}') $writer.Write([System.Environment]::NewLine + ' .X1lXSiVj0pzhQCUo_72A{display:none}')
}
# Скрыть сломанное меню подкастов # Скрыть сломанное меню подкастов
if ($podcasts_off) { if ($podcast_off) {
$writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"] {display: none}') $writer.Write([System.Environment]::NewLine + ' li.OEFWODerafYHGp09iLlA [href="/collection/podcasts"] {display: none}')
} }
$writer.Close() $writer.Close()
@@ -1087,11 +1257,10 @@ if ($cache_install) {
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200
Remove-item $infile -Recurse -Force Remove-item $infile -Recurse -Force
Rename-Item -path $outfile -NewName $infile Rename-Item -path $outfile -NewName $infile
Write-Host "Установка завершена"`n -ForegroundColor Green
exit
} }
} }
if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }
Write-Host "Установка завершена"`n -ForegroundColor Green Write-Host "Установка завершена"`n -ForegroundColor Green
exit exit

View File

@@ -43,6 +43,11 @@
<h1>Fast installation / Update:</h1> <h1>Fast installation / Update:</h1>
<details>
<summary><small>Usual installation</small></summary><p>
<h4>During installation, you need to confirm some actions</h4>
* Just download and run [Install.bat](https://cutt.ly/PErptD8) * Just download and run [Install.bat](https://cutt.ly/PErptD8)
or or
@@ -52,6 +57,60 @@ or
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1' | iex [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1' | iex
``` ```
</details>
<details>
<summary><small>Automatic installation</small></summary><p>
<h4>Automatic installation without confirmation (remove Spotify MS, install over recommended version, remove podcasts from homepage, block updates, no cache clear installation)</h4>
* Just download and run [Install_Auto.bat](https://raw.githack.com/amd64fox/SpotX/blob/main/Cache/Install_Auto.bat)
or
```ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $(iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -cache_off -block_update_on"
```
</details>
<details>
<summary><small>Installation for premium</small></summary><p>
<h4>Usual installation only without ad blocking, for those who have a premium account</h4>
* Just download and run [Install_Prem.bat]([https://cutt.ly/PErptD8](https://raw.githack.com/amd64fox/SpotX/blob/main/Cache/Install_Prem.bat)
or
* Run The following command in PowerShell:
```ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iex "& { $(iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1') } -premium"
```
</details>
<details>
<summary><small>Русский установщик</small></summary><p>
<h4>Обычный установщик с подтверждениями на русском языке</h4>
* Скачайте и запустите [Install_Rus.bat](https://cutt.ly/ZEnk1qf)
или
* Запустите следующую строку напрямую в терминале PowerShell:
```ps1
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; iwr -useb 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install_Rus.ps1' | iex
```
</details>
<h1>Uninstall:</h1> <h1>Uninstall:</h1>
* Just run [Uninstall.bat](https://cutt.ly/dErpPEK) * Just run [Uninstall.bat](https://cutt.ly/dErpPEK)