mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-08-12 02:51:09 +10:00
Update Install.ps1
- Added a rule if the "desktop" folder was not found - added possible answer options
This commit is contained in:
+55
-14
@@ -199,12 +199,18 @@ If (!($file_css -match 'patched by spotx')) {
|
|||||||
Rename-Item -path $env:APPDATA\Spotify\Apps\xpui.zip -NewName $env:APPDATA\Spotify\Apps\xpui.spa
|
Rename-Item -path $env:APPDATA\Spotify\Apps\xpui.zip -NewName $env:APPDATA\Spotify\Apps\xpui.spa
|
||||||
Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse
|
Remove-item $env:APPDATA\Spotify\Apps\temporary -Recurse
|
||||||
|
|
||||||
|
|
||||||
# Shortcut bug
|
# Shortcut bug
|
||||||
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
|
|
||||||
If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
||||||
|
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
|
$WorkingDir = "$env:APPDATA\Spotify"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$Shortcut = $WshShell.CreateShortcut($target)
|
||||||
|
$Shortcut.WorkingDirectory = $WorkingDir
|
||||||
$Shortcut.TargetPath = $source
|
$Shortcut.TargetPath = $source
|
||||||
$Shortcut.Save()
|
$Shortcut.Save()
|
||||||
}
|
}
|
||||||
@@ -212,6 +218,7 @@ If (!(Test-Path $env:USERPROFILE\Desktop\Spotify.lnk)) {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Block updates
|
# Block updates
|
||||||
|
|
||||||
$ErrorActionPreference = 'SilentlyContinue' # Команда гасит легкие ошибки
|
$ErrorActionPreference = 'SilentlyContinue' # Команда гасит легкие ошибки
|
||||||
@@ -297,6 +304,8 @@ if ($ch -eq 'n') {
|
|||||||
|
|
||||||
if ($ch -eq 'u') {
|
if ($ch -eq 'u') {
|
||||||
|
|
||||||
|
If ($migrator_bak -and $Check_folder_file -match '\bSystem\b' -and $Check_folder_file -match '\bReadOnly\b') {
|
||||||
|
|
||||||
|
|
||||||
If ($update_directory_file) {
|
If ($update_directory_file) {
|
||||||
Remove-item $env:LOCALAPPDATA\Spotify\Update -Recurse -Force
|
Remove-item $env:LOCALAPPDATA\Spotify\Update -Recurse -Force
|
||||||
@@ -308,8 +317,12 @@ if ($ch -eq 'u') {
|
|||||||
Rename-Item -path $env:APPDATA\Spotify\SpotifyMigrator.bak -NewName $env:APPDATA\Spotify\SpotifyMigrator.exe
|
Rename-Item -path $env:APPDATA\Spotify\SpotifyMigrator.bak -NewName $env:APPDATA\Spotify\SpotifyMigrator.exe
|
||||||
}
|
}
|
||||||
Write-Host "Updates unlocked" -ForegroundColor Green
|
Write-Host "Updates unlocked" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
If (!($migrator_bak -and $Check_folder_file -match '\bSystem\b' -and $Check_folder_file -match '\bReadOnly\b')) {
|
||||||
|
Write-Host "Oops, updates are not blocked"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,6 +342,12 @@ if ($ch -eq 'y') {
|
|||||||
|
|
||||||
$test_cache_spotify_ps = Test-Path -Path $env:APPDATA\Spotify\cache-spotify.ps1
|
$test_cache_spotify_ps = Test-Path -Path $env:APPDATA\Spotify\cache-spotify.ps1
|
||||||
$test_spotify_vbs = Test-Path -Path $env:APPDATA\Spotify\Spotify.vbs
|
$test_spotify_vbs = Test-Path -Path $env:APPDATA\Spotify\Spotify.vbs
|
||||||
|
$desktop_folder = Get-ItemProperty -Path $env:USERPROFILE\Desktop | SELECT Attributes
|
||||||
|
|
||||||
|
|
||||||
|
# Если папки по умолчанию Dekstop не существует, то установку кэша отменить.
|
||||||
|
if ($desktop_folder -match '\bDirectory\b') {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If ($test_cache_spotify_ps) {
|
If ($test_cache_spotify_ps) {
|
||||||
@@ -346,14 +365,22 @@ if ($ch -eq 'y') {
|
|||||||
# Spotify.vbs
|
# Spotify.vbs
|
||||||
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/Spotify.vbs', "$env:APPDATA\Spotify\Spotify.vbs")
|
$webClient.DownloadFile('https://raw.githubusercontent.com/amd64fox/SpotX/main/Spotify.vbs', "$env:APPDATA\Spotify\Spotify.vbs")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Spotify.lnk
|
# Spotify.lnk
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.vbs"
|
$source2 = "$env:APPDATA\Spotify\Spotify.vbs"
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
$target2 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WorkingDir2 = "$env:APPDATA\Spotify"
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$WshShell2 = New-Object -comObject WScript.Shell
|
||||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
$Shortcut2 = $WshShell2.CreateShortcut($target2)
|
||||||
$Shortcut.TargetPath = $source
|
$Shortcut2.WorkingDirectory = $WorkingDir2
|
||||||
$Shortcut.Save()
|
$Shortcut2.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
|
$Shortcut2.TargetPath = $source2
|
||||||
|
$Shortcut2.Save()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$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"
|
||||||
@@ -392,7 +419,13 @@ if ($ch -eq 'y') {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Write-Host "Error, i can't find the 'Desktop' folder" -ForegroundColor Red
|
||||||
|
Write-Host "Installation completed" -ForegroundColor Green
|
||||||
|
|
||||||
|
Exit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($ch -eq 'n') {
|
if ($ch -eq 'n') {
|
||||||
@@ -410,17 +443,25 @@ if ($ch -eq 'u') {
|
|||||||
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
Remove-item $env:APPDATA\Spotify\cache-spotify.ps1 -Recurse -Force
|
||||||
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
Remove-item $env:APPDATA\Spotify\Spotify.vbs -Recurse -Force
|
||||||
|
|
||||||
$source = "$env:APPDATA\Spotify\Spotify.exe"
|
$source3 = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
$target = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
$target3 = "$env:USERPROFILE\Desktop\Spotify.lnk"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WorkingDir3 = "$env:APPDATA\Spotify"
|
||||||
$Shortcut = $WshShell.CreateShortcut($target)
|
$WshShell3 = New-Object -comObject WScript.Shell
|
||||||
$Shortcut.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
$Shortcut3 = $WshShell3.CreateShortcut($target3)
|
||||||
$Shortcut.TargetPath = $source
|
$Shortcut3.WorkingDirectory = $WorkingDir3
|
||||||
$Shortcut.Save()
|
$Shortcut3.IconLocation = "$env:APPDATA\Spotify\Spotify.exe"
|
||||||
|
$Shortcut3.TargetPath = $source3
|
||||||
|
$Shortcut3.Save()
|
||||||
Write-Host "Cache cleanup script removed" -ForegroundColor Green
|
Write-Host "Cache cleanup script removed" -ForegroundColor Green
|
||||||
Write-Host "Installation completed" -ForegroundColor Green
|
Write-Host "Installation completed" -ForegroundColor Green
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If (!($test_cache_spotify_ps -and $test_spotify_vbs)) {
|
If (!($test_cache_spotify_ps -and $test_spotify_vbs)) {
|
||||||
Write-Host "Oops, no cache clearing script found"
|
Write-Host "Oops, no cache clearing script found"
|
||||||
Write-Host "Installation completed" -ForegroundColor Green
|
Write-Host "Installation completed" -ForegroundColor Green
|
||||||
|
|||||||
Reference in New Issue
Block a user