mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-06-21 14:40:55 +10:00
Update
- Fixing repeated requests to README.md - minor fixes
This commit is contained in:
+46
-65
@@ -371,28 +371,6 @@ function incorrectValue {
|
|||||||
Clear-Host
|
Clear-Host
|
||||||
}
|
}
|
||||||
|
|
||||||
function Check_verison_clients($param2) {
|
|
||||||
|
|
||||||
# Checking the recommended version for spotx
|
|
||||||
if ($param2 -eq "online") {
|
|
||||||
$ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars
|
|
||||||
$readme = Invoke-WebRequest -UseBasicParsing -Uri https://raw.githubusercontent.com/SpotX-CLI/SpotX-Win/main/README.md
|
|
||||||
$v = $readme.RawContent | Select-String "Recommended official version \[\d+\.\d+\.\d+\.\d+\]" -AllMatches
|
|
||||||
$ver = $v.Matches.Value
|
|
||||||
$ver = $ver -replace 'Recommended official version \[(\d+\.\d+\.\d+\.\d+)\]', '$1'
|
|
||||||
return $ver
|
|
||||||
}
|
|
||||||
# Check version Spotify offline
|
|
||||||
if ($param2 -eq "offline") {
|
|
||||||
$check_offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion
|
|
||||||
return $check_offline
|
|
||||||
}
|
|
||||||
# Check version Spotify.bak
|
|
||||||
if ($param2 -eq "Spotify.bak") {
|
|
||||||
$check_offline_bak = (Get-Item $exe_bak).VersionInfo.FileVersion
|
|
||||||
return $check_offline_bak
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function unlockFolder {
|
function unlockFolder {
|
||||||
|
|
||||||
$ErrorActionPreference = 'SilentlyContinue'
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
@@ -420,10 +398,9 @@ function downloadScripts($param1) {
|
|||||||
if ($param1 -eq "Desktop") {
|
if ($param1 -eq "Desktop") {
|
||||||
Import-Module BitsTransfer
|
Import-Module BitsTransfer
|
||||||
|
|
||||||
$ver = Check_verison_clients -param2 "online"
|
|
||||||
$l = "$PWD\links.tsv"
|
$l = "$PWD\links.tsv"
|
||||||
$old = [IO.File]::ReadAllText($l)
|
$old = [IO.File]::ReadAllText($l)
|
||||||
$links = $old -match "https:\/\/upgrade.scdn.co\/upgrade\/client\/win32-x86\/spotify_installer-$ver\.g[0-9a-f]{8}-[0-9]{1,4}\.exe"
|
$links = $old -match "https:\/\/upgrade.scdn.co\/upgrade\/client\/win32-x86\/spotify_installer-$online\.g[0-9a-f]{8}-[0-9]{1,4}\.exe"
|
||||||
$links = $Matches.Values
|
$links = $Matches.Values
|
||||||
}
|
}
|
||||||
if ($ru -and $param1 -eq "cache-spotify") {
|
if ($ru -and $param1 -eq "cache-spotify") {
|
||||||
@@ -452,7 +429,6 @@ function downloadScripts($param1) {
|
|||||||
if ($param1 -eq "Desktop") {
|
if ($param1 -eq "Desktop") {
|
||||||
try { if (curl.exe -V) { $curl_check = $true } }
|
try { if (curl.exe -V) { $curl_check = $true } }
|
||||||
catch { $curl_check = $false }
|
catch { $curl_check = $false }
|
||||||
$vernew = Check_verison_clients -param2 "online"
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if ($param1 -eq "Desktop" -and $curl_check) {
|
if ($param1 -eq "Desktop" -and $curl_check) {
|
||||||
@@ -462,7 +438,7 @@ function downloadScripts($param1) {
|
|||||||
}
|
}
|
||||||
if ($param1 -eq "Desktop" -and $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) {
|
if ($param1 -eq "Desktop" -and $null -ne (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) {
|
||||||
$ProgressPreference = 'Continue'
|
$ProgressPreference = 'Continue'
|
||||||
Start-BitsTransfer -Source $web_Url -Destination $local_Url -DisplayName ($lang).Download5 -Description "$vernew "
|
Start-BitsTransfer -Source $web_Url -Destination $local_Url -DisplayName ($lang).Download5 -Description "$online "
|
||||||
}
|
}
|
||||||
if ($param1 -eq "Desktop" -and $null -eq (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) {
|
if ($param1 -eq "Desktop" -and $null -eq (Get-Module -Name BitsTransfer -ListAvailable) -and !($curl_check )) {
|
||||||
$webClient.DownloadFile($web_Url, $local_Url)
|
$webClient.DownloadFile($web_Url, $local_Url)
|
||||||
@@ -533,6 +509,19 @@ function DesktopFolder {
|
|||||||
return $desktop_folder
|
return $desktop_folder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Checking the recommended version for spotx
|
||||||
|
$ProgressPreference = 'SilentlyContinue' # Hiding Progress Bars
|
||||||
|
$readme = Invoke-WebRequest -UseBasicParsing -Uri https://raw.githubusercontent.com/SpotX-CLI/SpotX-Win/main/README.md
|
||||||
|
$match = $readme.RawContent | Select-String "Recommended official version \[\d+\.\d+\.\d+\.\d+\]" -AllMatches
|
||||||
|
$ver = $match.Matches.Value
|
||||||
|
$online = $ver -replace 'Recommended official version \[(\d+\.\d+\.\d+\.\d+)\]', '$1'
|
||||||
|
|
||||||
|
# Check version Spotify offline
|
||||||
|
$offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion
|
||||||
|
|
||||||
|
# Check version Spotify.bak
|
||||||
|
$offline_bak = (Get-Item $exe_bak).VersionInfo.FileVersion
|
||||||
|
|
||||||
# add Tls12
|
# add Tls12
|
||||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||||
|
|
||||||
@@ -623,15 +612,10 @@ if (!($premium) -and $bts) {
|
|||||||
}
|
}
|
||||||
downloadScripts -param1 "links.tsv"
|
downloadScripts -param1 "links.tsv"
|
||||||
|
|
||||||
|
|
||||||
$online = Check_verison_clients -param2 "online"
|
|
||||||
|
|
||||||
$spotifyInstalled = (Test-Path -LiteralPath $spotifyExecutable)
|
$spotifyInstalled = (Test-Path -LiteralPath $spotifyExecutable)
|
||||||
|
|
||||||
if ($spotifyInstalled) {
|
if ($spotifyInstalled) {
|
||||||
|
|
||||||
$offline = Check_verison_clients -param2 "offline"
|
|
||||||
|
|
||||||
# Old version Spotify
|
# Old version Spotify
|
||||||
if ($online -gt $offline) {
|
if ($online -gt $offline) {
|
||||||
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
|
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
|
||||||
@@ -686,7 +670,6 @@ if ($spotifyInstalled) {
|
|||||||
|
|
||||||
# Unsupported version Spotify
|
# Unsupported version Spotify
|
||||||
if ($online -lt $offline) {
|
if ($online -lt $offline) {
|
||||||
|
|
||||||
# Submit unsupported version of Spotify to google form for further processing
|
# Submit unsupported version of Spotify to google form for further processing
|
||||||
try {
|
try {
|
||||||
$txt = [IO.File]::ReadAllText($spotifyExecutable)
|
$txt = [IO.File]::ReadAllText($spotifyExecutable)
|
||||||
@@ -697,17 +680,17 @@ if ($spotifyInstalled) {
|
|||||||
Uri = 'https://docs.google.com/forms/d/e/1FAIpQLSegGsAgilgQ8Y36uw-N7zFF6Lh40cXNfyl1ecHPpZcpD8kdHg/formResponse'
|
Uri = 'https://docs.google.com/forms/d/e/1FAIpQLSegGsAgilgQ8Y36uw-N7zFF6Lh40cXNfyl1ecHPpZcpD8kdHg/formResponse'
|
||||||
Method = 'POST'
|
Method = 'POST'
|
||||||
Body = @{
|
Body = @{
|
||||||
'entry.620327948' = $version
|
'entry.620327948' = $version
|
||||||
'entry.1402903593' = $win_os
|
'entry.1402903593' = $win_os
|
||||||
'entry.860691305' = $psv
|
'entry.860691305' = $psv
|
||||||
'entry.2067427976' = $online + " меньше чем " + $offline
|
'entry.2067427976' = $online + " меньше чем " + $offline
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Invoke-WebRequest @Parameters | Out-Null
|
Invoke-WebRequest -UseBasicParsing @Parameters | Out-Null
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host 'Unable to submit new version of Spotify'
|
Write-Host 'Unable to submit new version of Spotify'
|
||||||
Write-Host "error description: $Error"
|
Write-Host "error description: "$Error[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
|
if ($confirm_spoti_recomended_over -or $confirm_spoti_recomended_unistall) {
|
||||||
@@ -808,6 +791,12 @@ if (-not $spotifyInstalled -or $upgrade_client) {
|
|||||||
while (-not (get-process | Where-Object { $_.ProcessName -eq 'SpotifySetup' })) {}
|
while (-not (get-process | Where-Object { $_.ProcessName -eq 'SpotifySetup' })) {}
|
||||||
wait-process -name SpotifySetup
|
wait-process -name SpotifySetup
|
||||||
Stop-Process -Name Spotify
|
Stop-Process -Name Spotify
|
||||||
|
|
||||||
|
# Upgrade check version Spotify offline
|
||||||
|
$offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion
|
||||||
|
|
||||||
|
# Upgrade check version Spotify.bak
|
||||||
|
$offline_bak = (Get-Item $exe_bak).VersionInfo.FileVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
# Delete Spotify shortcut if it is on desktop
|
# Delete Spotify shortcut if it is on desktop
|
||||||
@@ -881,9 +870,7 @@ if ($ch -eq 'y') { $block_update = $true }
|
|||||||
|
|
||||||
if ($ch -eq 'n') {
|
if ($ch -eq 'n') {
|
||||||
$ErrorActionPreference = 'SilentlyContinue'
|
$ErrorActionPreference = 'SilentlyContinue'
|
||||||
$exe_onl_fn = Check_verison_clients -param2 "offline"
|
if ((Test-Path -LiteralPath $exe_bak) -and $offline -eq $offline_bak) {
|
||||||
$exe_bak_fn = Check_verison_clients -param2 'Spotify.bak'
|
|
||||||
if ((Test-Path -LiteralPath $exe_bak) -and $exe_onl_fn -eq $exe_bak_fn) {
|
|
||||||
Remove-Item $spotifyExecutable -Recurse -Force
|
Remove-Item $spotifyExecutable -Recurse -Force
|
||||||
Rename-Item $exe_bak $spotifyExecutable
|
Rename-Item $exe_bak $spotifyExecutable
|
||||||
}
|
}
|
||||||
@@ -943,7 +930,6 @@ if ($exp_spotify) { Write-Host ($lang).ExpSpotify`n }
|
|||||||
|
|
||||||
$url = "https://raw.githubusercontent.com/SpotX-CLI/SpotX-commons/main/patches.json"
|
$url = "https://raw.githubusercontent.com/SpotX-CLI/SpotX-commons/main/patches.json"
|
||||||
$webjson = (Invoke-WebRequest -UseBasicParsing -Uri $url).Content | ConvertFrom-Json
|
$webjson = (Invoke-WebRequest -UseBasicParsing -Uri $url).Content | ConvertFrom-Json
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
|
||||||
|
|
||||||
function Helper($paramname) {
|
function Helper($paramname) {
|
||||||
|
|
||||||
@@ -1014,7 +1000,7 @@ function Helper($paramname) {
|
|||||||
"OffadsonFullscreen" {
|
"OffadsonFullscreen" {
|
||||||
# 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 ($bts) { $webjson.free.psobject.properties.remove('bilboard'), $webjson.free.psobject.properties.remove('audioads') }
|
if ($bts) { $webjson.free.psobject.properties.remove('bilboard'), $webjson.free.psobject.properties.remove('audioads') }
|
||||||
if ($ofline -ge "1.1.98.683") { $webjson.free.psobject.properties.remove('connectold') }
|
if ($offline -ge "1.1.98.683") { $webjson.free.psobject.properties.remove('connectold') }
|
||||||
$name = "patches.json.free."
|
$name = "patches.json.free."
|
||||||
$n = "xpui.js"
|
$n = "xpui.js"
|
||||||
$contents = $webjson.free.psobject.properties.name
|
$contents = $webjson.free.psobject.properties.name
|
||||||
@@ -1023,9 +1009,9 @@ function Helper($paramname) {
|
|||||||
"OffPodcasts" {
|
"OffPodcasts" {
|
||||||
# Turn off podcasts
|
# Turn off podcasts
|
||||||
$n = $js
|
$n = $js
|
||||||
if ($ofline -le "1.1.92.647") { $podcats = "podcastsoff" }
|
if ($offline -le "1.1.92.647") { $podcats = "podcastsoff" }
|
||||||
if ($ofline -ge "1.1.93.896" -and $ofline -le "1.1.96.785") { $podcats = "podcastsoff2" }
|
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.96.785") { $podcats = "podcastsoff2" }
|
||||||
if ($ofline -ge "1.1.97.952") { $podcats = "podcastsoff3" }
|
if ($offline -ge "1.1.97.952") { $podcats = "podcastsoff3" }
|
||||||
$name = "patches.json.others."
|
$name = "patches.json.others."
|
||||||
$contents = $podcats
|
$contents = $podcats
|
||||||
$json = $webjson.others
|
$json = $webjson.others
|
||||||
@@ -1054,18 +1040,18 @@ function Helper($paramname) {
|
|||||||
# Experimental Feature Standart
|
# Experimental Feature Standart
|
||||||
$rem = $webjson.exp.psobject.properties
|
$rem = $webjson.exp.psobject.properties
|
||||||
|
|
||||||
if ( $ofline -le "1.1.96.785") { $rem.remove('newhome2'); $newhome = 'newhome' }
|
if ( $offline -le "1.1.96.785") { $rem.remove('newhome2'); $newhome = 'newhome' }
|
||||||
if ( $ofline -ge "1.1.97.956") { $rem.remove('newhome'); $newhome = 'newhome2' }
|
if ( $offline -ge "1.1.97.956") { $rem.remove('newhome'); $newhome = 'newhome2' }
|
||||||
if ( $ofline -ge "1.1.99.871") { $rem.remove('clearcache') }
|
if ( $offline -ge "1.1.99.871") { $rem.remove('clearcache') }
|
||||||
if ( $ofline -le "1.1.98.691") { $rem.remove('sidebar-fix') }
|
if ( $offline -le "1.1.98.691") { $rem.remove('sidebar-fix') }
|
||||||
if ($enhance_like_off) { $rem.remove('enhanceliked') }
|
if ($enhance_like_off) { $rem.remove('enhanceliked') }
|
||||||
if ($enhance_playlist_off) { $rem.remove('enhanceplaylist') }
|
if ($enhance_playlist_off) { $rem.remove('enhanceplaylist') }
|
||||||
if ($new_artist_pages_off) { $rem.remove('disographyartist') }
|
if ($new_artist_pages_off) { $rem.remove('disographyartist') }
|
||||||
if ($new_lyrics_off) { $rem.remove('lyricsmatch') }
|
if ($new_lyrics_off) { $rem.remove('lyricsmatch') }
|
||||||
if ($equalizer_off) { $rem.remove('equalizer') }
|
if ($equalizer_off) { $rem.remove('equalizer') }
|
||||||
if (!($device_picker_old) -or $ofline -ge "1.1.98.683") { $rem.remove('devicepickerold') }
|
if (!($device_picker_old) -or $offline -ge "1.1.98.683") { $rem.remove('devicepickerold') }
|
||||||
if ($made_for_you_off -or $ofline -ge "1.1.96.783") { $rem.remove('madeforyou') }
|
if ($made_for_you_off -or $offline -ge "1.1.96.783") { $rem.remove('madeforyou') }
|
||||||
if ($ofline -lt "1.1.98.683") { $rem.remove('rightsidebar'), $rem.remove('addingplaylist') }
|
if ($offline -lt "1.1.98.683") { $rem.remove('rightsidebar'), $rem.remove('addingplaylist') }
|
||||||
if ($exp_standart) {
|
if ($exp_standart) {
|
||||||
$rem.remove('enhanceliked'), $rem.remove('enhanceplaylist'),
|
$rem.remove('enhanceliked'), $rem.remove('enhanceplaylist'),
|
||||||
$rem.remove('disographyartist'), $rem.remove('lyricsmatch'),
|
$rem.remove('disographyartist'), $rem.remove('lyricsmatch'),
|
||||||
@@ -1073,14 +1059,14 @@ function Helper($paramname) {
|
|||||||
$rem.remove($newhome), $rem.remove('madeforyou'),
|
$rem.remove($newhome), $rem.remove('madeforyou'),
|
||||||
$rem.remove('similarplaylist'), $rem.remove('leftsidebar'), $rem.remove('rightsidebar')
|
$rem.remove('similarplaylist'), $rem.remove('leftsidebar'), $rem.remove('rightsidebar')
|
||||||
}
|
}
|
||||||
if (!($left_sidebar_on) -or $ofline -le "1.1.97.956") { $rem.remove('leftsidebar') }
|
if (!($left_sidebar_on) -or $offline -le "1.1.97.956") { $rem.remove('leftsidebar') }
|
||||||
if ($navalt_off) { $rem.remove($newhome) }
|
if ($navalt_off) { $rem.remove($newhome) }
|
||||||
if ($ofline -ge "1.1.94.864") {
|
if ($offline -ge "1.1.94.864") {
|
||||||
$rem.remove('lyricsenabled'), $rem.remove('playlistcreat'),
|
$rem.remove('lyricsenabled'), $rem.remove('playlistcreat'),
|
||||||
$rem.remove('searchbox')
|
$rem.remove('searchbox')
|
||||||
}
|
}
|
||||||
if ($ofline -lt "1.1.90.859" -or $ofline -gt "1.1.95.893") { $rem.remove('devicepicker') }
|
if ($offline -lt "1.1.90.859" -or $offline -gt "1.1.95.893") { $rem.remove('devicepicker') }
|
||||||
if ($ofline -le "1.1.93.896") { $rem.remove($newhome) }
|
if ($offline -le "1.1.93.896") { $rem.remove($newhome) }
|
||||||
$name = "patches.json.exp."
|
$name = "patches.json.exp."
|
||||||
$n = "xpui.js"
|
$n = "xpui.js"
|
||||||
$contents = $webjson.exp.psobject.properties.name
|
$contents = $webjson.exp.psobject.properties.name
|
||||||
@@ -1288,8 +1274,8 @@ if (Test-Path $xpui_js_patch) {
|
|||||||
|
|
||||||
# Turn off podcasts
|
# Turn off podcasts
|
||||||
if ($Podcast_off) {
|
if ($Podcast_off) {
|
||||||
if ($ofline -ge "1.1.93.896" -and $ofline -le "1.1.97.962") { $js = "home-v2.js" }
|
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.97.962") { $js = "home-v2.js" }
|
||||||
if ($ofline -le "1.1.92.647" -or $ofline -ge "1.1.98.683") { $js = "xpui.js" }
|
if ($offline -le "1.1.92.647" -or $offline -ge "1.1.98.683") { $js = "xpui.js" }
|
||||||
extract -counts 'one' -method 'nonezip' -name $js -helper 'OffPodcasts'
|
extract -counts 'one' -method 'nonezip' -name $js -helper 'OffPodcasts'
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1308,12 +1294,7 @@ if (Test-Path $xpui_js_patch) {
|
|||||||
$very_high = $webjson.others.veryhighstream.add
|
$very_high = $webjson.others.veryhighstream.add
|
||||||
}
|
}
|
||||||
|
|
||||||
# New UI fix
|
$css = $icon, $submenu, $very_high
|
||||||
if (!($navalt_off)) {
|
|
||||||
$navaltfix = $webjson.others.navaltfix.add[0]
|
|
||||||
$navaltfix2 = $webjson.others.navaltfix.add[1]
|
|
||||||
}
|
|
||||||
$css = $icon, $submenu, $very_high, $navaltfix, $navaltfix2
|
|
||||||
|
|
||||||
extract -counts 'one' -method 'nonezip' -name 'xpui.css' -add $css
|
extract -counts 'one' -method 'nonezip' -name 'xpui.css' -add $css
|
||||||
|
|
||||||
@@ -1403,8 +1384,8 @@ If (Test-Path $xpui_spa_patch) {
|
|||||||
|
|
||||||
# Turn off podcasts
|
# Turn off podcasts
|
||||||
if ($podcast_off) {
|
if ($podcast_off) {
|
||||||
if ($ofline -ge "1.1.93.896" -and $ofline -le "1.1.97.962") { $js = 'home-v2.js' }
|
if ($offline -ge "1.1.93.896" -and $offline -le "1.1.97.962") { $js = 'home-v2.js' }
|
||||||
if ($ofline -le "1.1.92.647" -or $ofline -ge "1.1.98.683") { $js = 'xpui.js' }
|
if ($offline -le "1.1.92.647" -or $offline -ge "1.1.98.683") { $js = 'xpui.js' }
|
||||||
extract -counts 'one' -method 'zip' -name $js -helper 'OffPodcasts'
|
extract -counts 'one' -method 'zip' -name $js -helper 'OffPodcasts'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user