Skip to content

Commit

Permalink
fixed goofyhistory patch
Browse files Browse the repository at this point in the history
  • Loading branch information
amd64fox committed Sep 2, 2024
1 parent fd47891 commit f43f35a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion js-helper/goofyHistory.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const unique = new Set();

function Gofy_history(e, urlForm, idBox) {
function goofyHistory(e, urlForm, idBox) {

const uri = e?.item?.uri;

Expand Down
8 changes: 4 additions & 4 deletions patches/patches.json
Original file line number Diff line number Diff line change
Expand Up @@ -1896,11 +1896,11 @@
},
"goofyhistory": {
"version": {
"fr": "1.1.90",
"to": "1.2.44"
"fr": "1.1.70",
"to": ""
},
"match": "(function\\((?:.\\)\\{var .=.\\.isPreview,|\\{isPreview:.\\}\\)\\{const )(.)=\\(.+?(createDesktopNpbPlayerControlsEventFactory.+?)?;)(?=return)",
"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{};"
"match": "({data:.}\\)=>{|.\\.data;)((?:this|.)\\._state=(.))",
"replace": "$1goofyHistory($3, {0}, {1});$2"
},
"similarplaylist": {
"version": {
Expand Down
52 changes: 26 additions & 26 deletions run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -292,18 +292,24 @@ if ($psv -ge 7) {
# add Tls12
[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) {

$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'

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) }
Invoke-Expression $response
}
Expand Down Expand Up @@ -892,12 +898,7 @@ $ch = $null
# updated Russian translation
if ($langCode -eq 'ru' -and [version]$offline -ge [version]"1.1.92.644") {

$urlru = switch ($mirror) {
$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
$webjsonru = Get -Url (Get-Link -e "/patches/Augmented%20translation/ru.json")

if ($webjsonru -ne $null) {

Expand Down Expand Up @@ -965,13 +966,7 @@ if ($ch -eq 'n') {

$ch = $null


$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
$webjson = Get -Url (Get-Link -e "/patches/patches.json") -RetrySeconds 5

if ($webjson -eq $null) {
Write-Host
Expand Down Expand Up @@ -1350,7 +1345,7 @@ function Helper($paramname) {
}

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" }

Expand Down Expand Up @@ -1680,16 +1675,11 @@ If ($test_spa) {

# Forced exp
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
if ($podcast_off -or $adsections_off) {

$url = switch ($mirror) {
$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
$section = Get -Url (Get-Link -e "/js-helper/sectionBlock.js")

if ($section -ne $null) {

Expand All @@ -1699,7 +1689,17 @@ If ($test_spa) {
$podcast_off, $adsections_off = $false
}
}

# 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'

Expand Down

0 comments on commit f43f35a

Please sign in to comment.