@@ -38,9 +38,9 @@ type Patch struct {
38
38
Once bool
39
39
}
40
40
41
- type patchReporter func (string )
41
+ type logPatch func (string )
42
42
43
- func applyPatches (input string , patches []Patch , report ... patchReporter ) string {
43
+ func applyPatches (input string , patches []Patch , report ... logPatch ) string {
44
44
for _ , patch := range patches {
45
45
if len (report ) > 0 && report [0 ] != nil {
46
46
report [0 ](fmt .Sprintf ("%s patch" , patch .Name ))
@@ -290,7 +290,7 @@ func StartCSS(extractedAppsPath string) {
290
290
}
291
291
292
292
func colorVariableReplace (content string ) string {
293
- patches := []Patch {
293
+ colorPatches := []Patch {
294
294
{
295
295
Name : "CSS: --spice-player" ,
296
296
Regex : "#(181818|212121)" ,
@@ -447,11 +447,11 @@ func colorVariableReplace(content string) string {
447
447
},
448
448
}
449
449
450
- return applyPatches (content , patches )
450
+ return applyPatches (content , colorPatches )
451
451
}
452
452
453
453
func colorVariableReplaceForJS (content string ) string {
454
- patches := []Patch {
454
+ colorVariablePatches := []Patch {
455
455
{
456
456
Name : "CSS (JS): --spice-button" ,
457
457
Regex : `"#1db954"` ,
@@ -482,7 +482,7 @@ func colorVariableReplaceForJS(content string) string {
482
482
},
483
483
}
484
484
485
- return applyPatches (content , patches )
485
+ return applyPatches (content , colorVariablePatches )
486
486
}
487
487
488
488
func disableSentry (input string ) string {
@@ -497,7 +497,7 @@ func disableSentry(input string) string {
497
497
}
498
498
499
499
func disableLogging (input string ) string {
500
- patches := []Patch {
500
+ loggingPatches := []Patch {
501
501
{
502
502
Name : "Remove sp://logging/v3/*" ,
503
503
Regex : `sp://logging/v3/\w+` ,
@@ -702,11 +702,11 @@ func disableLogging(input string) string {
702
702
},
703
703
},
704
704
}
705
- return applyPatches (input , patches )
705
+ return applyPatches (input , loggingPatches )
706
706
}
707
707
708
708
func removeRTL (input string ) string {
709
- patches := []Patch {
709
+ rtlPatches := []Patch {
710
710
{
711
711
Name : "Remove }[dir=ltr]" ,
712
712
Regex : `}\[dir=ltr\]\s?` ,
@@ -793,10 +793,10 @@ func removeRTL(input string) string {
793
793
},
794
794
}
795
795
796
- return applyPatches (input , patches )
796
+ return applyPatches (input , rtlPatches )
797
797
}
798
798
799
- func exposeAPIs_main (input string , report patchReporter ) string {
799
+ func exposeAPIs_main (input string , report logPatch ) string {
800
800
inputContextMenu := utils .FindFirstMatch (input , `.*value:"contextmenu"` )
801
801
if len (inputContextMenu ) > 0 {
802
802
croppedInput := inputContextMenu [0 ]
@@ -823,7 +823,7 @@ func exposeAPIs_main(input string, report patchReporter) string {
823
823
})
824
824
}
825
825
826
- patches := []Patch {
826
+ xpuiPatches := []Patch {
827
827
{
828
828
Name : "showNotification patch" ,
829
829
Regex : `(?:\w+ |,)([\w$]+)=(\([\w$]+=[\w$]+\.dispatch)` ,
@@ -881,28 +881,28 @@ func exposeAPIs_main(input string, report patchReporter) string {
881
881
},
882
882
},
883
883
{
884
- Name : "GraphQL definitions <=1.2.30" ,
884
+ Name : "GraphQL definitions ( <=1.2.30) " ,
885
885
Regex : `((?:\w+ ?)?[\w$]+=)(\{kind:"Document",definitions:\[\{(?:\w+:[\w"]+,)+name:\{(?:\w+:[\w"]+,?)+value:("\w+"))` ,
886
886
Replacement : func (submatches ... string ) string {
887
887
return fmt .Sprintf ("%sSpicetify.GraphQL.Definitions[%s]=%s" , submatches [1 ], submatches [3 ], submatches [2 ])
888
888
},
889
889
},
890
890
{
891
- Name : "GraphQL definitons >=1.2.31" ,
891
+ Name : "GraphQL definitons ( >=1.2.31) " ,
892
892
Regex : `(=new [\w_\$][\w_\$\d]*\.[\w_\$][\w_\$\d]*\("(\w+)","(query|mutation)","[\w\d]{64}",null\))` ,
893
893
Replacement : func (submatches ... string ) string {
894
894
return fmt .Sprintf (`=Spicetify.GraphQL.Definitions["%s"]%s` , submatches [2 ], submatches [1 ])
895
895
},
896
896
},
897
897
{
898
- Name : "Spotify Custom Snackbar Interfaces <=1.2.37" ,
898
+ Name : "Spotify Custom Snackbar Interfaces ( <=1.2.37) " ,
899
899
Regex : `\b\w\s*\(\)\s*[^;,]*enqueueCustomSnackbar:\s*(\w)\s*[^;]*;` ,
900
900
Replacement : func (submatches ... string ) string {
901
901
return fmt .Sprintf ("%sSpicetify.Snackbar.enqueueCustomSnackbar=%s;" , submatches [0 ], submatches [1 ])
902
902
},
903
903
},
904
904
{
905
- Name : "Spotify Custom Snackbar Interfaces >=1.2.38" ,
905
+ Name : "Spotify Custom Snackbar Interfaces ( >=1.2.38) " ,
906
906
Regex : `(=)[^=]*\(\)\.enqueueCustomSnackbar;` ,
907
907
Replacement : func (submatches ... string ) string {
908
908
return fmt .Sprintf ("=Spicetify.Snackbar.enqueueCustomSnackbar%s;" , submatches [0 ])
@@ -932,10 +932,10 @@ func exposeAPIs_main(input string, report patchReporter) string {
932
932
},
933
933
}
934
934
935
- return applyPatches (input , patches , report )
935
+ return applyPatches (input , xpuiPatches , report )
936
936
}
937
937
938
- func exposeAPIs_vendor (input string , report patchReporter ) string {
938
+ func exposeAPIs_vendor (input string , report logPatch ) string {
939
939
// URI
940
940
utils .Replace (
941
941
& input ,
@@ -944,7 +944,7 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
944
944
return fmt .Sprintf (`,(globalThis.Spicetify.URI=%s)%s` , submatches [1 ], submatches [0 ])
945
945
})
946
946
947
- patches := []Patch {
947
+ vendorPatches := []Patch {
948
948
{
949
949
Name : "Spicetify.URI" ,
950
950
Regex : `,(\w+)\.prototype\.toAppType` ,
@@ -953,14 +953,14 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
953
953
},
954
954
},
955
955
{
956
- Name : "Mapping styled-components classes" ,
956
+ Name : "Map styled-components classes" ,
957
957
Regex : `(\w+ [\w$_]+)=[\w$_]+\([\w$_]+>>>0\)` ,
958
958
Replacement : func (submatches ... string ) string {
959
959
return fmt .Sprintf ("%s=Spicetify._getStyledClassName(arguments,this)" , submatches [1 ])
960
960
},
961
961
},
962
962
{
963
- Name : "Mapping Tippy.js" ,
963
+ Name : "Tippy.js" ,
964
964
Regex : `([\w\$_]+)\.setDefaultProps=` ,
965
965
Replacement : func (submatches ... string ) string {
966
966
return fmt .Sprintf ("Spicetify.Tippy=%s;%s" , submatches [1 ], submatches [0 ])
@@ -1007,7 +1007,7 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
1007
1007
}
1008
1008
}
1009
1009
1010
- return applyPatches (input , patches , report )
1010
+ return applyPatches (input , vendorPatches , report )
1011
1011
}
1012
1012
1013
1013
type githubRelease = utils.GithubRelease
0 commit comments