Merge branch 'master' into gwarser-patch-1

This commit is contained in:
Thorin-Oakenpants 2021-03-10 00:14:42 +00:00 committed by GitHub
commit 0096219dee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 35 deletions

View file

@ -1,7 +1,7 @@
/*** /***
This will reset the preferences that have been removed completely from the arkenfox user.js. This will reset the preferences that have been removed completely from the arkenfox user.js.
Last updated: 27-Feb-2021 Last updated: 04-Mar-2021
For instructions see: For instructions see:
https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts] https://github.com/arkenfox/user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
@ -9,7 +9,7 @@
(function() { (function() {
let ops = [ let ops = [
/* removed in arkenfox user.js v52-57 */ /* removed in arkenfox user.js */
/* 52-alpha */ /* 52-alpha */
'browser.search.reset.enabled', 'browser.search.reset.enabled',
'browser.search.reset.whitelist', 'browser.search.reset.whitelist',
@ -26,7 +26,6 @@
'extensions.pocket.api', // covered by extensions.pocket.enabled 'extensions.pocket.api', // covered by extensions.pocket.enabled
'extensions.pocket.oAuthConsumerKey', // ditto 'extensions.pocket.oAuthConsumerKey', // ditto
'extensions.pocket.site', // ditto 'extensions.pocket.site', // ditto
/* 56-alpha: none */
/* 57-alpha */ /* 57-alpha */
'geo.wifi.xhr.timeout', // covered by geo.enabled 'geo.wifi.xhr.timeout', // covered by geo.enabled
'browser.search.geoip.timeout', // ditto 'browser.search.geoip.timeout', // ditto

View file

