Skip to content

Commit 4e947ad

Browse files
committed
fix(navlinks): add support for 1.2.46's global navbar
1 parent d1fc089 commit 4e947ad

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/apply/apply.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,16 @@ func insertNavLink(str string, appNameArray string) string {
332332
1)
333333
}
334334

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

340+
// Global Navbar >= 1.2.46
341+
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 {
342+
return fmt.Sprintf("%s[%s%s,Spicetify._renderNavLinks([%s], true)].flat()}),%s", submatches[1], submatches[2], submatches[3], appNameArray, submatches[4])
343+
})
344+
340345
return str
341346
}
342347

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

0 commit comments

Comments
 (0)