Skip to content

Commit 53b97e8

Browse files
committed
fix(preprocess): apply old snackbar regex for 1.2.77 and below
1 parent 90fcc18 commit 53b97e8

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/preprocess/preprocess.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,14 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
242242
return fmt.Sprintf(`%s || []`, submatches[1])
243243
})
244244
}
245+
246+
// to avoid syntaxerror on Spotify 1.2.78 and above
247+
if spotifyMajor >= 1 && spotifyMinor >= 2 && spotifyPatch < 78 {
248+
utils.ReplaceOnce(&content, `\(\({[^}]*,\s*imageSrc`, func(submatches ...string) string {
249+
return fmt.Sprintf("Spicetify.Snackbar.enqueueImageSnackbar=%s", submatches[0])
250+
})
251+
}
252+
245253
content = additionalPatches(content)
246254
}
247255

@@ -948,9 +956,9 @@ func exposeAPIs_main(input string) string {
948956
},
949957
{
950958
Name: "Spotify Image Snackbar Interface",
951-
Regex: `\(\({[^}]*,\s*imageSrc`,
959+
Regex: `(=)(\(\({[^}]*,\s*imageSrc)`,
952960
Replacement: func(submatches ...string) string {
953-
return fmt.Sprintf("Spicetify.Snackbar.enqueueImageSnackbar=%s", submatches[0])
961+
return fmt.Sprintf("%sSpicetify.Snackbar.enqueueImageSnackbar=%s", submatches[1], submatches[2])
954962
},
955963
},
956964
{

0 commit comments

Comments
 (0)