@@ -26,6 +26,7 @@ type Flag struct {
2626 RemoveRTL bool
2727 // ExposeAPIs leaks some Spotify's API, functions, objects to Spicetify global object.
2828 ExposeAPIs bool
29+ SpotifyVer string
2930}
3031
3132func readRemoteCssMap (tag string , cssTranslationMap * map [string ]string ) error {
@@ -82,6 +83,18 @@ func Start(version string, extractedAppsPath string, flags Flag) {
8283 readLocalCssMap (& cssTranslationMap )
8384 }
8485
86+ verParts := strings .Split (flags .SpotifyVer , "." )
87+ spotifyMajor , spotifyMinor , spotifyPatch := 0 , 0 , 0
88+ if len (verParts ) > 0 {
89+ spotifyMajor , _ = strconv .Atoi (verParts [0 ])
90+ }
91+ if len (verParts ) > 1 {
92+ spotifyMinor , _ = strconv .Atoi (verParts [1 ])
93+ }
94+ if len (verParts ) > 2 {
95+ spotifyPatch , _ = strconv .Atoi (verParts [2 ])
96+ }
97+
8598 filepath .Walk (appPath , func (path string , info os.FileInfo , err error ) error {
8699 fileName := info .Name ()
87100 extension := filepath .Ext (fileName )
@@ -101,8 +114,13 @@ func Start(version string, extractedAppsPath string, flags Flag) {
101114 switch fileName {
102115 case "xpui.js" :
103116 content = exposeAPIs_main (content )
117+ if spotifyMajor >= 1 && spotifyMinor >= 2 && spotifyPatch >= 57 {
118+ content = exposeAPIs_vendor (content )
119+ }
104120 case "vendor~xpui.js" :
105- content = exposeAPIs_vendor (content )
121+ if spotifyMajor < 1 && spotifyMinor < 2 && spotifyPatch < 57 {
122+ content = exposeAPIs_vendor (content )
123+ }
106124 }
107125 }
108126 for k , v := range cssTranslationMap {
0 commit comments