dotfiles/.local/bin/firefox

39 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
sites=(
'https://discord.com'
'https://gmoker.com'
'https://login.microsoftonline.com'
'https://maby.dev'
'https://web.whatsapp.com'
)
function update() {
local start='^/\*---- USER PREFERENCES ----\*/$'
local end='^/\*---- END USER PREFERENCES ----\*/$'
local af userpref
af="$(curl -L 'https://github.com/arkenfox/user.js/raw/refs/heads/master/user.js')"
while read -r p; do
userpref="$(sed -n "\@$start@,\@$end@p" "$ff/$p/user.js")"
printf '%s\n\n%s\n' "$af" "$userpref" > "$ff/$p/user.js"
done < <(awk -F= '/^Path=/{print $2}' "$ff/profiles.ini")
}
ff="$HOME/.var/app/org.mozilla.firefox/.mozilla/firefox"
if [ "$1" == update ]; then
update
exit
fi
profile="$ff/$(sed -n '/^\[Install/,/^Default=/s/.*=//p' "$ff/profiles.ini")"
if ! fuser -s "$profile"; then
for i in "${!sites[@]}"; do
sq+="INSERT INTO moz_perms VALUES($i,'${sites[$i]}','cookie',1,0,0,0);"
done
sqlite3 "$profile/permissions.sqlite" <<< "DELETE FROM moz_perms; $sq"
sqlite3 "$profile/places.sqlite" <<< "DELETE FROM moz_bookmarks;"
fi
org.mozilla.firefox "$@"