mirror of
https://github.com/SpotX-Official/SpotX.git
synced 2026-06-21 22:50:56 +10:00
refactoring to disable podcasts
This commit is contained in:
+3
-36
@@ -394,21 +394,10 @@ if ($ch -eq 'n') {
|
|||||||
function OffPodcasts {
|
function OffPodcasts {
|
||||||
|
|
||||||
# Turn off podcasts
|
# Turn off podcasts
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
$podcasts_off1 = '(return this\.queryParameters=(.),)', '$2.types=["album","playlist","artist","station"];$1'
|
||||||
|
|
||||||
if ($ofline -le "1.1.82.758") {
|
|
||||||
$podcasts_off1 = 'album,playlist,artist,show,station,episode', 'album,playlist,artist,station'
|
|
||||||
}
|
|
||||||
if ($ofline -eq "1.1.83.954" -or $ofline -eq "1.1.83.956" -or $ofline -eq "1.1.84.716" ) {
|
|
||||||
$podcasts_off1 = '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
}
|
|
||||||
|
|
||||||
$podcasts_off2 = ',this[.]enableShows=[a-z]'
|
$podcasts_off2 = ',this[.]enableShows=[a-z]'
|
||||||
|
|
||||||
if ($ofline -le "1.1.82.758" -or $ofline -eq "1.1.83.954" -or $ofline -eq "1.1.83.956" -or $ofline -eq "1.1.84.716" ) {
|
if ($xpui_js -match $podcasts_off1[0]) { $xpui_js = $xpui_js -replace $podcasts_off1[0], $podcasts_off1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off1[0] in xpui.js" }
|
||||||
if ($xpui_js -match $podcasts_off1[0]) { $xpui_js = $xpui_js -replace $podcasts_off1[0], $podcasts_off1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off1[0] in xpui.js" }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($xpui_js -match $podcasts_off2) { $xpui_js = $xpui_js -replace $podcasts_off2, "" } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off2 in xpui.js" }
|
if ($xpui_js -match $podcasts_off2) { $xpui_js = $xpui_js -replace $podcasts_off2, "" } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off2 in xpui.js" }
|
||||||
$xpui_js
|
$xpui_js
|
||||||
}
|
}
|
||||||
@@ -497,7 +486,6 @@ Start-Sleep -Milliseconds 200
|
|||||||
Remove-Item -Recurse -LiteralPath $tempDirectory
|
Remove-Item -Recurse -LiteralPath $tempDirectory
|
||||||
|
|
||||||
$xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa"
|
$xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa"
|
||||||
$xpui_patch = "$env:APPDATA\Spotify\Apps\xpui\"
|
|
||||||
$xpui_js_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.js"
|
$xpui_js_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.js"
|
||||||
$xpui_css_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.css"
|
$xpui_css_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.css"
|
||||||
$xpui_lic_patch = "$env:APPDATA\Spotify\Apps\xpui\licenses.html"
|
$xpui_lic_patch = "$env:APPDATA\Spotify\Apps\xpui\licenses.html"
|
||||||
@@ -567,23 +555,6 @@ if (Test-Path $xpui_js_patch) {
|
|||||||
$writer.Write([System.Environment]::NewLine + '// Patched by SpotX')
|
$writer.Write([System.Environment]::NewLine + '// Patched by SpotX')
|
||||||
$writer.Close()
|
$writer.Close()
|
||||||
|
|
||||||
# podcast off for 1.1.85.895 >=
|
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
|
||||||
if ($podcasts_off -and $ofline -le "1.1.85.895" ) {
|
|
||||||
Get-ChildItem $xpui_patch | Where-Object FullName -like '*.js' | ForEach-Object {
|
|
||||||
$readerjs = New-Object System.IO.StreamReader($_.FullName)
|
|
||||||
$xpuiContents_js = $readerjs.ReadToEnd()
|
|
||||||
$readerjs.Close()
|
|
||||||
|
|
||||||
$xpuiContents_js = $xpuiContents_js -replace '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
|
|
||||||
$writer = New-Object System.IO.StreamWriter($_.FullName)
|
|
||||||
$writer.BaseStream.SetLength(0)
|
|
||||||
$writer.Write($xpuiContents_js)
|
|
||||||
$writer.Close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# xpui.css
|
# xpui.css
|
||||||
$file_xpui_css = get-item $env:APPDATA\Spotify\Apps\xpui\xpui.css
|
$file_xpui_css = get-item $env:APPDATA\Spotify\Apps\xpui\xpui.css
|
||||||
$reader = New-Object -TypeName System.IO.StreamReader -ArgumentList $file_xpui_css
|
$reader = New-Object -TypeName System.IO.StreamReader -ArgumentList $file_xpui_css
|
||||||
@@ -691,11 +662,7 @@ If (Test-Path $xpui_spa_patch) {
|
|||||||
$readerjs = New-Object System.IO.StreamReader($_.Open())
|
$readerjs = New-Object System.IO.StreamReader($_.Open())
|
||||||
$xpuiContents_js = $readerjs.ReadToEnd()
|
$xpuiContents_js = $readerjs.ReadToEnd()
|
||||||
$readerjs.Close()
|
$readerjs.Close()
|
||||||
# podcast off for 1.1.85.895 >=
|
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
|
||||||
if ($podcasts_off -and $ofline -le "1.1.85.895" ) {
|
|
||||||
$xpuiContents_js = $xpuiContents_js -replace '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
}
|
|
||||||
# js minification
|
# js minification
|
||||||
$xpuiContents_js = $xpuiContents_js `
|
$xpuiContents_js = $xpuiContents_js `
|
||||||
-replace "[/][/][#] sourceMappingURL=.*[.]map", "" -replace "\r?\n(?!\(1|\d)", ""
|
-replace "[/][/][#] sourceMappingURL=.*[.]map", "" -replace "\r?\n(?!\(1|\d)", ""
|
||||||
|
|||||||
+4
-38
@@ -394,21 +394,10 @@ if ($ch -eq 'n') {
|
|||||||
function OffPodcasts {
|
function OffPodcasts {
|
||||||
|
|
||||||
# Отключить подкасты
|
# Отключить подкасты
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
$podcasts_off1 = '(return this\.queryParameters=(.),)', '$2.types=["album","playlist","artist","station"];$1'
|
||||||
|
|
||||||
if ($ofline -le "1.1.82.758") {
|
|
||||||
$podcasts_off1 = 'album,playlist,artist,show,station,episode', 'album,playlist,artist,station'
|
|
||||||
}
|
|
||||||
if ($ofline -eq "1.1.83.954" -or $ofline -eq "1.1.83.956" -or $ofline -eq "1.1.84.716" ) {
|
|
||||||
$podcasts_off1 = '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
}
|
|
||||||
|
|
||||||
$podcasts_off2 = ',this[.]enableShows=[a-z]'
|
$podcasts_off2 = ',this[.]enableShows=[a-z]'
|
||||||
|
|
||||||
if ($ofline -le "1.1.82.758" -or $ofline -eq "1.1.83.954" -or $ofline -eq "1.1.83.956" -or $ofline -eq "1.1.84.716" ) {
|
if ($xpui_js -match $podcasts_off1[0]) { $xpui_js = $xpui_js -replace $podcasts_off1[0], $podcasts_off1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off1[0] in xpui.js" }
|
||||||
if ($xpui_js -match $podcasts_off1[0]) { $xpui_js = $xpui_js -replace $podcasts_off1[0], $podcasts_off1[1] } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off1[0] in xpui.js" }
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($xpui_js -match $podcasts_off2) { $xpui_js = $xpui_js -replace $podcasts_off2, "" } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off2 in xpui.js" }
|
if ($xpui_js -match $podcasts_off2) { $xpui_js = $xpui_js -replace $podcasts_off2, "" } else { Write-Host "Didn't find variable " -ForegroundColor red -NoNewline; Write-Host "`$podcasts_off2 in xpui.js" }
|
||||||
$xpui_js
|
$xpui_js
|
||||||
}
|
}
|
||||||
@@ -592,7 +581,6 @@ Start-Sleep -Milliseconds 200
|
|||||||
Remove-Item -Recurse -LiteralPath $tempDirectory
|
Remove-Item -Recurse -LiteralPath $tempDirectory
|
||||||
|
|
||||||
$xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa"
|
$xpui_spa_patch = "$env:APPDATA\Spotify\Apps\xpui.spa"
|
||||||
$xpui_patch = "$env:APPDATA\Spotify\Apps\xpui\"
|
|
||||||
$xpui_js_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.js"
|
$xpui_js_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.js"
|
||||||
$xpui_css_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.css"
|
$xpui_css_patch = "$env:APPDATA\Spotify\Apps\xpui\xpui.css"
|
||||||
$xpui_lic_patch = "$env:APPDATA\Spotify\Apps\xpui\licenses.html"
|
$xpui_lic_patch = "$env:APPDATA\Spotify\Apps\xpui\licenses.html"
|
||||||
@@ -658,7 +646,7 @@ if (Test-Path $xpui_js_patch) {
|
|||||||
$xpui_js = $reader.ReadToEnd()
|
$xpui_js = $reader.ReadToEnd()
|
||||||
$reader.Close()
|
$reader.Close()
|
||||||
|
|
||||||
# # Отключить подкасты
|
# Отключить подкасты
|
||||||
if ($Podcasts_off) { $xpui_js = OffPodcasts }
|
if ($Podcasts_off) { $xpui_js = OffPodcasts }
|
||||||
|
|
||||||
# Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium",
|
# Активация полноэкранного режима, а также удаление кнопки и меню "Перейти на Premium",
|
||||||
@@ -688,24 +676,6 @@ if (Test-Path $xpui_js_patch) {
|
|||||||
$writer.Write($xpui_ru)
|
$writer.Write($xpui_ru)
|
||||||
$writer.Close()
|
$writer.Close()
|
||||||
|
|
||||||
|
|
||||||
# Отключить подкасты для 1.1.85.895 >=
|
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
|
||||||
if ($podcasts_off -and $ofline -le "1.1.85.895" ) {
|
|
||||||
Get-ChildItem $xpui_patch | Where-Object FullName -like '*.js' | ForEach-Object {
|
|
||||||
$readerjs = New-Object System.IO.StreamReader($_.FullName)
|
|
||||||
$xpuiContents_js = $readerjs.ReadToEnd()
|
|
||||||
$readerjs.Close()
|
|
||||||
|
|
||||||
$xpuiContents_js = $xpuiContents_js -replace '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
|
|
||||||
$writer = New-Object System.IO.StreamWriter($_.FullName)
|
|
||||||
$writer.BaseStream.SetLength(0)
|
|
||||||
$writer.Write($xpuiContents_js)
|
|
||||||
$writer.Close()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# xpui.css
|
# xpui.css
|
||||||
$file_xpui_css = get-item $env:APPDATA\Spotify\Apps\xpui\xpui.css
|
$file_xpui_css = get-item $env:APPDATA\Spotify\Apps\xpui\xpui.css
|
||||||
$reader = New-Object -TypeName System.IO.StreamReader -ArgumentList $file_xpui_css
|
$reader = New-Object -TypeName System.IO.StreamReader -ArgumentList $file_xpui_css
|
||||||
@@ -840,11 +810,7 @@ If (Test-Path $xpui_spa_patch) {
|
|||||||
$readerjs = New-Object System.IO.StreamReader($_.Open())
|
$readerjs = New-Object System.IO.StreamReader($_.Open())
|
||||||
$xpuiContents_js = $readerjs.ReadToEnd()
|
$xpuiContents_js = $readerjs.ReadToEnd()
|
||||||
$readerjs.Close()
|
$readerjs.Close()
|
||||||
# Отключить подкасты для 1.1.85.895 >=
|
|
||||||
$ofline = Check_verison_clients -param2 "offline"
|
|
||||||
if ($podcasts_off -and $ofline -le "1.1.85.895" ) {
|
|
||||||
$xpuiContents_js = $xpuiContents_js -replace '"album","playlist","artist","show","station","episode"', '"album","playlist","artist","station"'
|
|
||||||
}
|
|
||||||
# минификация js
|
# минификация js
|
||||||
$xpuiContents_js = $xpuiContents_js `
|
$xpuiContents_js = $xpuiContents_js `
|
||||||
-replace "[/][/][#] sourceMappingURL=.*[.]map", "" -replace "\r?\n(?!\(1|\d)", ""
|
-replace "[/][/][#] sourceMappingURL=.*[.]map", "" -replace "\r?\n(?!\(1|\d)", ""
|
||||||
|
|||||||
Reference in New Issue
Block a user