@ -2,7 +2,7 @@
## arkenfox user.js updater for macOS and Linux ## arkenfox user.js updater for macOS and Linux
## version: 2.9 ## version: 3.0
## Author: Pat Johnson (@overdodactyl) ## Author: Pat Johnson (@overdodactyl)
## Additional contributors: @earthlng, @ema-pe, @claustromaniac ## Additional contributors: @earthlng, @ema-pe, @claustromaniac
@ -103,7 +103,6 @@ Optional Arguments:
# File Handling # # File Handling #
######################### #########################
# Download files
download_file () { # expects URL as argument ($1) download_file () { # expects URL as argument ($1)
declare -r tf=$(mktemp) declare -r tf=$(mktemp)
@ -122,36 +121,33 @@ open_file () { # expects one argument: file_path
readIniFile () { # expects one argument: absolute path of profiles.ini readIniFile () { # expects one argument: absolute path of profiles.ini
declare -r inifile="$1" declare -r inifile="$1"
declare -r tfile=$(mktemp)
if [ $(grep '^\[Profile' "$inifile" | wc -l) == "1" ]; then ### only 1 profile found # tempIni will contain: [ProfileX], Name=, IsRelative= and Path= (and Default= if present) of the only (if) or the selected (else) profile
grep '^\[Profile' -A 4 "$inifile" | grep -v '^\[Profile' > $tfile if [ $(grep -c '^\[Profile' "${inifile}") -eq "1" ]; then ### only 1 profile found
tempIni="$(grep '^\[Profile' -A 4 "${inifile}")"
else else
grep -E -v '^\[General\]|^StartWithLastProfile=|^IsRelative=' "$inifile" echo -e "Profiles found:\n"
echo '' ## cmd-substitution to strip trailing newlines and in quotes to keep internal ones:
echo "$(grep --color=never -E 'Default=[^1]|\[Profile[0-9]*\]|Name=|Path=|^$' "${inifile}")"
echo ''
read -p 'Select the profile number ( 0 for Profile0, 1 for Profile1, etc ) : ' -r read -p 'Select the profile number ( 0 for Profile0, 1 for Profile1, etc ) : ' -r
echo -e "\n" echo -e "\n"
if [[ $REPLY =~ ^(0|[1-9][0-9]*)$ ]]; then if [[ $REPLY =~ ^(0|[1-9][0-9]*)$ ]]; then
grep '^\[Profile'${REPLY} -A 4 "$inifile" | grep -v '^\[Profile'${REPLY} > $tfile tempIni="$(grep "^\[Profile${REPLY}" -A 4 "${inifile}")" || {
if [[ "$?" != "0" ]]; then echo -e "${RED}Profile${REPLY} does not exist!${NC}" && exit 1
echo "Profile${REPLY} does not exist!" && exit 1 }
fi
else else
echo "Invalid selection!" && exit 1 echo -e "${RED}Invalid selection!${NC}" && exit 1
fi fi
fi fi
declare -r profpath=$(grep '^Path=' $tfile) # extracting 0 or 1 from the "IsRelative=" line
declare -r pathisrel=$(grep '^IsRelative=' $tfile) declare -r pathisrel=$(sed -n 's/^IsRelative=\([01]\)$/\1/p' <<< "${tempIni}")
rm "$tfile" # extracting only the path itself, excluding "Path="
PROFILE_PATH=$(sed -n 's/^Path=\(.*\)$/\1/p' <<< "${tempIni}")
# update global variable # update global variable if path is relative
if [[ ${pathisrel#*=} == "1" ]]; then [[ ${pathisrel} == "1" ]] && PROFILE_PATH="$(dirname "${inifile}")/${PROFILE_PATH}"
PROFILE_PATH="$(dirname "$inifile")/${profpath#*=}"
else
PROFILE_PATH="${profpath#*=}"
fi
} }
getProfilePath () { getProfilePath () {
@ -161,16 +157,14 @@ getProfilePath () {
if [ "$PROFILE_PATH" = false ]; then if [ "$PROFILE_PATH" = false ]; then
PROFILE_PATH="$SCRIPT_DIR" PROFILE_PATH="$SCRIPT_DIR"
elif [ "$PROFILE_PATH" = 'list' ]; then elif [ "$PROFILE_PATH" = 'list' ]; then
local ini=''
if [[ -f "$f1" ]]; then if [[ -f "$f1" ]]; then
ini="$f1" readIniFile "$f1" # updates PROFILE_PATH or exits on error
elif [[ -f "$f2" ]]; then elif [[ -f "$f2" ]]; then
ini="$f2" readIniFile "$f2"
else else
echo -e "${RED}Error: Sorry, -l is not supported for your OS${NC}" echo -e "${RED}Error: Sorry, -l is not supported for your OS${NC}"
exit 1 exit 1
fi fi
readIniFile "$ini" # updates PROFILE_PATH or exits on error
#else #else
# PROFILE_PATH already set by user with -p # PROFILE_PATH already set by user with -p
fi fi
@ -191,9 +185,7 @@ get_updater_version () {
# -d: New version will not be looked for and update will not occur # -d: New version will not be looked for and update will not occur
# -u: Check for update, if available, execute without asking # -u: Check for update, if available, execute without asking
update_updater () { update_updater () {
if [ $UPDATE = 'no' ]; then [ $UPDATE = 'no' ] && return 0 # User signified not to check for updates
return 0 # User signified not to check for updates
fi
declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/updater.sh')" declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/updater.sh')"
[ -z "${tmpfile}" ] && echo -e "${RED}Error! Could not download updater.sh${NC}" && return 1 # check if download failed [ -z "${tmpfile}" ] && echo -e "${RED}Error! Could not download updater.sh${NC}" && return 1 # check if download failed
@ -214,7 +206,6 @@ update_updater () {
exit 0 exit 0
} }
######################### #########################
# Update user.js # # Update user.js #
######################### #########################

View file

@ -1025,8 +1025,8 @@ user_pref("_user.js.parrot", "2400 syntax error: the parrot's kicked the bucket!
/* 2402: disable website access to clipboard events/content [SETUP-HARDEN] /* 2402: disable website access to clipboard events/content [SETUP-HARDEN]
* [NOTE] This will break some sites' functionality e.g. Outlook, Twitter, Facebook, Wordpress * [NOTE] This will break some sites' functionality e.g. Outlook, Twitter, Facebook, Wordpress
* This applies to onCut/onCopy/onPaste events - i.e. it requires interaction with the website * This applies to onCut/onCopy/onPaste events - i.e. it requires interaction with the website
* [WARNING] In FF87 or lower, if both 'middlemouse.paste' and 'general.autoScroll' * [WARNING] If both 'middlemouse.paste' and 'general.autoScroll' are true (at least one
* are true (at least one is default false) then clipboard events can leak [1] * is default false) then enabling this pref can leak clipboard content [1]
* [1] https://bugzilla.mozilla.org/1528289 ***/ * [1] https://bugzilla.mozilla.org/1528289 ***/
// user_pref("dom.event.clipboardevents.enabled", false); // user_pref("dom.event.clipboardevents.enabled", false);
/* 2404: disable clipboard commands (cut/copy) from "non-privileged" content [FF41+] /* 2404: disable clipboard commands (cut/copy) from "non-privileged" content [FF41+]