preparing for 1.2.65

- fixed a bug in v8 snapshot parsing
- refactoring the method for blocking podcasts and sections on the main page
- fixed patch discriptions
- fixed css rules
This commit is contained in:
amd64fox
2025-10-16 10:38:05 +03:00
parent ab9ab17055
commit a500bf2100
3 changed files with 343 additions and 108 deletions

View File

@@ -1,82 +1,294 @@
function sectionBlock(e, type) {
const API_PATHFINDER = 'api-partner.spotify.com/pathfinder';
const API_RECOMMENDATIONS = 'api.spotify.com/v1/views/personalized-recommendations';
const body = e?.data?.home;
const BLOCKED_SECTIONS_BY_CATEGORY = {
'Party': [
'0JQ5DAnM3wGh0gz1MXnul1'
],
'Chill': [
'0JQ5DAnM3wGh0gz1MXnukV'
],
'Best of the Year': [
'0JQ5IMCbQBLupUQrQFeCzx'
],
'Best of Artists / Tracks': [
'0JQ5DAnM3wGh0gz1MXnu3C'
],
'Best of songwriters': [
'0JQ5DAnM3wGh0gz1MXnu4w'
],
'Biggest Indie Playlists': [
'0JQ5IMCbQBLhSb02SGYpDM'
],
'Charts': [
'0JQ5DAnM3wGh0gz1MXnu5g'
],
'Dinner': [
'0JQ5DAnM3wGh0gz1MXnu3p'
],
'Featured Charts': [
'0JQ5DAob0KOew1FBAMSmBz'
],
'Focus': [
'0JQ5DAob0JCuWaGLU6ntFY',
'0JQ5DAnM3wGh0gz1MXnulP'
],
'Fresh new music': [
'0JQ5DAnM3wGh0gz1MXnu3s'
],
'Gaming music': [
'0JQ5DAob0LaV9FOMJ9utY5'
],
'Happy': [
'0JQ5DAnM3wGh0gz1MXnu3q'
],
'ICE PHONK': [
'0JQ5IMCbQBLiqrNCH9VvmA'
],
'Mood': [
'0JQ5DAnM3wGh0gz1MXnucG',
'0JQ5DAob0JCuWaGLU6ntFT'
],
'Most Listened 2023': [
'0JQ5IMCbQBLicmNERjnGn5'
],
'Music to game to': [
'0JQ5DAob0Jr9ClCbkV4pZD'
],
'Popular Albums / Artists': [
'0JQ5DAnM3wGh0gz1MXnu3B'
],
'Popular new releases': [
'0JQ5DAnM3wGh0gz1MXnu3D'
],
'Popular radio': [
'0JQ5DAnM3wGh0gz1MXnu4h'
],
'Sad': [
'0JQ5DAnM3wGh0gz1MXnu3u',
'0JQ5DAnM3wGh0gz1MXnul2'
],
'Throwback': [
'0JQ5DAnM3wGh0gz1MXnu3w',
'0JQ5DAnM3wGh0gz1MXnul4'
],
'Throwback Thursday / Spotify Playlists / Good night ': [
'0JQ5DAuChZYPe9iDhh2mJz'
],
'Today`s biggest hits': [
'0JQ5DAnM3wGh0gz1MXnu3M'
],
'Trending now': [
'0JQ5DAnM3wGh0gz1MXnu3E'
],
'Workout': [
'0JQ5DAnM3wGh0gz1MXnu3x',
'0JQ5DAnM3wGh0gz1MXnul6'
],
'Now defrosting': [
'0JQ5IMCbQBLlC31GvtaB6w'
],
'Unknown': [
'0JQ5IMCbQBLqTJyy28YCa9',
'0JQ5DAnM3wGh0gz1MXnu7R'
]
};
const BLOCKED_SECTIONS = {};
for (const [category, ids] of Object.entries(BLOCKED_SECTIONS_BY_CATEGORY)) {
for (const id of ids) {
BLOCKED_SECTIONS[id] = category;
}
}
const BLOCKED_CONTENT_TYPES = new Set(['Podcast', 'Audiobook', 'Episode']);
const createSectionAdapter = (isPersonalizedRecommendations) => {
if (isPersonalizedRecommendations) {
return {
getId: (item) => {
const href = item?.href;
if (!href) return null;
const parts = href.split('/');
let id = parts[parts.length - 1];
if (id.startsWith('section')) {
id = id.substring(7);
}
return id;
},
getTitle: (item) => item?.content?.name || 'Unknown',
getRef: (item) => item?.href,
getSectionId: (item) => item?.id,
getContentItems: (item) => item?.content?.items,
getContentData: (contentItem) => contentItem?.content,
getContentType: (contentItem) => contentItem?.type,
getContentTypeName: (contentItem) => contentItem?.content_type
};
} else {
return {
getId: (item) => {
const uri = item?.uri;
if (!uri) return null;
const parts = uri.split(':');
return parts[parts.length - 1];
},
getTitle: (item) => item?.data?.title?.text || 'Unknown',
getRef: (item) => item?.uri,
getSectionId: (item) => null,
getContentItems: (item) => item?.sectionItems?.items,
getContentData: (contentItem) => contentItem?.content?.data,
getContentType: (contentItem) => null,
getContentTypeName: (contentItem) => null
};
}
};
const processShortcutsSection = (contentItems, adapter, removed) => {
if (!contentItems?.length) return false;
for (let j = contentItems.length - 1; j >= 0; j--) {
const contentItem = contentItems[j];
const contentType = adapter.getContentTypeName(contentItem);
if (contentType !== 'PODCAST_EPISODE' && contentType !== 'AUDIOBOOK') {
continue;
}
removed.push({
type: contentType,
name: contentItem?.name || 'Unknown',
uri: contentItem?.uri || 'N/A'
});
contentItems.splice(j, 1);
}
return true;
};
const isPodcastSection = (contentItems, adapter) => {
if (!contentItems?.length) return false;
return adapter.getContentType(contentItems[0]) === 'show';
};
const removeBlockedContent = (contentItems, adapter, removed) => {
if (!contentItems?.length) return;
for (let j = contentItems.length - 1; j >= 0; j--) {
const contentData = adapter.getContentData(contentItems[j]);
if (!contentData || !BLOCKED_CONTENT_TYPES.has(contentData.__typename)) {
continue;
}
removed.push({
type: contentData.__typename,
name: contentData.name || 'Unknown',
uri: contentData.uri || 'N/A'
});
contentItems.splice(j, 1);
}
};
function sectionBlock(data, type) {
const body = data?.data?.home;
const sections = body?.sectionContainer?.sections?.items;
const items = data?.content?.items || data?.data?.content?.items;
const isPersonalizedRecommendations = !!items && !body;
const targetArray = isPersonalizedRecommendations ? items : sections;
function removeSections() {
const sectionsData = [
{ id: '0JQ5IMCbQBLupUQrQFeCzx', name: 'Best of the Year' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3C', name: 'Best of Artists / Tracks' },
{ id: '0JQ5DAnM3wGh0gz1MXnu4w', name: 'Best of songwriters' },
{ id: '0JQ5IMCbQBLhSb02SGYpDM', name: 'Biggest Indie Playlists' },
{ id: '0JQ5DAnM3wGh0gz1MXnu5g', name: 'Charts' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3p', name: 'Dinner' },
{ id: '0JQ5DAob0KOew1FBAMSmBz', name: 'Featured Charts' },
{ id: '0JQ5DAob0JCuWaGLU6ntFY', name: 'Focus' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3s', name: 'Fresh new music' },
{ id: '0JQ5DAob0LaV9FOMJ9utY5', name: 'Gaming music' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3q', name: 'Happy' },
{ id: '0JQ5IMCbQBLiqrNCH9VvmA', name: 'ICE PHONK' },
{ id: '0JQ5DAnM3wGh0gz1MXnucG', name: 'Mood' },
{ id: '0JQ5DAob0JCuWaGLU6ntFT', name: 'Mood' },
{ id: '0JQ5IMCbQBLicmNERjnGn5', name: 'Most Listened 2023' },
{ id: '0JQ5DAob0Jr9ClCbkV4pZD', name: 'Music to game to' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3B', name: 'Popular Albums / Artists' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3D', name: 'Popular new releases' },
{ id: '0JQ5DAnM3wGh0gz1MXnu4h', name: 'Popular radio' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3u', name: 'Sad' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3w', name: 'Throwback' },
{ id: '0JQ5DAuChZYPe9iDhh2mJz', name: 'Throwback Thursday / Spotify Playlists' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3M', name: 'Today`s biggest hits' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3E', name: 'Trending now' },
{ id: '0JQ5DAnM3wGh0gz1MXnu3x', name: 'Workout' },
{ id: '0JQ5IMCbQBLqTJyy28YCa9', name: '?' },
{ id: '0JQ5IMCbQBLlC31GvtaB6w', name: '?' },
{ id: '0JQ5DAnM3wGh0gz1MXnu7R', name: '?' }
];
const sectionIdsRegex = new RegExp(sectionsData.map(section => section.id).join('|'));
if (!targetArray?.length) return;
for (let i = sections.length - 1; i >= 0; i--) {
const uri = sections[i]?.uri;
if (uri && uri.match(sectionIdsRegex)) {
sections.splice(i, 1);
const adapter = createSectionAdapter(isPersonalizedRecommendations);
const removed = [];
for (let i = targetArray.length - 1; i >= 0; i--) {
const item = targetArray[i];
const sectionId = adapter.getId(item);
if (!sectionId) continue;
if (sectionId in BLOCKED_SECTIONS) {
removed.push({
id: sectionId,
knownAs: BLOCKED_SECTIONS[sectionId],
actualTitle: adapter.getTitle(item),
ref: adapter.getRef(item)
});
targetArray.splice(i, 1);
}
}
if (removed.length > 0) {
console.log(`[SectionBlock] Removed ${removed.length} blocked section(s):`, removed);
}
}
function removePodcasts() {
if (Array.isArray(sections)) {
for (let i = 0; i < sections.length; i++) {
const sectionItems = sections[i]?.sectionItems?.items;
if (!targetArray?.length) return;
if (Array.isArray(sectionItems)) {
for (let j = 0; j < sectionItems.length; j++) {
const contentData = sectionItems[j]?.content?.data;
const adapter = createSectionAdapter(isPersonalizedRecommendations);
const removed = [];
if (contentData && ["Podcast", "Audiobook", "Episode"].includes(contentData.__typename)) {
sectionItems.splice(j, 1);
j--;
}
}
for (let i = targetArray.length - 1; i >= 0; i--) {
const item = targetArray[i];
const contentItems = adapter.getContentItems(item);
if (isPersonalizedRecommendations) {
const sectionId = adapter.getSectionId(item);
if (sectionId === 'shortcuts') {
processShortcutsSection(contentItems, adapter, removed);
continue;
}
if (isPodcastSection(contentItems, adapter)) {
removed.push({
type: 'PodcastSection',
sectionId: sectionId,
sectionName: adapter.getTitle(item),
itemsCount: contentItems.length
});
targetArray.splice(i, 1);
continue;
}
}
removeBlockedContent(contentItems, adapter, removed);
}
if (removed.length > 0) {
console.log(`[SectionBlock] Removed ${removed.length} podcast/audiobook item(s):`, removed);
}
}
function removeCanvasSections() {
if (Array.isArray(sections)) {
for (let i = sections.length - 1; i >= 0; i--) {
if (!sections?.length) return;
const sectionDataTypename = sections[i]?.data?.__typename;
const removed = [];
if (sectionDataTypename === 'HomeFeedBaselineSectionData') {
sections.splice(i, 1);
}
for (let i = sections.length - 1; i >= 0; i--) {
if (sections[i]?.data?.__typename === 'HomeFeedBaselineSectionData') {
removed.push({
uri: sections[i]?.uri || 'N/A',
title: sections[i]?.data?.title?.text || 'Canvas Section'
});
sections.splice(i, 1);
}
}
if (removed.length > 0) {
console.log(`[SectionBlock] Removed ${removed.length} canvas section(s):`, removed);
}
}
if (body?.greeting && sections) {
if ((body?.greeting && sections) || items) {
const actions = {
section: removeSections,
podcast: removePodcasts,
@@ -84,9 +296,13 @@ function sectionBlock(e, type) {
all: () => {
removeSections();
removePodcasts();
removeCanvasSections();
if (!isPersonalizedRecommendations) {
removeCanvasSections();
}
}
};
if (Array.isArray(type)) {
type.forEach(t => actions[t]?.());
} else {
@@ -94,3 +310,43 @@ function sectionBlock(e, type) {
}
}
}
const originalFetch = window.fetch;
window.fetch = async function (...args) {
const [url] = args;
const urlString = typeof url === 'string' ? url : url?.url || '';
const isPathfinderUrl = urlString.includes(API_PATHFINDER);
const isPersonalizedRecommendationsUrl = urlString.includes(API_RECOMMENDATIONS);
if (!isPathfinderUrl && !isPersonalizedRecommendationsUrl) {
return originalFetch.apply(this, args);
}
const response = await originalFetch.apply(this, args);
const clonedResponse = response.clone();
try {
const data = await response.json();
const shouldModify = (isPathfinderUrl && data?.data?.home) ||
(isPersonalizedRecommendationsUrl && data?.content);
if (!shouldModify) {
return clonedResponse;
}
sectionBlock(data, '');
return new Response(JSON.stringify(data), {
status: response.status,
statusText: response.statusText,
headers: response.headers
});
} catch (error) {
console.error('Fetch intercept error:', error);
return clonedResponse;
}
};

View File

@@ -63,7 +63,7 @@
"fr": "1.1.59",
"to": ""
},
"match": "((..createElement|children:\\(.{1,7}\\))\\(.{1,7},{source:).{1,7}get\\(\"about.copyright\",.\\),paragraphClassName:.}\\)",
"match": "((..createElement|children:\\(.{1,7}\\))\\(.{1,7},{source:).{1,7}get\\(\"about.copyright\",.\\),paragraphClassName:(?:\"[\\w]+\"|\\w+)",
"replace": "<h3>More about SpotX</h3><br><details><summary>{0} Github</summary><a href='https://github.com/SpotX-Official/SpotX'>SpotX-Windows</a><br><a href='https://github.com/SpotX-Official/SpotX-Bash'>SpotX-Mac/Linux</a><br><br/></details><details><summary>{1} Telegram</summary><a href='https://t.me/SpotxCommunity'>SpotX Community</a><br><a href='https://t.me/spotify_windows_mod'>SpotX Channel</a><br><br/></details><details><summary>{2} FAQ</summary><a href='https://te.legra.ph/SpotX-FAQ-09-19'>Windows</a><br><a href='https://github.com/jetfir3/SpotX-Bash/wiki/SpotX%E2%80%90Bash-FAQ'>Mac/Linux</a></details><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.",
"svgtg": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path id='telegram-1' d='M18.384,22.779c0.322,0.228 0.737,0.285 1.107,0.145c0.37,-0.141 0.642,-0.457 0.724,-0.84c0.869,-4.084 2.977,-14.421 3.768,-18.136c0.06,-0.28 -0.04,-0.571 -0.26,-0.758c-0.22,-0.187 -0.525,-0.241 -0.797,-0.14c-4.193,1.552 -17.106,6.397 -22.384,8.35c-0.335,0.124 -0.553,0.446 -0.542,0.799c0.012,0.354 0.25,0.661 0.593,0.764c2.367,0.708 5.474,1.693 5.474,1.693c0,0 1.452,4.385 2.209,6.615c0.095,0.28 0.314,0.5 0.603,0.576c0.288,0.075 0.596,-0.004 0.811,-0.207c1.216,-1.148 3.096,-2.923 3.096,-2.923c0,0 3.572,2.619 5.598,4.062Zm-11.01,-8.677l1.679,5.538l0.373,-3.507c0,0 6.487,-5.851 10.185,-9.186c0.108,-0.098 0.123,-0.262 0.033,-0.377c-0.089,-0.115 -0.253,-0.142 -0.376,-0.064c-4.286,2.737 -11.894,7.596 -11.894,7.596Z' fill='#fff'/></svg>",
"svggit": "<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'><path d='M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z' fill='#fff'/></svg>",
@@ -1529,6 +1529,15 @@
"to": ""
}
},
"SyncingSearchHistoryToBackend": {
"name": "enableSyncingSearchHistoryToBackend",
"description": "Enables syncing search history to the backend",
"native_description": "Enables syncing search history to the backend",
"version": {
"fr": "1.2.75",
"to": ""
}
},
"WatchFeedEntityPages": {
"name": "enableWatchFeedEntityPages",
"description": "enabled track fragments in playlists, artists, albums",
@@ -2265,28 +2274,28 @@
"fr": "1.2.36",
"to": ""
},
"add": " .LVMjmN2CaPruPAo62RAY, .Wn4fEKCJ6jYPfG2Y0ABn, .Y3Kd8WKnE3ZW9lzgA8nN { display: none !important }"
"add": " .LVMjmN2CaPruPAo62RAY, .Wn4fEKCJ6jYPfG2Y0ABn, .Y3Kd8WKnE3ZW9lzgA8nN, .C_T1Uoz7Fws_AFDl { display: none !important }"
},
"downloadquality": {
"version": {
"fr": "1.2.30",
"to": ""
},
"add": " :is(.weV_qxFz4gF5sPotO10y, .BMtRRwqaJD_95vJFMFD0, .eguwzH_QWTBXry7hiNj3):has([for=\"desktop.settings.downloadQuality\"]) {display: none}"
"add": " :is(.weV_qxFz4gF5sPotO10y, .BMtRRwqaJD_95vJFMFD0, .eguwzH_QWTBXry7hiNj3, .qV_CxbowaNkMarye, .qV_CxbowaNkMarye):has([for=\"desktop.settings.downloadQuality\"]) {display: none}"
},
"downloadicon": {
"version": {
"fr": "1.1.74",
"to": ""
},
"add": " .BKsbV2Xl786X9a09XROH, .GWCBhKJqeZal3n5tCQwl {display:none}"
"add": " .BKsbV2Xl786X9a09XROH, .GWCBhKJqeZal3n5tCQwl, .pX3IkLhEry0wVfiU {display:none}"
},
"submenudownload": {
"version": {
"fr": "1.1.74",
"to": ""
},
"add": " .pzkhLqffqF_4hucrVVQA, .egE6UQjF_UUoCzvMxREj, .Y98_oiegQgSpY_o7hoKG {display:none}"
"add": " .pzkhLqffqF_4hucrVVQA, .egE6UQjF_UUoCzvMxREj, .Y98_oiegQgSpY_o7hoKG, .tT_JypfxNakuY1jHgyBN, .zVA1h9TUy8QQBogj {display:none}"
},
"veryhighstream": {
"version": {
@@ -2346,14 +2355,6 @@
"true$2"
]
},
"block_section": {
"version": {
"fr": "1.1.86",
"to": ""
},
"match": "(case 6:|const .=await .\\([^\\)]*\\);)((return .\\.abrupt\\(\"|return[ \"],?)(null!=n&&|return\",)?(.)(\\);case 9|\\??.errors\\?.*?Promise.reject.+?errors\\)+:.))",
"replace": "$1sectionBlock($5,\"{0}\");$2"
},
"banner_home": {
"version": {
"fr": "1.1.70",

54
run.ps1
View File

@@ -1397,37 +1397,6 @@ function Helper($paramname) {
else { Remove-Json -j $VarJs -p 'product_state' }
$type = $null
$global:type = $null
if ($podcast_off -or $adsections_off -or $canvashome_off) {
$active_elements = @()
if ($podcast_off) { $active_elements += "podcast" }
if ($adsections_off) { $active_elements += "section" }
if ($canvashome_off) { $active_elements += "canvas" }
switch ($active_elements.Count) {
3 {
$type = "all"
}
2 {
$type = '[' + (($active_elements | ForEach-Object { "`"$_`"" }) -join ", ") + ']'
$webjson.VariousJs.block_section.replace = $webjson.VariousJs.block_section.replace -replace '\"', ''
}
1 {
$type = $active_elements[0]
}
}
$webjson.VariousJs.block_section.replace = $webjson.VariousJs.block_section.replace -f $type
$global:type = $type
}
else {
Remove-Json -j $VarJs -p 'block_section'
}
$name = "patches.json.VariousJs."
$n = "xpui.js"
$contents = $webjson.VariousJs.psobject.properties.name
@@ -2023,12 +1992,10 @@ if ($test_spa) {
if ($v8_snapshot) {
$modules = Extract-WebpackModules -InputFile $v8_snapshot
$firstLine = ($modules -split "`r?`n" | Select-Object -First 1)
$archive_spa.Dispose()
$archive_spa = [System.IO.Compression.ZipFile]::Open($xpui_spa_patch, [System.IO.Compression.ZipArchiveMode]::Update)
Update-ZipEntry -archive $archive_spa -entryName 'xpui-snapshot.js' -prepend $firstLine -newEntryName 'xpui.js' -Verbose:$VerbosePreference
Update-ZipEntry -archive $archive_spa -entryName 'xpui-snapshot.js' -prepend $modules -newEntryName 'xpui.js' -Verbose:$VerbosePreference
Update-ZipEntry -archive $archive_spa -entryName 'xpui-snapshot.css' -newEntryName 'xpui.css' -Verbose:$VerbosePreference
@@ -2160,11 +2127,22 @@ if ($test_spa) {
if ($section -ne $null) {
$calltype = switch ($true) {
($podcast_off -and $adsections_off -and $canvashome_off) { 'all'; break }
($podcast_off -and $adsections_off) { 'podcast, section'; break }
($podcast_off -and $canvashome_off) { 'podcast, canvas'; break }
($adsections_off -and $canvashome_off) { 'section, canvas'; break }
$podcast_off { 'podcast'; break }
$adsections_off { 'section'; break }
$canvashome_off { 'canvas'; break }
default { $null }
}
$section = $section -replace "sectionBlock\(data, ''\)", "sectionBlock(data, '$calltype')"
injection -p $xpui_spa_patch -f "spotx-helper" -n "sectionBlock.js" -c $section
}
else {
$podcast_off, $adsections_off = $false
}
}
# goofy History
@@ -2245,7 +2223,7 @@ if ($test_spa) {
}
}
# block subfeeds
if ($global:type -match "all" -or $global:type -match "podcast") {
if ($calltype -match "all" -or $calltype -match "podcast") {
$css += $webjson.others.block_subfeeds.add
}
# scrollbar indent fixes