diff --git a/src/apply/apply.go b/src/apply/apply.go index 05b895c0c2..70ff468e0e 100644 --- a/src/apply/apply.go +++ b/src/apply/apply.go @@ -208,7 +208,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+(?:\(\))?)\.lazy\(\((?:\(\)=>|function\(\)\{return )(\w+)\.(\w+)\(\d+\)\.then\(\w+\.bind\(\w+,\d+\)\)\}?\)\)` - const REACT_ELEMENT_REGEX = `(\w+(?:\(\))?\.createElement|\([\w$\.,]+\))\(([\w\.]+),\{path:"\/collection"(?:,[:.\w,{}()/*"]+)?\}` + const REACT_ELEMENT_REGEX = `(\w+(?:\(\))?\.createElement|\([\w$\.,]+\))\(([\w\.]+),\{path:"\/collection"(?:,(element|children)?[:.\w,{}()/*"]+)?\}` reactSymbs := utils.FindSymbol( "Custom app React symbols", content, @@ -231,6 +231,14 @@ func insertCustomApp(jsPath string, flags Flag) { cssEnableMap := "" appNameArray := "" + // Spotify's new route system + wildcard := "" + if eleSymbs[2] == "" { + eleSymbs[2] = "children" + } else if eleSymbs[2] == "element" { + wildcard = "*" + } + for index, app := range flags.CustomApp { appName := `spicetify-routes-` + app appMap += fmt.Sprintf(`"%s":"%s",`, appName, appName) @@ -242,8 +250,8 @@ func insertCustomApp(jsPath string, flags Flag) { appName, reactSymbs[1], reactSymbs[1], appName) appEleMap += fmt.Sprintf( - `%s(%s,{path:"/%s",pathV6:"/%s/*",children:%s(spicetifyApp%d,{})}),`, - eleSymbs[0], eleSymbs[1], app, app, eleSymbs[0], index) + `%s(%s,{path:"/%s/%s",pathV6:"/%s/*",%s:%s(spicetifyApp%d,{})}),`, + eleSymbs[0], eleSymbs[1], app, wildcard, app, eleSymbs[2], eleSymbs[0], index) cssEnableMap += fmt.Sprintf(`,"%s":1`, appName) }