@@ -26,23 +26,35 @@ type Flag struct {
26
26
27
27
// AdditionalOptions .
28
28
func AdditionalOptions (appsFolderPath string , flags Flag ) {
29
- filesToModified := map [string ]func (path string , flags Flag ){
30
- filepath .Join (appsFolderPath , "xpui" , "index.html" ): htmlMod ,
31
- filepath .Join (appsFolderPath , "xpui" , "xpui.js" ): insertCustomApp ,
32
- filepath .Join (appsFolderPath , "xpui" , "xpui.js" ): insertExpFeatures ,
33
- filepath .Join (appsFolderPath , "xpui" , "xpui.js" ): insertSidebarConfig ,
34
- filepath .Join (appsFolderPath , "xpui" , "xpui.js" ): insertHomeConfig ,
35
- filepath .Join (appsFolderPath , "xpui" , "vendor~xpui.js" ): insertExpFeatures ,
36
- filepath .Join (appsFolderPath , "xpui" , "home-v2.js" ): insertHomeConfig ,
37
- filepath .Join (appsFolderPath , "xpui" , "xpui-desktop-modals.js" ): insertVersionInfo ,
29
+ filesToModified := map [string ][]func (path string , flags Flag ){
30
+ filepath .Join (appsFolderPath , "xpui" , "index.html" ): {
31
+ htmlMod ,
32
+ },
33
+ filepath .Join (appsFolderPath , "xpui" , "xpui.js" ): {
34
+ insertCustomApp ,
35
+ insertExpFeatures ,
36
+ insertSidebarConfig ,
37
+ insertHomeConfig ,
38
+ },
39
+ filepath .Join (appsFolderPath , "xpui" , "vendor~xpui.js" ): {
40
+ insertExpFeatures ,
41
+ },
42
+ filepath .Join (appsFolderPath , "xpui" , "home-v2.js" ): {
43
+ insertHomeConfig ,
44
+ },
45
+ filepath .Join (appsFolderPath , "xpui" , "xpui-desktop-modals.js" ): {
46
+ insertVersionInfo ,
47
+ },
38
48
}
39
49
40
- for file , call := range filesToModified {
50
+ for file , calls := range filesToModified {
41
51
if _ , err := os .Stat (file ); os .IsNotExist (err ) {
42
52
continue
43
53
}
44
54
45
- call (file , flags )
55
+ for _ , call := range calls {
56
+ call (file , flags )
57
+ }
46
58
}
47
59
48
60
if flags .SidebarConfig {
@@ -397,6 +409,7 @@ func insertExpFeatures(jsPath string, flags Flag) {
397
409
& content ,
398
410
`(([\w$.]+\.fromJSON)\(\w+\)+;)(return ?[\w{}().,]+[\w$]+\.Provider,)(\{value:\{localConfiguration)` ,
399
411
func (submatches ... string ) string {
412
+ fmt .Println (submatches )
400
413
return fmt .Sprintf ("%sSpicetify.createInternalMap=%s;%sSpicetify.RemoteConfigResolver=%s" , submatches [1 ], submatches [2 ], submatches [3 ], submatches [4 ])
401
414
})
402
415
return content
0 commit comments