@@ -215,7 +215,7 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
215
215
content = exposeAPIs_vendor (content , printPatch )
216
216
}
217
217
218
- content = exposeGraphQL (content , printPatch )
218
+ content = additionalPatches (content , printPatch )
219
219
}
220
220
printPatch ("CSS (JS): Patching our mappings into file" )
221
221
for k , v := range cssTranslationMap {
@@ -239,7 +239,7 @@ func Start(version string, spotifyBasePath string, extractedAppsPath string, fla
239
239
printPatch ("Remove RTL" )
240
240
content = removeRTL (content )
241
241
}
242
- if fileName == "xpui.css" {
242
+ if fileName == "xpui.css" || fileName == "xpui-snapshot.css" {
243
243
printPatch ("Extra CSS Patch" )
244
244
content = content + `
245
245
.main-gridContainer-fixedWidth{grid-template-columns: repeat(auto-fill, var(--column-width));width: calc((var(--column-count) - 1) * var(--grid-gap)) + var(--column-count) * var(--column-width));}.main-cardImage-imageWrapper{background-color: var(--card-color, #333);border-radius: 6px;-webkit-box-shadow: 0 8px 24px rgba(0, 0, 0, .5);box-shadow: 0 8px 24px rgba(0, 0, 0, .5);padding-bottom: 100%;position: relative;width:100%;}.main-cardImage-image,.main-card-imagePlaceholder{height: 100%;left: 0;position: absolute;top: 0;width: 100%};.main-content-view{height:100%;}
@@ -798,7 +798,7 @@ func removeRTL(input string) string {
798
798
return applyPatches (input , rtlPatches )
799
799
}
800
800
801
- func exposeGraphQL (input string , report logPatch ) string {
801
+ func additionalPatches (input string , report logPatch ) string {
802
802
graphQLPatches := []Patch {
803
803
{
804
804
Name : "GraphQL definitions (<=1.2.30)" ,
@@ -814,13 +814,20 @@ func exposeGraphQL(input string, report logPatch) string {
814
814
return fmt .Sprintf (`=Spicetify.GraphQL.Definitions["%s"]%s` , submatches [2 ], submatches [1 ])
815
815
},
816
816
},
817
+ {
818
+ Name : "Search bug fix (1.2.57<= and >=1.2.28)" ,
819
+ Regex : `(typeName\\])` ,
820
+ Replacement : func (submatches ... string ) string {
821
+ return fmt .Sprintf (`%s || []` , submatches [1 ])
822
+ },
823
+ },
817
824
}
818
825
819
826
return applyPatches (input , graphQLPatches , report )
820
827
}
821
828
822
829
func exposeAPIs_main (input string , report logPatch ) string {
823
- inputContextMenu := utils .FindFirstMatch (input , `.*value:"contextmenu"` )
830
+ inputContextMenu := utils .FindFirstMatch (input , `.*(?: value:"contextmenu"|"[^"]*":"context-menu") ` )
824
831
if len (inputContextMenu ) > 0 {
825
832
croppedInput := inputContextMenu [0 ]
826
833
react := utils .FindLastMatch (croppedInput , `([a-zA-Z_\$][\w\$]*)\.useRef` )[1 ]
@@ -841,7 +848,7 @@ func exposeAPIs_main(input string, report logPatch) string {
841
848
target = "e.triggerRef"
842
849
}
843
850
844
- utils .Replace (& input , `\(0,([\w_$]+)\.jsx\)\([\w_$]+\.[\w_$]+,\{value:"contextmenu"[^\ }]+\}\)\}\)` , func (submatches ... string ) string {
851
+ utils .Replace (& input , `\(0,([\w_$]+)\.jsx\)\((?: [\w_$]+\.[\w_$]+,\{value:"contextmenu"[^}]+\}\)\}\)|"[\w-]+",\{[^}]+:"context-menu"[^}]+\}\) )` , func (submatches ... string ) string {
845
852
return fmt .Sprintf ("(0,%s.jsx)((Spicetify.ContextMenuV2._context||(Spicetify.ContextMenuV2._context=%s.createContext(null))).Provider,{value:{props:%s?.props,trigger:%s,target:%s},children:%s})" , submatches [1 ], react , menu , trigger , target , submatches [0 ])
846
853
})
847
854
}
0 commit comments