Skip to content

Commit c77ca80

Browse files
committed
chore: change names
1 parent cdb0a45 commit c77ca80

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/preprocess/preprocess.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ type Patch struct {
3838
Once bool
3939
}
4040

41-
type patchReporter func(string)
41+
type logPatch func(string)
4242

43-
func applyPatches(input string, patches []Patch, report ...patchReporter) string {
43+
func applyPatches(input string, patches []Patch, report ...logPatch) string {
4444
for _, patch := range patches {
4545
if len(report) > 0 && report[0] != nil {
4646
report[0](fmt.Sprintf("%s patch", patch.Name))
@@ -290,7 +290,7 @@ func StartCSS(extractedAppsPath string) {
290290
}
291291

292292
func colorVariableReplace(content string) string {
293-
patches := []Patch{
293+
colorPatches := []Patch{
294294
{
295295
Name: "CSS: --spice-player",
296296
Regex: "#(181818|212121)",
@@ -447,11 +447,11 @@ func colorVariableReplace(content string) string {
447447
},
448448
}
449449

450-
return applyPatches(content, patches)
450+
return applyPatches(content, colorPatches)
451451
}
452452

453453
func colorVariableReplaceForJS(content string) string {
454-
patches := []Patch{
454+
colorVariablePatches := []Patch{
455455
{
456456
Name: "CSS (JS): --spice-button",
457457
Regex: `"#1db954"`,
@@ -482,7 +482,7 @@ func colorVariableReplaceForJS(content string) string {
482482
},
483483
}
484484

485-
return applyPatches(content, patches)
485+
return applyPatches(content, colorVariablePatches)
486486
}
487487

488488
func disableSentry(input string) string {
@@ -497,7 +497,7 @@ func disableSentry(input string) string {
497497
}
498498

499499
func disableLogging(input string) string {
500-
patches := []Patch{
500+
loggingPatches := []Patch{
501501
{
502502
Name: "Remove sp://logging/v3/*",
503503
Regex: `sp://logging/v3/\w+`,
@@ -702,11 +702,11 @@ func disableLogging(input string) string {
702702
},
703703
},
704704
}
705-
return applyPatches(input, patches)
705+
return applyPatches(input, loggingPatches)
706706
}
707707

708708
func removeRTL(input string) string {
709-
patches := []Patch{
709+
rtlPatches := []Patch{
710710
{
711711
Name: "Remove }[dir=ltr]",
712712
Regex: `}\[dir=ltr\]\s?`,
@@ -793,10 +793,10 @@ func removeRTL(input string) string {
793793
},
794794
}
795795

796-
return applyPatches(input, patches)
796+
return applyPatches(input, rtlPatches)
797797
}
798798

799-
func exposeAPIs_main(input string, report patchReporter) string {
799+
func exposeAPIs_main(input string, report logPatch) string {
800800
inputContextMenu := utils.FindFirstMatch(input, `.*value:"contextmenu"`)
801801
if len(inputContextMenu) > 0 {
802802
croppedInput := inputContextMenu[0]
@@ -823,7 +823,7 @@ func exposeAPIs_main(input string, report patchReporter) string {
823823
})
824824
}
825825

826-
patches := []Patch{
826+
xpuiPatches := []Patch{
827827
{
828828
Name: "showNotification patch",
829829
Regex: `(?:\w+ |,)([\w$]+)=(\([\w$]+=[\w$]+\.dispatch)`,
@@ -881,28 +881,28 @@ func exposeAPIs_main(input string, report patchReporter) string {
881881
},
882882
},
883883
{
884-
Name: "GraphQL definitions <=1.2.30",
884+
Name: "GraphQL definitions (<=1.2.30)",
885885
Regex: `((?:\w+ ?)?[\w$]+=)(\{kind:"Document",definitions:\[\{(?:\w+:[\w"]+,)+name:\{(?:\w+:[\w"]+,?)+value:("\w+"))`,
886886
Replacement: func(submatches ...string) string {
887887
return fmt.Sprintf("%sSpicetify.GraphQL.Definitions[%s]=%s", submatches[1], submatches[3], submatches[2])
888888
},
889889
},
890890
{
891-
Name: "GraphQL definitons >=1.2.31",
891+
Name: "GraphQL definitons (>=1.2.31)",
892892
Regex: `(=new [\w_\$][\w_\$\d]*\.[\w_\$][\w_\$\d]*\("(\w+)","(query|mutation)","[\w\d]{64}",null\))`,
893893
Replacement: func(submatches ...string) string {
894894
return fmt.Sprintf(`=Spicetify.GraphQL.Definitions["%s"]%s`, submatches[2], submatches[1])
895895
},
896896
},
897897
{
898-
Name: "Spotify Custom Snackbar Interfaces <=1.2.37",
898+
Name: "Spotify Custom Snackbar Interfaces (<=1.2.37)",
899899
Regex: `\b\w\s*\(\)\s*[^;,]*enqueueCustomSnackbar:\s*(\w)\s*[^;]*;`,
900900
Replacement: func(submatches ...string) string {
901901
return fmt.Sprintf("%sSpicetify.Snackbar.enqueueCustomSnackbar=%s;", submatches[0], submatches[1])
902902
},
903903
},
904904
{
905-
Name: "Spotify Custom Snackbar Interfaces >=1.2.38",
905+
Name: "Spotify Custom Snackbar Interfaces (>=1.2.38)",
906906
Regex: `(=)[^=]*\(\)\.enqueueCustomSnackbar;`,
907907
Replacement: func(submatches ...string) string {
908908
return fmt.Sprintf("=Spicetify.Snackbar.enqueueCustomSnackbar%s;", submatches[0])
@@ -932,10 +932,10 @@ func exposeAPIs_main(input string, report patchReporter) string {
932932
},
933933
}
934934

935-
return applyPatches(input, patches, report)
935+
return applyPatches(input, xpuiPatches, report)
936936
}
937937

938-
func exposeAPIs_vendor(input string, report patchReporter) string {
938+
func exposeAPIs_vendor(input string, report logPatch) string {
939939
// URI
940940
utils.Replace(
941941
&input,
@@ -944,7 +944,7 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
944944
return fmt.Sprintf(`,(globalThis.Spicetify.URI=%s)%s`, submatches[1], submatches[0])
945945
})
946946

947-
patches := []Patch{
947+
vendorPatches := []Patch{
948948
{
949949
Name: "Spicetify.URI",
950950
Regex: `,(\w+)\.prototype\.toAppType`,
@@ -953,14 +953,14 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
953953
},
954954
},
955955
{
956-
Name: "Mapping styled-components classes",
956+
Name: "Map styled-components classes",
957957
Regex: `(\w+ [\w$_]+)=[\w$_]+\([\w$_]+>>>0\)`,
958958
Replacement: func(submatches ...string) string {
959959
return fmt.Sprintf("%s=Spicetify._getStyledClassName(arguments,this)", submatches[1])
960960
},
961961
},
962962
{
963-
Name: "Mapping Tippy.js",
963+
Name: "Tippy.js",
964964
Regex: `([\w\$_]+)\.setDefaultProps=`,
965965
Replacement: func(submatches ...string) string {
966966
return fmt.Sprintf("Spicetify.Tippy=%s;%s", submatches[1], submatches[0])
@@ -1007,7 +1007,7 @@ func exposeAPIs_vendor(input string, report patchReporter) string {
10071007
}
10081008
}
10091009

1010-
return applyPatches(input, patches, report)
1010+
return applyPatches(input, vendorPatches, report)
10111011
}
10121012

10131013
type githubRelease = utils.GithubRelease

0 commit comments

Comments
 (0)