Skip to content

Commit

Permalink
fix(navlinks): add support for 1.2.46's global navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri committed Sep 8, 2024
1 parent d1fc089 commit 4e947ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/apply/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,11 +332,16 @@ func insertNavLink(str string, appNameArray string) string {
1)
}

// Global Navbar
// Global Navbar <= 1.2.45
utils.ReplaceOnce(&str, `(,[a-zA-Z_\$][\w\$]*===(?:[a-zA-Z_\$][\w\$]*\.){2}HOME_NEXT_TO_NAVIGATION&&.+?)\]`, func(submatches ...string) string {
return fmt.Sprintf("%s,Spicetify._renderNavLinks([%s], true)]", submatches[1], appNameArray)
})

// Global Navbar >= 1.2.46
utils.ReplaceOnce(&str, `("global-nav-bar".*?)(\(0,\s*[a-zA-Z_\$][\w\$]*\.jsx\))(\(\s*\w+,\s*\{\s*className:\w*\s*\}\s*\))\s*\}\),\s*(\(0,)`, func(submatches ...string) string {
return fmt.Sprintf("%s[%s%s,Spicetify._renderNavLinks([%s], true)].flat()}),%s", submatches[1], submatches[2], submatches[3], appNameArray, submatches[4])
})

return str
}

Expand Down Expand Up @@ -409,7 +414,6 @@ func insertExpFeatures(jsPath string, flags Flag) {
&content,
`(([\w$.]+\.fromJSON)\(\w+\)+;)(return ?[\w{}().,]+[\w$]+\.Provider,)(\{value:\{localConfiguration)`,
func(submatches ...string) string {
fmt.Println(submatches)
return fmt.Sprintf("%sSpicetify.createInternalMap=%s;%sSpicetify.RemoteConfigResolver=%s", submatches[1], submatches[2], submatches[3], submatches[4])
})
return content
Expand Down

0 comments on commit 4e947ad

Please sign in to comment.