From 81ecac4a604e0cceb6a1ecc4d6dc535cef8788a4 Mon Sep 17 00:00:00 2001 From: Akash <55386892+akashgagda@users.noreply.github.com> Date: Sat, 8 Aug 2026 13:56:58 +0530 Subject: [PATCH] Fix WhatsApp Slim migration targeting brave-origin-beta instead of brave-origin (#6482) * Fix WhatsApp Slim migration targeting brave-origin-beta instead of brave-origin * Add migration to append WhatsApp Slim to Brave Origin for existing installs * Don't corrupt flags files that lack a trailing newline Appending --load-extension= with echo assumed the file ended in a newline. A hand-edited flags file without one got the flag concatenated onto the previous line, losing both that flag and the extension. Co-Authored-By: Claude Opus 5 (1M context) --------- Co-authored-by: akashgagda Co-authored-by: David Heinemeier Hansson Co-authored-by: Claude Opus 5 (1M context) --- migrations/1785543725.sh | 3 ++- migrations/1785591762.sh | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 migrations/1785591762.sh diff --git a/migrations/1785543725.sh b/migrations/1785543725.sh index 71e1abea..cafd1f80 100644 --- a/migrations/1785543725.sh +++ b/migrations/1785543725.sh @@ -11,10 +11,11 @@ add_whatsapp_slim_extension() { if grep -q "^--load-extension=" "$file"; then sed -i --follow-symlinks "s|^--load-extension=\(.*\)$|--load-extension=\1,$WHATSAPP_SLIM_EXT|" "$file" else + [[ -n $(tail -c1 "$file") ]] && echo >>"$file" echo "--load-extension=$WHATSAPP_SLIM_EXT" >>"$file" fi } -for conf in chromium chrome google-chrome brave brave-beta brave-nightly brave-origin-beta microsoft-edge-stable; do +for conf in chromium chrome google-chrome brave brave-beta brave-nightly brave-origin microsoft-edge-stable; do add_whatsapp_slim_extension "$HOME/.config/$conf-flags.conf" done diff --git a/migrations/1785591762.sh b/migrations/1785591762.sh new file mode 100644 index 00000000..c589085a --- /dev/null +++ b/migrations/1785591762.sh @@ -0,0 +1,19 @@ +echo "Add WhatsApp Slim extension to Brave Origin flags for existing installs" + +WHATSAPP_SLIM_EXT="$OMARCHY_PATH/default/chromium/extensions/whatsapp-slim" + +add_whatsapp_slim_extension() { + local file=$1 + + [[ -f $file ]] || return 0 + grep -q "extensions/whatsapp-slim" "$file" && return 0 + + if grep -q "^--load-extension=" "$file"; then + sed -i --follow-symlinks "s|^--load-extension=\(.*\)$|--load-extension=\1,$WHATSAPP_SLIM_EXT|" "$file" + else + [[ -n $(tail -c1 "$file") ]] && echo >>"$file" + echo "--load-extension=$WHATSAPP_SLIM_EXT" >>"$file" + fi +} + +add_whatsapp_slim_extension "$HOME/.config/brave-origin-flags.conf"