* 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) <noreply@anthropic.com> --------- Co-authored-by: akashgagda <akashgagda@users.noreply.github.com> Co-authored-by: David Heinemeier Hansson <david@hey.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
20 lines
639 B
Bash
20 lines
639 B
Bash
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"
|