@@ -214,6 +214,8 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
214
214
case "vendor~xpui.js" :
215
215
content = exposeAPIs_vendor (content , printPatch )
216
216
}
217
+
218
+ content = exposeGraphQL (content , printPatch )
217
219
}
218
220
printPatch ("CSS (JS): Patching our mappings into file" )
219
221
for k , v := range cssTranslationMap {
@@ -796,6 +798,27 @@ func removeRTL(input string) string {
796
798
return applyPatches (input , rtlPatches )
797
799
}
798
800
801
+ func exposeGraphQL (input string , report logPatch ) string {
802
+ graphQLPatches := []Patch {
803
+ {
804
+ Name : "GraphQL definitions (<=1.2.30)" ,
805
+ Regex : `((?:\w+ ?)?[\w$]+=)(\{kind:"Document",definitions:\[\{(?:\w+:[\w"]+,)+name:\{(?:\w+:[\w"]+,?)+value:("\w+"))` ,
806
+ Replacement : func (submatches ... string ) string {
807
+ return fmt .Sprintf ("%sSpicetify.GraphQL.Definitions[%s]=%s" , submatches [1 ], submatches [3 ], submatches [2 ])
808
+ },
809
+ },
810
+ {
811
+ Name : "GraphQL definitons (>=1.2.31)" ,
812
+ Regex : `(=new [\w_\$][\w_\$\d]*\.[\w_\$][\w_\$\d]*\("(\w+)","(query|mutation)","[\w\d]{64}",null\))` ,
813
+ Replacement : func (submatches ... string ) string {
814
+ return fmt .Sprintf (`=Spicetify.GraphQL.Definitions["%s"]%s` , submatches [2 ], submatches [1 ])
815
+ },
816
+ },
817
+ }
818
+
819
+ return applyPatches (input , graphQLPatches , report )
820
+ }
821
+
799
822
func exposeAPIs_main (input string , report logPatch ) string {
800
823
inputContextMenu := utils .FindFirstMatch (input , `.*value:"contextmenu"` )
801
824
if len (inputContextMenu ) > 0 {
@@ -880,20 +903,6 @@ func exposeAPIs_main(input string, report logPatch) string {
880
903
return ""
881
904
},
882
905
},
883
- {
884
- Name : "GraphQL definitions (<=1.2.30)" ,
885
- Regex : `((?:\w+ ?)?[\w$]+=)(\{kind:"Document",definitions:\[\{(?:\w+:[\w"]+,)+name:\{(?:\w+:[\w"]+,?)+value:("\w+"))` ,
886
- Replacement : func (submatches ... string ) string {
887
- return fmt .Sprintf ("%sSpicetify.GraphQL.Definitions[%s]=%s" , submatches [1 ], submatches [3 ], submatches [2 ])
888
- },
889
- },
890
- {
891
- Name : "GraphQL definitons (>=1.2.31)" ,
892
- Regex : `(=new [\w_\$][\w_\$\d]*\.[\w_\$][\w_\$\d]*\("(\w+)","(query|mutation)","[\w\d]{64}",null\))` ,
893
- Replacement : func (submatches ... string ) string {
894
- return fmt .Sprintf (`=Spicetify.GraphQL.Definitions["%s"]%s` , submatches [2 ], submatches [1 ])
895
- },
896
- },
897
906
{
898
907
Name : "Spotify Custom Snackbar Interfaces (<=1.2.37)" ,
899
908
Regex : `\b\w\s*\(\)\s*[^;,]*enqueueCustomSnackbar:\s*(\w)\s*[^;]*;` ,
0 commit comments