Skip to content

Commit

Permalink
fix: adapt regexes for 1.2.35 (#2958)
Browse files Browse the repository at this point in the history
Co-authored-by: surfbryce <80861823+surfbryce@users.noreply.github.com>
  • Loading branch information
rxri and surfbryce authored Apr 8, 2024
1 parent 6591a1a commit c77623b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
13 changes: 10 additions & 3 deletions jsHelper/spicetifyWrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,9 @@ window.Spicetify = {
"StoreProvider",
"PlatformProvider",
"Dropdown",
"MenuSubMenuItem"
"MenuSubMenuItem",
"Navigation",
"ScrollableContainer"
])
},
{
Expand Down Expand Up @@ -557,7 +559,12 @@ window.Spicetify = {
m => m.toString().includes("?highlight") && m.toString().includes("headerText") && m.toString().includes("imageContainer")
),
Hero: functionModules.find(m => m?.toString().includes('"herocard-click-handler"')),
CardImage: functionModules.find(m => m.toString().includes("isHero") && m.toString().includes("withWaves")),
CardImage: functionModules.find(
m =>
m.toString().includes("isHero") &&
(m.toString().includes("withWaves") || m.toString().includes("isCircular")) &&
m.toString().includes("imageWrapper")
),
...Object.fromEntries(cards)
},
Router: functionModules.find(m => m.toString().includes("navigationType") && m.toString().includes("static")),
Expand Down Expand Up @@ -1038,7 +1045,7 @@ Spicetify._getStyledClassName = (args, component) => {

Spicetify.getFontStyle = font => {
if (!font || !Spicetify._fontStyle) return;
let rawStyle = Spicetify._fontStyle({ variant: font })
let rawStyle = Spicetify._fontStyle({ variant: font, $variant: font })
.filter(style => typeof style === "string")
.join("");
// Clean up empty rulesets
Expand Down
2 changes: 1 addition & 1 deletion src/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ func getColorCSS(scheme map[string]string) string {
func insertCustomApp(jsPath string, flags Flag) {
utils.ModifyFile(jsPath, func(content string) string {
const REACT_REGEX = `([\w_\$][\w_\$\d]*(?:\(\))?)\.lazy\(\((?:\(\)=>|function\(\)\{return )(\w+)\.(\w+)\(\d+\)\.then\(\w+\.bind\(\w+,\d+\)\)\}?\)\)`
const REACT_ELEMENT_REGEX = `(\[\w_\$][\w_\$\d]*(?:\(\))?\.createElement|\([\w$\.,]+\))\(([\w\.]+),\{path:"\/collection"(?:,(element|children)?[:.\w,{}()/*"]+)?\}`
const REACT_ELEMENT_REGEX = `(\[\w_\$][\w_\$\d]*(?:\(\))?\.createElement|\([\w$\.,]+\))\(([\w\.]+),\{path:"\/collection"(?:,(element|children)?[:.\w,{}()$/*"]+)?\}`
reactSymbs := utils.FindSymbol(
"Custom app React symbols",
content,
Expand Down
2 changes: 1 addition & 1 deletion src/preprocess/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ func exposeAPIs_vendor(input string) string {

utils.ReplaceOnce(
&input,
`\(function\(\w+\)\{return \w+\.variant\?function\(\w+\)\{`,
`\(function\(\w+\)\{return \w+\.\$?variant\?function\(\w+\)\{`,
func(submatches ...string) string {
return fmt.Sprintf("Spicetify._fontStyle=%s", submatches[0])
})
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ func FindSymbol(debugInfo, content string, clues []string) []string {
}

if len(debugInfo) > 0 {
PrintError("cannot find symbol for " + debugInfo)
PrintError("Cannot find symbol for " + debugInfo)
}

return nil
Expand Down

0 comments on commit c77623b

Please sign in to comment.