From 4e947adbfb2b4a54ab342cb091ca6b5a2942d240 Mon Sep 17 00:00:00 2001 From: ririxi Date: Mon, 9 Sep 2024 00:54:42 +0200 Subject: [PATCH] fix(navlinks): add support for `1.2.46`'s global navbar --- src/apply/apply.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/apply/apply.go b/src/apply/apply.go index be346eb5c0..6341a9fc49 100644 --- a/src/apply/apply.go +++ b/src/apply/apply.go @@ -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 } @@ -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