Skip to content

Commit e0b351b

Browse files
committed
fix(wrapper): use type regex for menus
1 parent febac2e commit e0b351b

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

jsHelper/spicetifyWrapper.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -569,13 +569,19 @@ applyScrollingFix();
569569
};
570570
const reactComponentsUI = exposeReactComponentsUI({ modules, functionModules, exportedForwardRefs });
571571

572-
const knownMenuTypes = ["album", "show", "artist", "track"];
572+
const knownMenuTypes = ["album", "show", "artist", "track", "playlist"];
573573
const menus = modules
574-
.map((m) => m?.type?.toString().match(/value:"[\w-]+"/g) && [m, ...m.type.toString().match(/value:"[\w-]+"/g)])
574+
.map((m) => {
575+
const valueMatch = m?.type?.toString().match(/value:"([\w-]+)"/);
576+
if (valueMatch) return [m, valueMatch[1]];
577+
const typeMatch = m?.type?.toString().match(/type:[\w$]+\.[\w$]+\.([A-Z_]+)/);
578+
if (typeMatch) return [m, typeMatch[1].toLowerCase()];
579+
return null;
580+
})
575581
.filter(Boolean)
576582
.filter((m) => m[1] !== 'value:"row"')
577583
.map(([module, type]) => {
578-
type = type.match(/value:"([\w-]+)"/)[1];
584+
type = type.match(/value:"([\w-]+)"/)?.[1] ?? type;
579585

580586
if (!knownMenuTypes.includes(type)) return;
581587
if (type === "show") type = "podcast-show";
@@ -895,7 +901,7 @@ applyScrollingFix();
895901
const playlistMenuChunk = chunks.find(
896902
([, value]) => value.toString().includes('value:"playlist"') && value.toString().includes("canView") && value.toString().includes("permissions")
897903
);
898-
if (playlistMenuChunk) {
904+
if (playlistMenuChunk && !Spicetify.ReactComponent?.PlaylistMenu) {
899905
Spicetify.ReactComponent.PlaylistMenu = Object.values(require(playlistMenuChunk[0])).find(
900906
(m) => typeof m === "function" || typeof m === "object"
901907
);

src/preprocess/preprocess.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,7 @@ func additionalPatches(input string, report logPatch) string {
815815
},
816816
},
817817
{
818-
Name: "Search bug fix (1.2.57<= and >=1.2.28)",
818+
Name: "Search bug fix (>=1.2.28 and <=1.2.57)",
819819
Regex: `(typeName\\])`,
820820
Replacement: func(submatches ...string) string {
821821
return fmt.Sprintf(`%s || []`, submatches[1])

0 commit comments

Comments
 (0)