Skip to content

Commit d01ef48

Browse files
committed
feat: add a workaround around weird spotify condition
For some reason, Spotify checks if pathname starts with `/lyrics` in three different files for cinema mode(?). This breaks `/lyrics-plus` since it contains `/lyrics` at the start
1 parent bc8863c commit d01ef48

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/preprocess/preprocess.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
141141
embeddedString, _, _, err := utils.ReadStringFromUTF16Binary(binFilePath, startMarker, endMarker)
142142
if err != nil {
143143
utils.PrintWarning(fmt.Sprintf("Could not process %s: %v", binFilePath, err))
144-
utils.PrintInfo("If above warning says 'could not find start marker', you can safely ignore that error if you're on Spotify 1.2.63 or lower.")
144+
utils.PrintInfo("If above warning says 'could not find start marker', you can safely ignore that error if you're on Spotify 1.2.63 or lower and you're not on macOS Intel.")
145145
utils.PrintInfo("However, if you're on 1.2.64 or higher, please report this issue")
146146
continue
147147
}
@@ -151,7 +151,7 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
151151
utils.PrintWarning(fmt.Sprintf("Could not create xpui-modules.js: %v", err))
152152
break
153153
} else {
154-
utils.PrintSuccess("Extracted V8 snapshot blob (remaining xpui modules) to xpui-modules.js")
154+
utils.PrintSuccess("Finished extracting V8 snapshot blob to local file")
155155
break
156156
}
157157
}
@@ -219,6 +219,13 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
219219
}
220220
content = additionalPatches(content)
221221
}
222+
223+
if fileName == "dwp-top-bar.js" || fileName == "dwp-now-playing-bar.js" || fileName == "dwp-home-chips-row.js" {
224+
utils.ReplaceOnce(&content, `(\w+\.pathname)\.startsWith\((\w+)\)`, func(submatches ...string) string {
225+
return fmt.Sprintf("%s === %s", submatches[1], submatches[2])
226+
})
227+
}
228+
222229
for k, v := range cssTranslationMap {
223230
utils.Replace(&content, k, func(submatches ...string) string {
224231
return v

0 commit comments

Comments
 (0)