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) <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>
This commit is contained in:
co-authored by
Claude Opus 5
akashgagda
David Heinemeier Hansson
parent
318bf2c43a
commit
81ecac4a60
@@ -11,10 +11,11 @@ add_whatsapp_slim_extension() {
|
|||||||
if grep -q "^--load-extension=" "$file"; then
|
if grep -q "^--load-extension=" "$file"; then
|
||||||
sed -i --follow-symlinks "s|^--load-extension=\(.*\)$|--load-extension=\1,$WHATSAPP_SLIM_EXT|" "$file"
|
sed -i --follow-symlinks "s|^--load-extension=\(.*\)$|--load-extension=\1,$WHATSAPP_SLIM_EXT|" "$file"
|
||||||
else
|
else
|
||||||
|
[[ -n $(tail -c1 "$file") ]] && echo >>"$file"
|
||||||
echo "--load-extension=$WHATSAPP_SLIM_EXT" >>"$file"
|
echo "--load-extension=$WHATSAPP_SLIM_EXT" >>"$file"
|
||||||
fi
|
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"
|
add_whatsapp_slim_extension "$HOME/.config/$conf-flags.conf"
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -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"
|
||||||
Reference in New Issue
Block a user