Skip to content

Commit

Permalink
version bump to 1.2.19.937
Browse files Browse the repository at this point in the history
- fixed regex to block updates
- migration from raw.githubusercontent.com to cdn.statically.io (attempt to fix blocking of raw files by some providers) #471
- minor code fix
  • Loading branch information
amd64fox committed Aug 26, 2023
1 parent f1f51c8 commit 6be3db4
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 39 deletions.
47 changes: 24 additions & 23 deletions Install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -257,17 +257,13 @@ if ($psv -ge 7) {
Import-Module Appx -UseWindowsPowerShell -WarningAction:SilentlyContinue
}

# Country check
$country = [System.Globalization.RegionInfo]::CurrentRegion.EnglishName

# add Tls12
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
[Net.ServicePointManager]::SecurityProtocol = 3072


function CallLang($clg) {

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$urlLang = "https://raw.githubusercontent.com/amd64fox/SpotX/main/scripts/installer-lang/$clg.ps1"
$urlLang = "https://cdn.statically.io/gh/amd64fox/SpotX/main/scripts/installer-lang/$clg.ps1"
$ProgressPreference = 'SilentlyContinue'

try {
Expand All @@ -289,7 +285,7 @@ $lang = CallLang -clg $langCode
# Set variable 'ru'.
if ($langCode -eq 'ru') {
$ru = $true
$urlru = "https://raw.githubusercontent.com/amd64fox/SpotX/main/patches/Augmented%20translation/ru.json"
$urlru = "https://cdn.statically.io/gh/amd64fox/SpotX/main/patches/Augmented%20translation/ru.json"
$webjsonru = (Invoke-WebRequest -useb -Uri $urlru).Content | ConvertFrom-Json
}

Expand Down Expand Up @@ -337,7 +333,7 @@ if (!($version -and $version -match $match_v)) {
}
else {
# Recommended version for Win 10-12
$onlineFull = "1.2.18.999.g9b38fc27-20"
$onlineFull = "1.2.19.937.gf6e7cff9-258"
}
}
else {
Expand All @@ -361,7 +357,7 @@ $retries = 0

while ($retries -lt 2) {
try {
Invoke-WebRequest -useb -Uri $cutt_url | Out-Null
$null = Invoke-WebRequest -useb -Uri $cutt_url
break
}
catch {
Expand Down Expand Up @@ -596,9 +592,10 @@ if ($spotifyInstalled) {
$offline = (Get-Item $spotifyExecutable).VersionInfo.FileVersion

# Version comparison
# converting strings to arrays of numbers using the -split operator and a ForEach-Object loop
$arr1 = $online -split '\.' | ForEach-Object { [int]$_ }
$arr2 = $offline -split '\.' | ForEach-Object { [int]$_ }
# converting strings to arrays of numbers using the -split operator and a foreach loop

$arr1 = $online -split '\.' | foreach { [int]$_ }
$arr2 = $offline -split '\.' | foreach { [int]$_ }

# compare each element of the array in order from most significant to least significant.
for ($i = 0; $i -lt $arr1.Length; $i++) {
Expand Down Expand Up @@ -649,7 +646,7 @@ if ($spotifyInstalled) {
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') {
Write-Host ($lang).DelOld`n
Unlock-Folder | Out-Null
$null = Unlock-Folder
cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200
Expand All @@ -668,6 +665,10 @@ if ($spotifyInstalled) {
if ($testversion) {
# Submit unsupported version of Spotify to google form for further processing
try {

# Country check
$country = [System.Globalization.RegionInfo]::CurrentRegion.EnglishName

$txt = [IO.File]::ReadAllText($spotifyExecutable)
$regex = "(\d+)\.(\d+)\.(\d+)\.(\d+)(\.g[0-9a-f]{8})"
$v = $txt | Select-String $regex -AllMatches
Expand All @@ -685,7 +686,7 @@ if ($spotifyInstalled) {
'entry.2067427976' = $online + " < " + $offline
}
}
Invoke-WebRequest -useb @Parameters | Out-Null
$null = Invoke-WebRequest -useb @Parameters
}
catch {
Write-Host 'Unable to submit new version of Spotify'
Expand Down Expand Up @@ -740,7 +741,7 @@ if ($spotifyInstalled) {
if ($confirm_spoti_recomended_over) { $ch = 'n' }
if ($ch -eq 'y') {
Write-Host ($lang).DelNew`n
Unlock-Folder | Out-Null
$null = Unlock-Folder
cmd /c $spotifyExecutable /UNINSTALL /SILENT
wait-process -name SpotifyUninstall
Start-Sleep -Milliseconds 200
Expand Down Expand Up @@ -774,7 +775,7 @@ if (-not $spotifyInstalled -or $upgrade_client) {
$ErrorActionPreference = 'SilentlyContinue'
taskkill /f /im Spotify.exe /t > $null 2>&1
Start-Sleep -Milliseconds 600
Unlock-Folder | Out-Null
$null = Unlock-Folder
Start-Sleep -Milliseconds 200
Get-ChildItem $spotifyDirectory -Exclude 'Users', 'prefs' | Remove-Item -Recurse -Force
Start-Sleep -Milliseconds 200
Expand Down Expand Up @@ -870,7 +871,7 @@ if ($ch -eq 'n') {

$ch = $null

$url = "https://raw.githubusercontent.com/amd64fox/SpotX/main/patches/patches.json"
$url = "https://cdn.statically.io/gh/amd64fox/SpotX/main/patches/patches.json"
$retries = 0

while ($retries -lt 3) {
Expand Down Expand Up @@ -1063,7 +1064,7 @@ function Helper($paramname) {

foreach ($obj in $objects) {
$propertiesToRemove = $obj.Object.Name | Where-Object { $_ -notin $obj.PropertiesToKeep }
$propertiesToRemove | ForEach-Object {
$propertiesToRemove | foreach {
$obj.Object.Remove($_)
}
}
Expand Down Expand Up @@ -1213,7 +1214,7 @@ function Helper($paramname) {
$novariable = "Didn't find variable "
$offline_patch = $offline -replace '(\d+\.\d+\.\d+)(.\d+)', '$1'

$contents | ForEach-Object {
$contents | foreach {

if ( $json.$PSItem.version.to ) { $to = [version]$json.$PSItem.version.to -ge [version]$offline_patch } else { $to = $true }
if ( $json.$PSItem.version.fr ) { $fr = [version]$json.$PSItem.version.fr -le [version]$offline_patch } else { $fr = $false }
Expand Down Expand Up @@ -1280,15 +1281,15 @@ function extract ($counts, $method, $name, $helper, $add, $patch) {
if ($method -eq "nonezip") { $writer = New-Object System.IO.StreamWriter -ArgumentList $file }
$writer.BaseStream.SetLength(0)
$writer.Write($xpui)
if ($add) { $add | ForEach-Object { $writer.Write([System.Environment]::NewLine + $PSItem ) } }
if ($add) { $add | foreach { $writer.Write([System.Environment]::NewLine + $PSItem ) } }
$writer.Close()
if ($method -eq "zip") { $zip.Dispose() }
}
"more" {
Add-Type -Assembly 'System.IO.Compression.FileSystem'
$xpui_spa_patch = Join-Path (Join-Path $env:APPDATA 'Spotify\Apps') 'xpui.spa'
$zip = [System.IO.Compression.ZipFile]::Open($xpui_spa_patch, 'update')
$zip.Entries | Where-Object FullName -like $name | ForEach-Object {
$zip.Entries | Where-Object FullName -like $name | foreach {
$reader = New-Object System.IO.StreamReader($_.Open())
$xpui = $reader.ReadToEnd()
$reader.Close()
Expand Down Expand Up @@ -1402,12 +1403,12 @@ If ($test_spa) {

# Remove all languages except En and Ru from xpui.spa
if ($ru) {
[Reflection.Assembly]::LoadWithPartialName('System.IO.Compression') | Out-Null
$null = [Reflection.Assembly]::LoadWithPartialName('System.IO.Compression')
$stream = New-Object IO.FileStream($xpui_spa_patch, [IO.FileMode]::Open)
$mode = [IO.Compression.ZipArchiveMode]::Update
$zip_xpui = New-Object IO.Compression.ZipArchive($stream, $mode)

($zip_xpui.Entries | Where-Object { $_.FullName -match "i18n" -and $_.FullName -inotmatch "(ru|en.json|longest)" }) | ForEach-Object { $_.Delete() }
($zip_xpui.Entries | Where-Object { $_.FullName -match "i18n" -and $_.FullName -inotmatch "(ru|en.json|longest)" }) | foreach { $_.Delete() }

$zip_xpui.Dispose()
$stream.Close()
Expand Down
2 changes: 1 addition & 1 deletion Install_New_theme.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -new_theme """" | Invoke-Expression"
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = 3072}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content)} -new_theme """" | Invoke-Expression"

pause
exit /b
2 changes: 1 addition & 1 deletion Install_Old_theme.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -v 1.2.13.661.ga588f749-4064 -confirm_spoti_recomended_over -block_update_on """" | Invoke-Expression"
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = 3072}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content)} -v 1.2.13.661.ga588f749-4064 -confirm_spoti_recomended_over -block_update_on """" | Invoke-Expression"

pause
exit /b
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<p align="center">
<a href="https://github.com/amd64fox/SpotX/releases"><img src="https://raw.githubusercontent.com/amd64fox/SpotX/main/.github/Pic/logo.png" />
<a href="https://github.com/amd64fox/SpotX/releases"><img src="https://cdn.statically.io/gh/amd64fox/SpotX/main/.github/Pic/logo.png" />
</p>

<p align="center">
<a href="https://t.me/spotify_windows_mod"><img src="https://raw.githubusercontent.com/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_Channel.svg"></a>
<a href="https://t.me/SpotxCommunity"><img src="https://raw.githubusercontent.com/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_Community.svg"></a>
<a href="https://github.com/jetfir3/SpotX-Bash"><img src="https://raw.githubusercontent.com/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_for_Mac&Linux.svg"></a>
<a href="https://telegra.ph/SpotX-FAQ-09-19"><img src="https://raw.githubusercontent.com/amd64fox/SpotX/main/.github/Pic/Shields/faq.svg"></a>
<a href="https://t.me/spotify_windows_mod"><img src="https://cdn.statically.io/gh/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_Channel.svg"></a>
<a href="https://t.me/SpotxCommunity"><img src="https://cdn.statically.io/gh/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_Community.svg"></a>
<a href="https://github.com/jetfir3/SpotX-Bash"><img src="https://cdn.statically.io/gh/amd64fox/SpotX/main/.github/Pic/Shields/SpotX_for_Mac&Linux.svg"></a>
<a href="https://telegra.ph/SpotX-FAQ-09-19"><img src="https://cdn.statically.io/gh/amd64fox/SpotX/main/.github/Pic/Shields/faq.svg"></a>
</p>

<h2> <div align="center"><b> Modified Spotify Client for Windows </b></div> </h2>
Expand Down Expand Up @@ -48,7 +48,7 @@ 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').Content) } -new_theme"
[Net.ServicePointManager]::SecurityProtocol = 3072; iex "& { $((iwr -useb 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content) } -new_theme"
```

</details>
Expand All @@ -72,7 +72,7 @@ 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').Content) } -v 1.2.13.661.ga588f749-4064 -confirm_spoti_recomended_over -block_update_on"
[Net.ServicePointManager]::SecurityProtocol = 3072; iex "& { $((iwr -useb 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content) } -v 1.2.13.661.ga588f749-4064 -confirm_spoti_recomended_over -block_update_on"
```

</details>
Expand Down Expand Up @@ -101,7 +101,7 @@ 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').Content) } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify"
[Net.ServicePointManager]::SecurityProtocol = 3072; iex "& { $((iwr -useb 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content) } -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify"
```

</details>
Expand All @@ -127,7 +127,7 @@ 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').Content) } -premium -new_theme"
[Net.ServicePointManager]::SecurityProtocol = 3072; iex "& { $((iwr -useb 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content) } -premium -new_theme"
```

</details>
Expand Down
25 changes: 22 additions & 3 deletions patches/patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,15 @@
"fr": "1.2.18",
"to": ""
}
},
"AudiobookAdExclusivity": {
"name": "enableAudiobookAdExclusivity",
"description": "Enable Audiobook Ad Formats Exclusivity",
"native_description": "Enable Audiobook Ad Formats Exclusivity",
"version": {
"fr": "1.2.19",
"to": ""
}
}
},
"EnableExp": {
Expand Down Expand Up @@ -597,7 +606,7 @@
"native_description": "Enable list view for Live Events feed",
"version": {
"fr": "1.2.14",
"to": ""
"to": "1.2.18"
}
},
"ConcertsTicketPrice": {
Expand Down Expand Up @@ -676,6 +685,16 @@
"to": "1.1.96"
}
},
"LyricsUpsell": {
"name": "forceLyricsUpsell",
"description": "Force Lyrics Upsell for testing",
"native_description": "Force Lyrics Upsell for testing",
"value": "CONTROL",
"version": {
"fr": "1.2.19",
"to": ""
}
},
"NavAlt2": {
"name": "enableNavAltExperiment2",
"description": "Enable the new home structure and navigation",
Expand All @@ -692,8 +711,8 @@
"fr": "1.1.58",
"to": ""
},
"add": "(?<=wg:\/\/desktop-update\/.)7(\/update)",
"match": "(?<=wg:\/\/desktop-update\/.)2(\/update)",
"add": "(?<=desktop-update\/.)7(\/update)",
"match": "(?<=desktop-update\/.)2(\/update)",
"replace": "7/update"
},
"podcast_ad_block": {
Expand Down
2 changes: 1 addition & 1 deletion scripts/Install_Auto.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify """" | Invoke-Expression"
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = 3072}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content)} -confirm_uninstall_ms_spoti -confirm_spoti_recomended_over -podcasts_off -block_update_on -start_spoti -new_theme -adsections_off -lyrics_stat spotify """" | Invoke-Expression"

pause
exit /b
2 changes: 1 addition & 1 deletion scripts/Install_Prem.bat
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off

%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://raw.githubusercontent.com/amd64fox/SpotX/main/Install.ps1').Content)} -premium -new_theme """" | Invoke-Expression"
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\powershell.exe -Command "&{[Net.ServicePointManager]::SecurityProtocol = 3072}; """"& { $((Invoke-WebRequest -UseBasicParsing 'https://cdn.statically.io/gh/amd64fox/SpotX/main/Install.ps1').Content)} -premium -new_theme """" | Invoke-Expression"

pause
exit /b

3 comments on commit 6be3db4

@sharunkumar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amd64fox how do you get the version number 1.2.18.999.g9b38fc27-20 for the url? do we have to decompile the installer?

asking because the version on winget package manager is outdated and I wanted to get the urls for all the architectures for updating it

@amd64fox
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've created a simple bot on Telegram that collects all versions for different architectures.

@sharunkumar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Please sign in to comment.