version bump to 1.2.4.907

- Block audio ads in podcasts ( thanks @jetfir3 )
- added input parameter old_lyrics to include old lyrics in new theme

Co-Authored-By: jetfir3 <95306468+jetfir3@users.noreply.github.com>
This commit is contained in:
amd64fox
2023-02-01 02:46:32 +03:00
parent aed43c34cf
commit 37a32b22b0
2 changed files with 84 additions and 29 deletions

View File

@@ -75,6 +75,9 @@ param
[Parameter(HelpMessage = 'New theme activated (new right and left sidebar, some cover change)')] [Parameter(HelpMessage = 'New theme activated (new right and left sidebar, some cover change)')]
[switch]$new_theme, [switch]$new_theme,
[Parameter(HelpMessage = 'Returns old lyrics')]
[switch]$old_lyrics,
[Parameter(HelpMessage = 'Do not create desktop shortcut.')] [Parameter(HelpMessage = 'Do not create desktop shortcut.')]
[switch]$no_shortcut, [switch]$no_shortcut,
@@ -450,7 +453,7 @@ function DesktopFolder {
} }
# Recommended version for spotx # Recommended version for spotx
$onlineFull = "1.2.4.905.gaf3b1e64-104" $onlineFull = "1.2.4.907.g126451d5-139"
$online = ($onlineFull -split ".g")[0] $online = ($onlineFull -split ".g")[0]
# Check version Spotify offline # Check version Spotify offline
@@ -852,8 +855,31 @@ if ($exp_standart) { Write-Host ($lang).ExpStandart`n }
if ($exp_spotify) { Write-Host ($lang).ExpSpotify`n } if ($exp_spotify) { Write-Host ($lang).ExpSpotify`n }
$url = "https://raw.githubusercontent.com/amd64fox/SpotX/main/patches/patches.json" $url = "https://raw.githubusercontent.com/amd64fox/SpotX/main/patches/patches.json"
$webjson = (Invoke-WebRequest -useb -Uri $url).Content | ConvertFrom-Json $retries = 0
while ($retries -lt 3) {
try {
$webjson = Invoke-WebRequest -UseBasicParsing -Uri $url | ConvertFrom-Json
break
}
catch {
Write-Warning "Request failed: $_"
$retries++
Start-Sleep -Seconds 3
}
}
if ($retries -eq 3) {
Write-Host "Failed to get patches.json" -ForegroundColor Red
Write-Host ($lang).StopScrpit
$tempDirectory = $PWD
Pop-Location
Start-Sleep -Milliseconds 200
Remove-Item -Recurse -LiteralPath $tempDirectory
Pause
Exit
}
function Helper($paramname) { function Helper($paramname) {
switch ( $paramname ) { switch ( $paramname ) {
@@ -983,6 +1009,20 @@ function Helper($paramname) {
$contents = $webjsonru.psobject.properties.name $contents = $webjsonru.psobject.properties.name
$json = $webjsonru $json = $webjsonru
} }
"PodcastAd" {
# Aodcast ad block
$name = "patches.json.others."
$n = "Spotify.exe"
$contents = "podcast_ad_block"
$json = $webjson.others
}
"BlockUpdate" {
# Block Spotify client updates
$name = "patches.json.others."
$n = "Spotify.exe"
$contents = "block_update"
$json = $webjson.others
}
"Collaborators" { "Collaborators" {
# Hide Collaborators icon # Hide Collaborators icon
$name = "patches.json.others." $name = "patches.json.others."
@@ -1016,6 +1056,8 @@ function Helper($paramname) {
} }
if (!($new_theme)) { $rem.remove('newhome'), $rem.remove('newhome2'), $rem.remove('leftsidebar'), $rem.remove('rightsidebar'), $rem.remove('lyricssidebar') } if (!($new_theme)) { $rem.remove('newhome'), $rem.remove('newhome2'), $rem.remove('leftsidebar'), $rem.remove('rightsidebar'), $rem.remove('lyricssidebar') }
if ($old_lyrics) { $rem.remove('lyricssidebar') }
$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
@@ -1072,7 +1114,7 @@ function Helper($paramname) {
$paramdata $paramdata
} }
function extract ($counts, $method, $name, $helper, $add) { function extract ($counts, $method, $name, $helper, $add, $patch) {
switch ( $counts ) { switch ( $counts ) {
"one" { "one" {
if ($method -eq "zip") { if ($method -eq "zip") {
@@ -1113,6 +1155,12 @@ function extract ($counts, $method, $name, $helper, $add) {
} }
$zip.Dispose() $zip.Dispose()
} }
"exe" {
$ANSI = [Text.Encoding]::GetEncoding(1251)
$xpui = [IO.File]::ReadAllText($spotifyExecutable, $ANSI)
$xpui = Helper -paramname $helper
[IO.File]::WriteAllText($spotifyExecutable, $xpui, $ANSI)
}
} }
} }
@@ -1515,38 +1563,27 @@ If (!(Test-Path $start_menu)) {
$Shortcut.Save() $Shortcut.Save()
} }
# Block updates $ANSI = [Text.Encoding]::GetEncoding(1251)
$ErrorActionPreference = 'SilentlyContinue' $old = [IO.File]::ReadAllText($spotifyExecutable, $ANSI)
$update_test_exe = Test-Path -Path $spotifyExecutable
if ($block_update) { $rexex1 = $old -notmatch $webjson.others.block_update.add
$rexex2 = $old -notmatch $webjson.others.podcast_ad_block.add
if ($update_test_exe) { if ($rexex1 -and $rexex2 ) {
$exe = "$env:APPDATA\Spotify\Spotify.exe"
$ANSI = [Text.Encoding]::GetEncoding(1251)
$old = [IO.File]::ReadAllText($exe, $ANSI)
if ($old -match "(?<=wg:\/\/desktop-update\/.)7(\/update)") { if (Test-Path -LiteralPath $exe_bak) {
Write-Host ($lang).UpdateBlocked`n Remove-Item $exe_bak -Recurse -Force
} Start-Sleep -Milliseconds 150
elseif ($old -match "(?<=wg:\/\/desktop-update\/.)2(\/update)") {
if (Test-Path -LiteralPath $exe_bak) {
Remove-Item $exe_bak -Recurse -Force
Start-Sleep -Milliseconds 150
}
copy-Item $exe $exe_bak
$new = $old -replace "(?<=wg:\/\/desktop-update\/.)2(\/update)", '7/update'
[IO.File]::WriteAllText($exe, $new, $ANSI)
}
else {
Write-Host ($lang).UpdateError`n -ForegroundColor Red
}
}
else {
Write-Host ($lang).NoSpotifyExe`n -ForegroundColor Red
} }
copy-Item $spotifyExecutable $exe_bak
} }
# Podcast ad block
extract -counts 'exe' -helper 'PodcastAd'
# Block updates
if ($block_update) { extract -counts 'exe' -helper 'BlockUpdate' }
# Automatic cache clearing # Automatic cache clearing
if ($cache_install) { if ($cache_install) {
Start-Sleep -Milliseconds 200 Start-Sleep -Milliseconds 200

View File

@@ -90,6 +90,24 @@
"match": "((..createElement|children:\\(.{1,7}\\))\\(....,{source:).....get\\(\"about.copyright\",.\\),paragraphClassName:.}\\)", "match": "((..createElement|children:\\(.{1,7}\\))\\(....,{source:).....get\\(\"about.copyright\",.\\),paragraphClassName:.}\\)",
"replace": "$1\"<h3>More about SpotX</h3><a href='https://github.com/amd64fox/SpotX'>Github</a><br/><a href='https://telegra.ph/SpotX-FAQ-09-19'>FAQ</a><br/><a href='https://t.me/spotify_windows_mod'>Telegram channel</a><br/><a href='https://github.com/amd64fox/SpotX/issues/new?assignees=&labels=%E2%9D%8C+bug&template=bug_report.yml'>Create an issue report</a><br> <br/><h4>DISCLAIMER</h4>SpotX is a modified version of the official Spotify client, provided as an evaluation version, you use it at your own risk.\"})" "replace": "$1\"<h3>More about SpotX</h3><a href='https://github.com/amd64fox/SpotX'>Github</a><br/><a href='https://telegra.ph/SpotX-FAQ-09-19'>FAQ</a><br/><a href='https://t.me/spotify_windows_mod'>Telegram channel</a><br/><a href='https://github.com/amd64fox/SpotX/issues/new?assignees=&labels=%E2%9D%8C+bug&template=bug_report.yml'>Create an issue report</a><br> <br/><h4>DISCLAIMER</h4>SpotX is a modified version of the official Spotify client, provided as an evaluation version, you use it at your own risk.\"})"
}, },
"block_update": {
"version": {
"from": "1.1.58",
"do": ""
},
"add": "(?<=wg:\/\/desktop-update\/.)7(\/update)",
"match": "(?<=wg:\/\/desktop-update\/.)2(\/update)",
"replace": "7/update"
},
"podcast_ad_block": {
"version": {
"from": "1.1.68",
"do": ""
},
"add": "(?<=refresh_inventory...)slott",
"match": "(?<=refresh_inventory...)slots",
"replace": "slott"
},
"podcastsoff": { "podcastsoff": {
"version": { "version": {
"from": "1.1.70", "from": "1.1.70",