fixed goofyhistory patch

#621
This commit is contained in:
amd64fox
2024-09-03 02:38:44 +03:00
parent fd47891b55
commit f43f35a973
3 changed files with 31 additions and 31 deletions

View File

@@ -1,6 +1,6 @@
const unique = new Set(); const unique = new Set();
function Gofy_history(e, urlForm, idBox) { function goofyHistory(e, urlForm, idBox) {
const uri = e?.item?.uri; const uri = e?.item?.uri;

View File

@@ -1896,11 +1896,11 @@
}, },
"goofyhistory": { "goofyhistory": {
"version": { "version": {
"fr": "1.1.90", "fr": "1.1.70",
"to": "1.2.44" "to": ""
}, },
"match": "(function\\((?:.\\)\\{var .=.\\.isPreview,|\\{isPreview:.\\}\\)\\{const )(.)=\\(.+?(createDesktopNpbPlayerControlsEventFactory.+?)?;)(?=return)", "match": "({data:.}\\)=>{|.\\.data;)((?:this|.)\\._state=(.))",
"replace": ";const objTrack=$2.getState();try{if(objTrack.item!=null&&window.uri!=objTrack.item.uri){window.uri=objTrack.item.uri;if(objTrack.item.uri.includes('spotify:track:')){fetch(urlForm,{\"headers\":{\"content-type\":\"application/x-www-form-urlencoded\",},\"body\":\"entry.\"+idBox+\"=\"+objTrack.item.uri,\"method\":\"POST\",\"mode\":\"no-cors\",});}}}catch{};" "replace": "$1goofyHistory($3, {0}, {1});$2"
}, },
"similarplaylist": { "similarplaylist": {
"version": { "version": {

52
run.ps1
View File

@@ -292,18 +292,24 @@ if ($psv -ge 7) {
# add Tls12 # add Tls12
[Net.ServicePointManager]::SecurityProtocol = 3072 [Net.ServicePointManager]::SecurityProtocol = 3072
function Get-Link {
param (
[Alias("e")]
[string]$endlink
)
switch ($mirror) {
$true { return "https://spotx-official.github.io/SpotX" + $endlink }
default { return "https://raw.githubusercontent.com/SpotX-Official/SpotX/main" + $endlink }
}
}
function CallLang($clg) { function CallLang($clg) {
$urlLang = switch ($mirror) {
$true { "https://spotx-official.github.io/SpotX/scripts/installer-lang/$clg.ps1" }
default { "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/scripts/installer-lang/$clg.ps1" }
}
$ProgressPreference = 'SilentlyContinue' $ProgressPreference = 'SilentlyContinue'
try { try {
$response = (iwr -Uri $urlLang -UseBasicParsing).Content $response = (iwr -Uri (Get-Link -e "/scripts/installer-lang/$clg.ps1") -UseBasicParsing).Content
if ($mirror) { $response = [System.Text.Encoding]::UTF8.GetString($response) } if ($mirror) { $response = [System.Text.Encoding]::UTF8.GetString($response) }
Invoke-Expression $response Invoke-Expression $response
} }
@@ -892,12 +898,7 @@ $ch = $null
# updated Russian translation # updated Russian translation
if ($langCode -eq 'ru' -and [version]$offline -ge [version]"1.1.92.644") { if ($langCode -eq 'ru' -and [version]$offline -ge [version]"1.1.92.644") {
$urlru = switch ($mirror) { $webjsonru = Get -Url (Get-Link -e "/patches/Augmented%20translation/ru.json")
$true { "https://spotx-official.github.io/SpotX/patches/Augmented%20translation/ru.json" }
default { "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/patches/Augmented%20translation/ru.json" }
}
$webjsonru = Get -Url $urlru
if ($webjsonru -ne $null) { if ($webjsonru -ne $null) {
@@ -965,13 +966,7 @@ if ($ch -eq 'n') {
$ch = $null $ch = $null
$webjson = Get -Url (Get-Link -e "/patches/patches.json") -RetrySeconds 5
$url = switch ($mirror) {
$true { "https://spotx-official.github.io/SpotX/patches/patches.json" }
default { "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/patches/patches.json" }
}
$webjson = Get -Url $url -RetrySeconds 5
if ($webjson -eq $null) { if ($webjson -eq $null) {
Write-Host Write-Host
@@ -1350,7 +1345,7 @@ function Helper($paramname) {
} }
if ($urlform_goofy -and $idbox_goofy) { if ($urlform_goofy -and $idbox_goofy) {
$webjson.VariousJs.goofyhistory.replace = "`$1 const urlForm=" + '"' + $urlform_goofy + '"' + ";const idBox=" + '"' + $idbox_goofy + '"' + $webjson.VariousJs.goofyhistory.replace $webjson.VariousJs.goofyhistory.replace = $webjson.VariousJs.goofyhistory.replace -f "`"$urlform_goofy`"", "`"$idbox_goofy`""
} }
else { Remove-Json -j $VarJs -p "goofyhistory" } else { Remove-Json -j $VarJs -p "goofyhistory" }
@@ -1681,15 +1676,10 @@ If ($test_spa) {
# Forced exp # Forced exp
extract -counts 'one' -method 'zip' -name 'xpui.js' -helper 'ForcedExp' -add $webjson.others.byspotx.add extract -counts 'one' -method 'zip' -name 'xpui.js' -helper 'ForcedExp' -add $webjson.others.byspotx.add
# Hiding Ad-like sections or turn off podcasts from the homepage # Hiding Ad-like sections or turn off podcasts from the homepage
if ($podcast_off -or $adsections_off) { if ($podcast_off -or $adsections_off) {
$url = switch ($mirror) { $section = Get -Url (Get-Link -e "/js-helper/sectionBlock.js")
$true { "https://spotx-official.github.io/SpotX/js-helper/sectionBlock.js" }
default { "https://raw.githubusercontent.com/SpotX-Official/SpotX/main/js-helper/sectionBlock.js" }
}
$section = Get -Url $url
if ($section -ne $null) { if ($section -ne $null) {
@@ -1700,6 +1690,16 @@ If ($test_spa) {
} }
} }
# goofy History
if ($urlform_goofy -and $idbox_goofy) {
$goofy = Get -Url (Get-Link -e "/js-helper/goofyHistory.js")
if ($goofy -ne $null) {
injection -p $xpui_spa_patch -f "spotx-helper" -n "goofyHistory.js" -c $goofy
}
}
extract -counts 'one' -method 'zip' -name 'xpui.js' -helper 'VariousofXpui-js' extract -counts 'one' -method 'zip' -name 'xpui.js' -helper 'VariousofXpui-js'