Compare commits

..

No commits in common. "master" and "v59.0-alpha" have entirely different histories.

44 changed files with 3146 additions and 2240 deletions

18
.gitattributes vendored
View File

@ -1,16 +1,14 @@
* text=auto ## * text=auto
*.js text *.js text=auto
*.md text *.md text=auto
*.yml text *.yml text=auto
*.txt text *.txt text=auto
*.sh text *.sh text=auto
## *.bat text eol=crlf *.bat eol=crlf
*.bat -text
*.png binary *.png binary
.gitattributes export-ignore .gitattributes export-ignore
*.yml export-ignore *.yml export-ignore
/wikipiki export-ignore wikipiki export-ignore
/.github export-ignore

View File

@ -1,18 +0,0 @@
---
name: Tools
about: Report issues with the updaters, the troubleshooter, or any other tools.
title: ''
labels: ''
assignees: ''
---
<!--
Please specify:
- the name of the file (i.e. updater.bat, updater.sh)
- steps to reproduce the issue
- actual result
- expected result
Blank out this field before typing, or start typing after the next line.
-->

View File

@ -1,31 +0,0 @@
---
name: Troubleshooting help
about: Ask for help to solve problems with user.js
title: 'follow instructions or this will be closed as invalid'
labels: ''
assignees: ''
---
<!--
Issues will be closed as invalid if you do not troubleshoot first, or if you ignore the required info in the template.
We do not support forks or no-longer supported releases.
-->
🟥 https://github.com/arkenfox/user.js/wiki/5.2-Troubleshooting
- [ ] I have read the troubleshooting guide, done the checks and confirmed this is caused by arkenfox
- _unchecked issues ~~may~~ will be closed as invalid_
🟪 REQUIRED INFO
- Browser version & OS:
- Steps to Reproduce (STR):
- Expected result:
- Actual result:
- Console errors and warnings:
- Anything else you deem worth mentioning:
---

View File

@ -1,15 +0,0 @@
---
name: user.js
about: Suggest changes to user.js
title: ''
labels: ''
assignees: ''
---
We value feedback in general, but we value feedback from informed users more. There is no need for you to be an expert to participate (most of us aren't), but we hope that you at least understand our decisions before questioning them. We discuss all changes openly, and we do not make changes lightly. So, if you don't understand why we decided to add/remove/change a certain pref, search the repo. The answer is most certainly here.
If some change we made took you by surprise (in the wrong way), remember that keeping track of changes is your responsibility. Watch the repo, read the [changelogs](https://github.com/arkenfox/user.js/issues?utf8=✓&q=is%3Aissue+label%3Achangelog), compare [releases](https://github.com/arkenfox/user.js/releases) as you update your copy of user.js, or use any other method you prefer.
Clear all of this when you're ready to type.

View File

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2020 arkenfox Copyright (c) 2017 ghacksuserjs
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,26 +1,21 @@
### 🟪 user.js ### ![](https://github.com/ghacksuserjs/ghacks-user.js/blob/master/wikipiki/bullet01.png) user.js
A `user.js` is a configuration file that can control Firefox settings - for a more technical breakdown and explanation, you can read more in the [wiki](https://github.com/arkenfox/user.js/wiki/2.1-User.js) A `user.js` is a configuration file that can control hundreds of Firefox settings. For a more technical breakdown and explanation, you can read more on the [overview](https://github.com/ghacksuserjs/ghacks-user.js/wiki/1.1-Overview) wiki page.
### 🟩 the arkenfox user.js ### ![](https://github.com/ghacksuserjs/ghacks-user.js/blob/master/wikipiki/bullet01.png) ghacks user.js
The `ghacks user.js` is a **template**, which, as provided, aims to provide as much privacy and enhanced security as possible, and to reduce tracking and fingerprinting as much as possible - while minimizing any loss of functionality and breakage (but it will happen).
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) Everyone, experts included, should at least read the [implementation](https://github.com/ghacksuserjs/ghacks-user.js/wiki/1.3-Implementation) wiki page, as it contains important information regarding a few `ghacks user.js` settings.
The `arkenfox user.js` is a **template** which aims to provide as much privacy and enhanced security as possible, and to reduce tracking and fingerprinting as much as possible - while minimizing any loss of functionality and breakage (but it will happen). Sitemap: [Releases](https://github.com/ghacksuserjs/ghacks-user.js/releases), [changelogs](https://github.com/ghacksuserjs/ghacks-user.js/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Achangelog), [Wiki](https://github.com/ghacksuserjs/ghacks-user.js/wiki), [stickies](https://github.com/ghacksuserjs/ghacks-user.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22sticky+topic%22). [diffs](https://github.com/ghacksuserjs/ghacks-user.js/issues?q=is%3Aissue+label%3Adiffs)
Everyone, experts included, should at least read the [wiki](https://github.com/arkenfox/user.js/wiki), as it contains important information regarding a few `user.js` settings. There is also an [interactive current release](https://arkenfox.github.io/gui/), thanks to [icpantsparti2](https://github.com/icpantsparti2). ### ![](https://github.com/ghacksuserjs/ghacks-user.js/blob/master/wikipiki/bullet01.png) acknowledgments
Literally thousands of sources, references and suggestions. That said...
Note that we do *not* recommend connecting over Tor on Firefox. Use the [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en) if your [threat model](https://2019.www.torproject.org/about/torusers.html) calls for it, or for accessing hidden services. * Martin Brinkmann at [ghacks](https://www.ghacks.net/) <sup>1</sup>
* The ghacks community and commentators
* [12bytes](http://12bytes.org/tech/firefox/firefoxgecko-configuration-guide-for-privacy-and-performance-buffs)
* The 12bytes article now uses this user.js and supplements it with an additonal JS hosted right [here](https://github.com/atomGit/Firefox-user.js) at github
Also be aware that the `arkenfox user.js` is made specifically for desktop Firefox. Using it as-is in other Gecko-based browsers can be counterproductive, especially in the Tor Browser. <sup>1</sup> The ghacks user.js was an independent project by [Thorin-Oakenpants](https://github.com/Thorin-Oakenpants) started in early 2015 and was [first published](https://www.ghacks.net/2015/08/18/a-comprehensive-list-of-firefox-privacy-and-security-settings/) at ghacks in August 2015. With Martin Brinkmann's blessing, it will keep the ghacks name.
### 🟧 sitemap ### ![](https://github.com/ghacksuserjs/ghacks-user.js/blob/master/wikipiki/bullet01.png) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
- [releases](https://github.com/arkenfox/user.js/releases)
- [changelogs](https://github.com/arkenfox/user.js/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Achangelog)
- [wiki](https://github.com/arkenfox/user.js/wiki)
- [stickies](https://github.com/arkenfox/user.js/issues?q=is%3Aissue+is%3Aopen+label%3A%22sticky+topic%22)
- [diffs](https://github.com/arkenfox/user.js/issues?q=is%3Aissue+label%3Adiffs)
- [common questions and answers](https://github.com/arkenfox/user.js/issues?q=is%3Aissue+label%3Aanswered)
### 🟥 acknowledgments
Literally thousands of sources, references and suggestions. Many thanks, and much appreciated.

View File

@ -1,3 +1 @@
theme: jekyll-theme-midnight theme: jekyll-theme-midnight
title: user.js
description: An ongoing comprehensive user.js template for configuring and hardening Firefox privacy, security and anti-fingerprinting

View File

@ -1,21 +1,18 @@
@ECHO OFF & SETLOCAL DisableDelayedExpansion @ECHO OFF
TITLE prefs.js cleaner TITLE prefs.js cleaner
REM ### prefs.js cleaner for Windows REM ### prefs.js cleaner for Windows
REM ## author: @claustromaniac REM ## author: @claustromaniac
REM ## version: 2.8 REM ## version: 1.2
CD /D "%~dp0"
IF /I "%~1"=="-unattended" (SET _ua=1)
SETLOCAL EnableDelayedExpansion
:begin :begin
ECHO: ECHO:
ECHO: ECHO:
ECHO ######################################## ECHO ########################################
ECHO #### prefs.js cleaner for Windows #### ECHO #### prefs.js cleaner for Windows ####
ECHO #### by claustromaniac #### ECHO #### by claustromaniac ####
ECHO #### v2.8 #### ECHO #### v1.2 ####
ECHO ######################################## ECHO ########################################
ECHO: ECHO:
CALL :message "This script should be run from your Firefox profile directory." CALL :message "This script should be run from your Firefox profile directory."
@ -24,27 +21,20 @@ CALL :message "This will allow inactive preferences to be reset to their default
ECHO This Firefox profile shouldn't be in use during the process. ECHO This Firefox profile shouldn't be in use during the process.
CALL :message "" CALL :message ""
TIMEOUT 1 /nobreak >nul TIMEOUT 1 /nobreak >nul
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
IF NOT DEFINED _ua ( CLS
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]" IF ERRORLEVEL 3 (EXIT /B)
CLS IF ERRORLEVEL 2 (GOTO :showhelp)
IF ERRORLEVEL 3 (EXIT /B)
IF ERRORLEVEL 2 (GOTO :showhelp)
)
IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30) IF NOT EXIST "user.js" (CALL :abort "user.js not found in the current directory." 30)
IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30) IF NOT EXIST "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
CALL :strlenCheck
CALL :FFcheck CALL :FFcheck
CALL :message "Backing up prefs.js..." CALL :message "Backing up prefs.js..."
FOR /F "delims=" %%# IN ('powershell -command get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%# COPY /B /V /Y prefs.js "prefs-backup-!date:/=-!_!time::=.!.js"
COPY /B /V /Y prefs.js "prefs-backup-%ldt%.js"
CALL :message "Cleaning prefs.js..." CALL :message "Cleaning prefs.js..."
CALL :cleanup CALL :cleanup
CALL :message "All done!" CLS
CALL :message "All done^!"
TIMEOUT 5 >nul TIMEOUT 5 >nul
ENDLOCAL
EXIT /B EXIT /B
REM ########## Abort Function ########### REM ########## Abort Function ###########
@ -54,24 +44,11 @@ TIMEOUT %~2 >nul
EXIT EXIT
REM ########## Message Function ######### REM ########## Message Function #########
:message :message
SETLOCAL DisableDelayedExpansion
ECHO: ECHO:
ECHO: %~1 ECHO: %~1
ECHO: ECHO:
GOTO :EOF ENDLOCAL
REM ### string length Check Function ####
:strlenCheck
SET /a cnt=0
setlocal ENABLEDELAYEDEXPANSION
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
ECHO:%%H >nul
SET /a cnt += 1
IF /I "%%G" NEQ "!cnt!" (
ECHO:
CALL :message "ERROR: line !cnt! in prefs.js is too long."
(CALL :abort "Aborting ..." 30)
)
)
endlocal
GOTO :EOF GOTO :EOF
REM ####### Firefox Check Function ###### REM ####### Firefox Check Function ######
:FFcheck :FFcheck
@ -80,7 +57,7 @@ IF NOT ERRORLEVEL 1 (
CLS CLS
CALL :message "Firefox is still running." CALL :message "Firefox is still running."
ECHO If you're not currently using this profile you can continue, otherwise ECHO If you're not currently using this profile you can continue, otherwise
CALL :message "close Firefox first!" CALL :message "close Firefox first^!"
ECHO: ECHO:
PAUSE PAUSE
CLS CLS
@ -90,20 +67,23 @@ IF NOT ERRORLEVEL 1 (
GOTO :EOF GOTO :EOF
REM ######### Cleanup Function ########## REM ######### Cleanup Function ##########
:cleanup :cleanup
FOR /F tokens^=2^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^[^\"']*user_pref[ ]*\([ ]*[\"'][^\"']*[\"'][ ]*," user.js') DO ( SETLOCAL DisableDelayedExpansion
IF NOT ""=="%%G" (SET "[%%G]=1")
)
( (
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO ( FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
IF ""=="%%H" ( SET "_line=%%H"
ECHO: SETLOCAL EnableDelayedExpansion
) ELSE ( IF /I "user_pref"=="!_line:~0,9!" (
FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO ( FOR /F tokens^=2^ delims^=^" %%I IN ("!_line:.=\.!") DO (
IF NOT DEFINED [%%J] (ECHO:%%H) FINDSTR /R /C:"user_pref[ ]*\([ ]*[\"']%%I[\"'][ ]*," user.js >nul
IF ERRORLEVEL 1 (ECHO:!_line!)
) )
) ELSE (
ECHO:!_line!
) )
ENDLOCAL
) )
)>tempcleanedprefs )>tempcleanedprefs
ENDLOCAL
MOVE /Y tempcleanedprefs prefs.js MOVE /Y tempcleanedprefs prefs.js
GOTO :EOF GOTO :EOF
REM ############### Help ################## REM ############### Help ##################
@ -124,7 +104,7 @@ ECHO add-ons disabled. Then, restart it again normally, and see if the
CALL :message " problems were solved." CALL :message " problems were solved."
ECHO: ECHO:
CALL :message "If you are able to identify the cause of your issues, please bring it up" CALL :message "If you are able to identify the cause of your issues, please bring it up"
ECHO on arkenfox user.js GitHub repository. ECHO on ghacks-user.js GitHub repository.
ECHO: ECHO:
ECHO: ECHO:
PAUSE PAUSE

View File

@ -1,185 +0,0 @@
#!/usr/bin/env bash
## prefs.js cleaner for Linux/Mac
## author: @claustromaniac
## version: 2.1
## special thanks to @overdodactyl and @earthlng for a few snippets that I stol..*cough* borrowed from the updater.sh
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_prefsCleaner() )
readonly CURRDIR=$(pwd)
## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
## fallback for Macs without coreutils
[ -z "$SCRIPT_FILE" ] && SCRIPT_FILE=${BASH_SOURCE[0]}
AUTOUPDATE=true
QUICKSTART=false
## download method priority: curl -> wget
DOWNLOAD_METHOD=''
if command -v curl >/dev/null; then
DOWNLOAD_METHOD='curl --max-redirs 3 -so'
elif command -v wget >/dev/null; then
DOWNLOAD_METHOD='wget --max-redirect 3 --quiet -O'
else
AUTOUPDATE=false
echo -e "No curl or wget detected.\nAutomatic self-update disabled!"
fi
fQuit() {
## change directory back to the original working directory
cd "${CURRDIR}"
[ "$1" -eq 0 ] && echo -e "\n$2" || echo -e "\n$2" >&2
exit $1
}
fUsage() {
echo -e "\nUsage: $0 [-ds]"
echo -e "
Optional Arguments:
-s Start immediately
-d Don't auto-update prefsCleaner.sh"
}
download_file() { # expects URL as argument ($1)
declare -r tf=$(mktemp)
$DOWNLOAD_METHOD "${tf}" "$1" &>/dev/null && echo "$tf" || echo '' # return the temp-filename or empty string on error
}
fFF_check() {
# there are many ways to see if firefox is running or not, some more reliable than others
# this isn't elegant and might not be future-proof but should at least be compatible with any environment
while [ -e lock ]; do
echo -e "\nThis Firefox profile seems to be in use. Close Firefox and try again.\n" >&2
read -r -p "Press any key to continue."
done
}
## returns the version number of a prefsCleaner.sh file
get_prefsCleaner_version() {
echo "$(sed -n '5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p' "$1")"
}
## updates the prefsCleaner.sh file based on the latest public version
update_prefsCleaner() {
declare -r tmpfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/prefsCleaner.sh')"
[ -z "$tmpfile" ] && echo -e "Error! Could not download prefsCleaner.sh" && return 1 # check if download failed
[[ $(get_prefsCleaner_version "$SCRIPT_FILE") == $(get_prefsCleaner_version "$tmpfile") ]] && return 0
mv "$tmpfile" "$SCRIPT_FILE"
chmod u+x "$SCRIPT_FILE"
"$SCRIPT_FILE" "$@" -d
exit 0
}
fClean() {
# the magic happens here
prefs="@@"
prefexp="user_pref[ ]*\([ ]*[\"']([^\"']+)[\"'][ ]*,"
while read -r line; do
if [[ "$line" =~ $prefexp && $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
prefs="${prefs}${BASH_REMATCH[1]}@@"
fi
done <<< "$(grep -E "$prefexp" user.js)"
while IFS='' read -r line || [[ -n "$line" ]]; do
if [[ "$line" =~ ^$prefexp ]]; then
if [[ $prefs != *"@@${BASH_REMATCH[1]}@@"* ]]; then
echo "$line"
fi
else
echo "$line"
fi
done < "$1" > prefs.js
}
fStart() {
if [ ! -e user.js ]; then
fQuit 1 "user.js not found in the current directory."
elif [ ! -e prefs.js ]; then
fQuit 1 "prefs.js not found in the current directory."
fi
fFF_check
mkdir -p prefsjs_backups
bakfile="prefsjs_backups/prefs.js.backup.$(date +"%Y-%m-%d_%H%M")"
mv prefs.js "${bakfile}" || fQuit 1 "Operation aborted.\nReason: Could not create backup file $bakfile"
echo -e "\nprefs.js backed up: $bakfile"
echo "Cleaning prefs.js..."
fClean "$bakfile"
fQuit 0 "All done!"
}
while getopts "sd" opt; do
case $opt in
s)
QUICKSTART=true
;;
d)
AUTOUPDATE=false
;;
esac
done
## change directory to the Firefox profile directory
cd "$(dirname "${SCRIPT_FILE}")"
# Check if running as root and if any files have the owner as root/wheel.
if [ "${EUID:-"$(id -u)"}" -eq 0 ]; then
fQuit 1 "You shouldn't run this with elevated privileges (such as with doas/sudo)."
elif [ -n "$(find ./ -user 0)" ]; then
printf 'It looks like this script was previously run with elevated privileges,
you will need to change ownership of the following files to your user:\n'
find . -user 0
fQuit 1
fi
[ "$AUTOUPDATE" = true ] && update_prefsCleaner "$@"
echo -e "\n\n"
echo " ╔══════════════════════════╗"
echo " ║ prefs.js cleaner ║"
echo " ║ by claustromaniac ║"
echo " ║ v2.1 ║"
echo " ╚══════════════════════════╝"
echo -e "\nThis script should be run from your Firefox profile directory.\n"
echo "It will remove any entries from prefs.js that also exist in user.js."
echo "This will allow inactive preferences to be reset to their default values."
echo -e "\nThis Firefox profile shouldn't be in use during the process.\n"
[ "$QUICKSTART" = true ] && fStart
echo -e "\nIn order to proceed, select a command below by entering its corresponding number.\n"
select option in Start Help Exit; do
case $option in
Start)
fStart
;;
Help)
fUsage
echo -e "\nThis script creates a backup of your prefs.js file before doing anything."
echo -e "It should be safe, but you can follow these steps if something goes wrong:\n"
echo "1. Make sure Firefox is closed."
echo "2. Delete prefs.js in your profile folder."
echo "3. Delete Invalidprefs.js if you have one in the same folder."
echo "4. Rename or copy your latest backup to prefs.js."
echo "5. Run Firefox and see if you notice anything wrong with it."
echo "6. If you do notice something wrong, especially with your extensions, and/or with the UI, go to about:support, and restart Firefox with add-ons disabled. Then, restart it again normally, and see if the problems were solved."
echo -e "If you are able to identify the cause of your issues, please bring it up on the arkenfox user.js GitHub repository.\n"
;;
Exit)
fQuit 0
;;
esac
done
fQuit 0

View File

@ -1,166 +0,0 @@
/***
This will reset the preferences that since FF91 have been
- removed from the arkenfox user.js
- deprecated by Mozilla but listed in the arkenfox user.js in the past
There is an archived version at https://github.com/arkenfox/user.js/issues/123
if you want the full list since jesus
Last updated: 21-April-2025
Instructions:
- [optional] close Firefox and backup your profile
- [optional] disable your network connection [1]
- start Firefox
- load about:config and press Ctrl+Shift+K to open the Web Console for about:config
- using about:config is important, so the script has the right permissions
- paste this script
- if you edited the list of prefs in the script, make sure the last pref does not have a trailing comma
- hit enter
- check the Info output to see which prefs were reset
- restart
- some prefs require a restart
- a restart will reapply your user.js
- [optional] re-enable your network connection
[1] Blocking Firefox from the internet ensures it cannot act on your reset preferences in the
period before you restart it, such as app and extension auto-updating, or downloading unwanted
components (GMP etc). It depends on what you're resetting and how long before you restart.
***/
(() => {
if ('undefined' === typeof(Services)) return alert('about:config needs to be the active tab!');
const aPREFS = [
/* DEPRECATED */
/* 129-140 */
'media.ondevicechange.enabled', // 137
'webchannel.allowObject.urlWhitelist', // 132
/* 116-128 */
'browser.contentanalysis.default_allow', // 127
'browser.messaging-system.whatsNewPanel.enabled', // 126
'browser.ping-centre.telemetry', // 123
'dom.webnotifications.serviceworker.enabled', // 117
'javascript.use_us_english_locale', // 119
'layout.css.font-visibility.private', // 118
'layout.css.font-visibility.resistFingerprinting', // 116
'layout.css.font-visibility.standard', // 118
'layout.css.font-visibility.trackingprotection', // 118
'network.dns.skipTRR-when-parental-control-enabled', // 119
'permissions.delegation.enabled', // 118
'security.family_safety.mode', // 117
'widget.non-native-theme.enabled', // 127
/* 103-115 */
'browser.cache.offline.enable', // 115
'extensions.formautofill.heuristics.enabled', // 114
'network.cookie.lifetimePolicy', // 103 [technically removed in 104]
'privacy.clearsitedata.cache.enabled', // 114
'privacy.resistFingerprinting.testGranularityMask', // 114
'security.pki.sha1_enforcement_level', // 103
/* 92-102 */
'browser.urlbar.suggest.quicksuggest', // 95
'dom.securecontext.whitelist_onions', // 97
'dom.storage.next_gen', // 102
'network.http.spdy.enabled', // 100
'network.http.spdy.enabled.deps',
'network.http.spdy.enabled.http2',
'network.http.spdy.websockets',
'layout.css.font-visibility.level', // 94
'security.ask_for_password', // 102
'security.csp.enable', // 99
'security.password_lifetime', // 102
'security.ssl3.rsa_des_ede3_sha', // 93
/* REMOVED */
/* 129-140 */
'dom.securecontext.allowlist_onions',
'network.http.referer.hideOnionSource',
'privacy.clearOnShutdown.cache',
'privacy.clearOnShutdown.cookies',
'privacy.clearOnShutdown.downloads',
'privacy.clearOnShutdown.formdata',
'privacy.clearOnShutdown.history',
'privacy.clearOnShutdown.offlineApps',
'privacy.clearOnShutdown.sessions',
'privacy.cpd.cache',
'privacy.cpd.cookies',
'privacy.cpd.formdata',
'privacy.cpd.history',
'privacy.cpd.offlineApps',
'privacy.cpd.sessions',
/* 116-128 */
'browser.fixup.alternate.enabled',
'browser.taskbar.previews.enable',
'browser.urlbar.dnsResolveSingleWordsAfterSearch',
'geo.provider.network.url',
'geo.provider.network.logging.enabled',
'geo.provider.use_gpsd',
'media.gmp-widevinecdm.enabled',
'network.protocol-handler.external.ms-windows-store',
'privacy.partition.always_partition_third_party_non_cookie_storage',
'privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage',
'privacy.partition.serviceWorkers',
/* 103-115 */
'beacon.enabled',
'browser.startup.blankWindow',
'browser.newtab.preload',
'browser.newtabpage.activity-stream.feeds.discoverystreamfeed',
'browser.newtabpage.activity-stream.feeds.snippets',
'browser.region.network.url',
'browser.region.update.enabled',
'browser.search.region',
'browser.ssl_override_behavior',
'browser.tabs.warnOnClose',
'devtools.chrome.enabled',
'dom.disable_beforeunload',
'dom.disable_open_during_load',
'dom.netinfo.enabled',
'dom.vr.enabled',
'extensions.formautofill.addresses.supported',
'extensions.formautofill.available',
'extensions.formautofill.creditCards.available',
'extensions.formautofill.creditCards.supported',
'middlemouse.contentLoadURL',
'network.http.altsvc.oe',
/* 92-102 */
'browser.urlbar.trimURLs',
'dom.caches.enabled',
'dom.storageManager.enabled',
'dom.storage_access.enabled',
'dom.targetBlankNoOpener.enabled',
'network.cookie.thirdparty.sessionOnly',
'network.cookie.thirdparty.nonsecureSessionOnly',
'privacy.firstparty.isolate.block_post_message',
'privacy.firstparty.isolate.restrict_opener_access',
'privacy.firstparty.isolate.use_site',
'privacy.window.name.update.enabled',
'security.insecure_connection_text.enabled',
/* IMPORTANT: last active pref must not have a trailing comma */
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
];
console.clear();
let c = 0;
for (const sPname of aPREFS) {
if (Services.prefs.prefHasUserValue(sPname)) {
Services.prefs.clearUserPref(sPname);
if (!Services.prefs.prefHasUserValue(sPname)) {
console.info('reset', sPname);
c++;
} else console.warn('failed to reset', sPname);
}
}
focus();
const d = (c==1) ? ' pref' : ' prefs';
alert(c ? 'successfully reset ' + c + d + "\n\nfor details check the console" : 'nothing to reset');
return 'all done';
})();

View File

@ -0,0 +1,61 @@
/***
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* --- 57-alpha --- */
/* commented out */
'browser.storageManager.enabled',
'dom.storageManager.enabled',
/* removed from the user.js */
'browser.search.geoip.timeout',
'geo.wifi.xhr.timeout',
'gfx.layerscope.enabled',
'media.webspeech.recognition.enable',
/* moved to RFP ALTERNATIVES */
'dom.w3c_touch_events.enabled',
'media.video_stats.enabled',
/* moved to DEPRECATED/REMOVED */
'browser.bookmarks.showRecentlyBookmarked',
'browser.casting.enabled',
'devtools.webide.autoinstallFxdtAdapters',
'media.eme.chromium-api.enabled',
'social.directories',
'social.enabled',
'social.remote-install.enabled',
'social.share.activationPanelEnabled',
'social.shareDirectory',
'social.toast-notifications.enabled',
'social.whitelist',
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -0,0 +1,60 @@
/***
This will reset the preferences that are under sections 4600 & 4700 in the ghacks user.js
up to and including release 57-alpha. These are the prefs that are no longer necessary,
or they conlfict with, privacy.resistFingerprinting if you have that enabled.
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* section 4600 */
'dom.maxHardwareConcurrency',
'dom.enable_resource_timing',
'dom.enable_performance',
'device.sensors.enabled',
'browser.zoom.siteSpecific',
'dom.gamepad.enabled',
'dom.netinfo.enabled',
'media.webspeech.synth.enabled',
'geo.enabled',
'media.video_stats.enabled',
'dom.w3c_touch_events.enabled',
/* section 4700 */
'general.useragent.override',
'general.buildID.override',
'general.appname.override',
'general.appversion.override',
'general.platform.override',
'general.oscpu.override',
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -0,0 +1,167 @@
/***
This will reset the preferences that have been deprecated by Mozilla
and used in the ghacks user.js up to and including release 57-alpha
It is in reverse order, so feel free to remove sections that do not apply
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* deprecated */
/* ESR52.x users can remove sections 53-57 but it is not
crucial as your user.js will reinstate them */
/* 57 */
'social.whitelist',
'social.toast-notifications.enabled',
'social.shareDirectory',
'social.remote-install.enabled',
'social.directories',
'social.share.activationPanelEnabled',
'social.enabled',
'media.eme.chromium-api.enabled',
'devtools.webide.autoinstallFxdtAdapters',
'browser.casting.enabled',
'browser.bookmarks.showRecentlyBookmarked',
/* 56 */
'extensions.screenshots.system-disabled',
'extensions.formautofill.experimental',
/* 55 */
'geo.security.allowinsecure',
'browser.selfsupport.enabled',
'browser.selfsupport.url',
'browser.newtabpage.directory.ping',
'browser.formfill.saveHttpsForms',
'browser.formautofill.enabled',
'dom.enable_user_timing',
'dom.keyboardevent.code.enabled',
'browser.tabs.animate',
'browser.fullscreen.animate',
/* 54 */
'browser.safebrowsing.reportMalwareMistakeURL',
'browser.safebrowsing.reportPhishMistakeURL',
'media.eme.apiVisible',
'dom.archivereader.enabled',
/* 53 */
'security.tls.unrestricted_rc4_fallback',
'plugin.scan.Acrobat',
'plugin.scan.Quicktime',
'plugin.scan.WindowsMediaPlayer',
'media.getusermedia.screensharing.allow_on_old_platforms',
'dom.beforeAfterKeyboardEvent.enabled',
/* End of ESR52.x section */
/* 52 */
'network.http.sendSecureXSiteReferrer',
'media.gmp-eme-adobe.enabled',
'media.gmp-eme-adobe.visible',
'media.gmp-eme-adobe.autoupdate',
'dom.telephony.enabled',
'dom.battery.enabled',
/* 51 */
'media.block-play-until-visible',
'dom.vr.oculus050.enabled',
'network.http.spdy.enabled.v3-1',
/* 50 */
'browser.usedOnWindows10.introURL',
'plugins.update.notifyUser',
'browser.safebrowsing.enabled',
'security.ssl3.ecdhe_ecdsa_rc4_128_sha',
'security.ssl3.ecdhe_rsa_rc4_128_sha',
'security.ssl3.rsa_rc4_128_md5',
'security.ssl3.rsa_rc4_128_sha',
'plugins.update.url',
/* 49 */
'loop.enabled',
'loop.server',
'loop.feedback.formURL',
'loop.feedback.manualFormURL',
'loop.facebook.appId',
'loop.facebook.enabled',
'loop.facebook.fallbackUrl',
'loop.facebook.shareUrl',
'loop.logDomains',
'dom.disable_window_open_feature.scrollbars',
'dom.push.udp.wakeupEnabled',
/* 48 */
'browser.urlbar.unifiedcomplete',
/* 47 */
'toolkit.telemetry.unifiedIsOptIn',
'datareporting.healthreport.about.reportUrlUnified',
'browser.history.allowPopState',
'browser.history.allowPushState',
'browser.history.allowReplaceState',
/* 46 */
'datareporting.healthreport.service.enabled',
'datareporting.healthreport.documentServerURI',
'datareporting.policy.dataSubmissionEnabled.v2',
'browser.safebrowsing.appRepURL',
'browser.polaris.enabled',
'browser.pocket.enabled',
'browser.pocket.api',
'browser.pocket.site',
'browser.pocket.oAuthConsumerKey',
/* 45 */
'browser.sessionstore.privacy_level_deferred',
/* 44 */
'browser.safebrowsing.provider.google.appRepURL',
'security.tls.insecure_fallback_hosts.use_static_list',
'dom.workers.sharedWorkers.enabled',
'dom.disable_image_src_set',
/* 43 */
'browser.safebrowsing.gethashURL',
'browser.safebrowsing.updateURL',
'browser.safebrowsing.malware.reportURL',
'browser.trackingprotection.gethashURL',
'browser.trackingprotection.updateURL',
'pfs.datasource.url',
'browser.search.showOneOffButtons',
/* 42 and earlier */
'privacy.clearOnShutdown.passwords', // 42
'full-screen-api.approval-required', // 42
'browser.safebrowsing.reportErrorURL', // 41
'browser.safebrowsing.reportGenericURL', // 41
'browser.safebrowsing.reportMalwareErrorURL', // 41
'browser.safebrowsing.reportMalwareURL', // 41
'browser.safebrowsing.reportURL', // 41
'plugins.enumerable_names', // 41
'network.http.spdy.enabled.http2draft', // 41
'camera.control.autofocus_moving_callback.enabled', // 37
'privacy.donottrackheader.value', // 36
'network.websocket.enabled', // 35
'dom.network.enabled', // 31
'pageThumbs.enabled', // 25
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -0,0 +1,63 @@
/***
This will reset the preferences that have been removed completely
from the ghacks user.js up to and including release 57-alpha
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* removed in ghacks user.js v52-57 */
/* 52-alpha */
'browser.search.reset.enabled',
'browser.search.reset.whitelist',
/* 54-alpha */
'browser.migrate.automigrate.enabled',
'services.sync.enabled',
'webextensions.storage.sync.enabled',
'webextensions.storage.sync.serverURL',
/* 55-alpha */
'dom.keyboardevent.dispatch_during_composition', // default is false anyway
'dom.vr.oculus.enabled', // covered by dom.vr.enabled
'dom.vr.openvr.enabled', // ditto
'dom.vr.osvr.enabled', // ditto
'extensions.pocket.api', // covered by extensions.pocket.enabled
'extensions.pocket.oAuthConsumerKey', // ditto
'extensions.pocket.site', // ditto
/* 56-alpha: none */
/* 57-alpha */
'geo.wifi.xhr.timeout', // covered by geo.enabled
'browser.search.geoip.timeout', // ditto
'media.webspeech.recognition.enable', // default is false anyway
'gfx.layerscope.enabled', // default is false anyway
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -0,0 +1,409 @@
/***
This will reset EVERYTHING that is ACTIVE in the ghacks user.js
release 57-alpha master, but excludes the following:
- prefs removed since publishing on github
- e10s section 1100
- privacy.resistFingerprinting alternatives sections 4600 & 4700
- deprecated section 9999
It does not matter if you clear everything, as a restart will reapply your user.js
Total 477 prefs from 57-alpha master: 118 inactive, 359 active
These have been broken into two scripts for convenience
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* 359 ACTIVE prefs in 57-alpha master */
'accessibility.force_disabled',
'alerts.showFavicons',
'app.update.auto',
'app.update.service.enabled',
'app.update.silent',
'app.update.staging.enabled',
'beacon.enabled',
'breakpad.reportURL',
'browser.aboutHomeSnippets.updateUrl',
'browser.backspace_action',
'browser.bookmarks.max_backups',
'browser.cache.disk.capacity',
'browser.cache.disk.enable',
'browser.cache.disk.smart_size.enabled',
'browser.cache.disk.smart_size.first_run',
'browser.cache.disk_cache_ssl',
'browser.cache.frecency_experiment',
'browser.cache.offline.enable',
'browser.crashReports.unsubmittedCheck.autoSubmit',
'browser.crashReports.unsubmittedCheck.enabled',
'browser.ctrlTab.previews',
'browser.display.use_document_fonts',
'browser.download.folderList',
'browser.download.forbid_open_with',
'browser.download.hide_plugins_without_extensions',
'browser.download.manager.addToRecentDocs',
'browser.download.useDownloadDir',
'browser.eme.ui.enabled',
'browser.fixup.alternate.enabled',
'browser.fixup.hide_user_pass',
'browser.formfill.enable',
'browser.helperApps.deleteTempFileOnExit',
'browser.laterrun.enabled',
'browser.library.activity-stream.enabled',
'browser.link.open_newwindow',
'browser.link.open_newwindow.restriction',
'browser.newtab.preload',
'browser.newtabpage.activity-stream.enabled',
'browser.newtabpage.directory.source',
'browser.newtabpage.enabled',
'browser.newtabpage.enhanced',
'browser.newtabpage.introShown',
'browser.offline-apps.notify',
'browser.onboarding.enabled',
'browser.pagethumbnails.capturing_disabled',
'browser.ping-centre.telemetry',
'browser.rights.3.shown',
'browser.safebrowsing.downloads.remote.enabled',
'browser.safebrowsing.downloads.remote.url',
'browser.safebrowsing.provider.google.reportMalwareMistakeURL',
'browser.safebrowsing.provider.google.reportPhishMistakeURL',
'browser.safebrowsing.provider.google.reportURL',
'browser.safebrowsing.provider.google4.reportMalwareMistakeURL',
'browser.safebrowsing.provider.google4.reportPhishMistakeURL',
'browser.safebrowsing.provider.google4.reportURL',
'browser.safebrowsing.reportPhishURL',
'browser.search.countryCode',
'browser.search.geoip.url',
'browser.search.geoSpecificDefaults',
'browser.search.geoSpecificDefaults.url',
'browser.search.region',
'browser.search.suggest.enabled',
'browser.search.update',
'browser.send_pings',
'browser.send_pings.require_same_host',
'browser.sessionhistory.max_entries',
'browser.sessionstore.interval',
'browser.sessionstore.max_tabs_undo',
'browser.sessionstore.max_windows_undo',
'browser.sessionstore.privacy_level',
'browser.sessionstore.resume_from_crash',
'browser.shell.checkDefaultBrowser',
'browser.shell.shortcutFavicons',
'browser.slowStartup.maxSamples',
'browser.slowStartup.notificationDisabled',
'browser.slowStartup.samples',
'browser.ssl_override_behavior',
'browser.startup.homepage_override.mstone',
'browser.tabs.closeWindowWithLastTab',
'browser.tabs.crashReporting.sendReport',
'browser.tabs.insertRelatedAfterCurrent',
'browser.tabs.loadDivertedInBackground',
'browser.tabs.loadInBackground',
'browser.tabs.selectOwnerOnClose',
'browser.tabs.warnOnClose',
'browser.tabs.warnOnCloseOtherTabs',
'browser.tabs.warnOnOpen',
'browser.taskbar.lists.enabled',
'browser.taskbar.lists.frequent.enabled',
'browser.taskbar.lists.recent.enabled',
'browser.taskbar.lists.tasks.enabled',
'browser.taskbar.previews.enable',
'browser.uitour.enabled',
'browser.uitour.url',
'browser.urlbar.autoFill',
'browser.urlbar.autoFill.typed',
'browser.urlbar.clickSelectsAll',
'browser.urlbar.decodeURLsOnCopy',
'browser.urlbar.doubleClickSelectsAll',
'browser.urlbar.filter.javascript',
'browser.urlbar.maxHistoricalSearchSuggestions',
'browser.urlbar.oneOffSearches',
'browser.urlbar.speculativeConnect.enabled',
// 'browser.urlbar.suggest.bookmark', // this may not get reset by your user.js - see issue #308
// 'browser.urlbar.suggest.history', // ditto
// 'browser.urlbar.suggest.openpage', // ditto
'browser.urlbar.suggest.searches',
'browser.urlbar.trimURLs',
'browser.urlbar.usepreloadedtopurls.enabled',
'browser.urlbar.userMadeSearchSuggestionsChoice',
'browser.xul.error_pages.expert_bad_cert',
'camera.control.face_detection.enabled',
'canvas.capturestream.enabled',
'captivedetect.canonicalURL',
'datareporting.healthreport.about.reportUrl',
'datareporting.healthreport.uploadEnabled',
'datareporting.policy.dataSubmissionEnabled',
'device.storage.enabled',
'devtools.chrome.enabled',
'devtools.debugger.remote-enabled',
'devtools.webide.autoinstallADBHelper',
'devtools.webide.enabled',
'dom.allow_cut_copy',
'dom.allow_scripts_to_close_windows',
'dom.caches.enabled',
'dom.disable_beforeunload',
'dom.disable_window_flip',
'dom.disable_window_move_resize',
'dom.disable_window_open_feature.close',
'dom.disable_window_open_feature.location',
'dom.disable_window_open_feature.menubar',
'dom.disable_window_open_feature.minimizable',
'dom.disable_window_open_feature.personalbar',
'dom.disable_window_open_feature.resizable',
'dom.disable_window_open_feature.status',
'dom.disable_window_open_feature.titlebar',
'dom.disable_window_open_feature.toolbar',
'dom.disable_window_status_change',
'dom.event.clipboardevents.enabled',
'dom.flyweb.enabled',
'dom.idle-observers-api.enabled',
'dom.imagecapture.enabled',
'dom.IntersectionObserver.enabled',
'dom.ipc.plugins.flash.subprocess.crashreporter.enabled',
'dom.ipc.plugins.reportCrashURL',
'dom.popup_allowed_events',
'dom.popup_maximum',
'dom.push.connection.enabled',
'dom.push.enabled',
'dom.push.serverURL',
'dom.push.userAgentID',
'dom.serviceWorkers.enabled',
'dom.vibrator.enabled',
'dom.webaudio.enabled',
'dom.webnotifications.enabled',
'dom.webnotifications.serviceworker.enabled',
'dom.workers.enabled',
'experiments.activeExperiment',
'experiments.enabled',
'experiments.manifest.uri',
'experiments.supported',
'extensions.autoDisableScopes',
'extensions.blocklist.enabled',
'extensions.blocklist.url',
'extensions.enabledScopes',
'extensions.formautofill.addresses.enabled',
'extensions.formautofill.available',
'extensions.formautofill.creditCards.enabled',
'extensions.formautofill.heuristics.enabled',
'extensions.getAddons.cache.enabled',
'extensions.getAddons.showPane',
'extensions.pocket.enabled',
'extensions.shield-recipe-client.api_url',
'extensions.shield-recipe-client.enabled',
'extensions.update.autoUpdateDefault',
'extensions.webcompat-reporter.enabled',
'extensions.webextensions.keepStorageOnUninstall',
'extensions.webextensions.keepUuidOnUninstall',
'extensions.webservice.discoverURL',
'font.blacklist.underline_offset',
'full-screen-api.enabled',
'general.useragent.compatMode.firefox',
'general.useragent.locale',
'general.warnOnAboutConfig',
'geo.wifi.uri',
'gfx.downloadable_fonts.enabled',
'gfx.downloadable_fonts.woff2.enabled',
'gfx.font_rendering.graphite.enabled',
'gfx.font_rendering.opentype_svg.enabled',
'gfx.offscreencanvas.enabled',
'intl.accept_languages',
'intl.locale.matchOS',
'intl.regional_prefs.use_os_locales',
'javascript.options.asmjs',
'javascript.options.wasm',
'javascript.use_us_english_locale',
'keyword.enabled',
'layers.acceleration.disabled',
'layout.css.font-loading-api.enabled',
'layout.css.visited_links_enabled',
'layout.spellcheckDefault',
'lightweightThemes.update.enabled',
'mathml.disabled',
'media.autoplay.enabled',
'media.block-autoplay-until-in-foreground',
'media.eme.enabled',
'media.getusermedia.audiocapture.enabled',
'media.getusermedia.browser.enabled',
'media.getusermedia.screensharing.allowed_domains',
'media.getusermedia.screensharing.enabled',
'media.gmp-gmpopenh264.autoupdate',
'media.gmp-gmpopenh264.enabled',
'media.gmp-manager.updateEnabled',
'media.gmp-manager.url',
'media.gmp-manager.url.override',
'media.gmp-provider.enabled',
'media.gmp-widevinecdm.autoupdate',
'media.gmp-widevinecdm.enabled',
'media.gmp-widevinecdm.visible',
'media.gmp.trial-create.enabled',
'media.navigator.enabled',
'media.navigator.video.enabled',
'media.ondevicechange.enabled',
'media.peerconnection.enabled',
'media.peerconnection.ice.default_address_only',
'media.peerconnection.ice.no_host',
'media.peerconnection.ice.tcp',
'media.peerconnection.identity.enabled',
'media.peerconnection.identity.timeout',
'media.peerconnection.turn.disable',
'media.peerconnection.use_document_iceservers',
'media.peerconnection.video.enabled',
'middlemouse.contentLoadURL',
'network.allow-experiments',
'network.auth.subresource-img-cross-origin-http-auth-allow',
'network.captive-portal-service.enabled',
'network.cookie.cookieBehavior',
'network.cookie.leave-secure-alone',
'network.cookie.thirdparty.sessionOnly',
'network.dns.blockDotOnion',
'network.dns.disablePrefetch',
'network.dns.disablePrefetchFromHTTPS',
'network.http.altsvc.enabled',
'network.http.altsvc.oe',
'network.http.redirection-limit',
'network.http.referer.hideOnionSource',
'network.http.referer.spoofSource',
'network.http.referer.trimmingPolicy',
'network.http.referer.userControlPolicy',
'network.http.referer.XOriginPolicy',
'network.http.referer.XOriginTrimmingPolicy',
'network.http.sendRefererHeader',
'network.http.spdy.enabled',
'network.http.spdy.enabled.deps',
'network.http.spdy.enabled.http2',
'network.http.speculative-parallel-limit',
'network.IDN_show_punycode',
'network.jar.block-remote-files',
'network.jar.open-unsafe-types',
'network.manage-offline-status',
'network.predictor.enable-prefetch',
'network.predictor.enabled',
'network.prefetch-next',
'network.protocol-handler.external.ms-windows-store',
'network.proxy.autoconfig_url.include_path',
'network.proxy.socks_remote_dns',
'network.stricttransportsecurity.preloadlist',
'offline-apps.allow_by_default',
'pdfjs.disabled',
'pdfjs.enableWebGL',
'permissions.manager.defaultsUrl',
'plugin.default.state',
'plugin.defaultXpi.state',
'plugin.scan.plid.all',
'plugin.sessionPermissionNow.intervalInMinutes',
'plugins.click_to_play',
'privacy.clearOnShutdown.cache',
'privacy.clearOnShutdown.cookies',
'privacy.clearOnShutdown.downloads',
'privacy.clearOnShutdown.formdata',
'privacy.clearOnShutdown.history',
'privacy.clearOnShutdown.offlineApps',
'privacy.clearOnShutdown.sessions',
'privacy.clearOnShutdown.siteSettings',
'privacy.cpd.cache',
'privacy.cpd.cookies',
'privacy.cpd.formdata',
'privacy.cpd.history',
'privacy.cpd.offlineApps',
'privacy.cpd.passwords',
'privacy.cpd.sessions',
'privacy.cpd.siteSettings',
'privacy.donottrackheader.enabled',
'privacy.firstparty.isolate',
'privacy.firstparty.isolate.restrict_opener_access',
'privacy.resistFingerprinting',
'privacy.sanitize.sanitizeOnShutdown',
'privacy.sanitize.timeSpan',
'privacy.trackingprotection.ui.enabled',
'security.ask_for_password',
'security.block_script_with_wrong_mime',
'security.cert_pinning.enforcement_level',
'security.csp.enable',
'security.csp.experimentalEnabled',
'security.data_uri.block_toplevel_data_uri_navigations',
'security.dialog_enable_delay',
'security.family_safety.mode',
'security.fileuri.strict_origin_policy',
'security.insecure_field_warning.contextual.enabled',
'security.insecure_password.ui.enabled',
'security.mixed_content.block_active_content',
'security.mixed_content.send_hsts_priming',
'security.mixed_content.use_hsts',
'security.OCSP.enabled',
'security.OCSP.require',
'security.password_lifetime',
'security.pki.sha1_enforcement_level',
'security.sri.enable',
'security.ssl.disable_session_identifiers',
'security.ssl.enable_ocsp_stapling',
'security.ssl.errorReporting.automatic',
'security.ssl.errorReporting.enabled',
'security.ssl.errorReporting.url',
'security.ssl.treat_unsafe_negotiation_as_broken',
'security.tls.enable_0rtt_data',
'security.tls.version.fallback-limit',
'security.tls.version.max',
'security.tls.version.min',
'security.xpconnect.plugin.unrestricted',
'services.blocklist.signing.enforced',
'services.blocklist.update_enabled',
'signon.autofillForms',
'signon.autofillForms.http',
'signon.formlessCapture.enabled',
'signon.storeWhenAutocompleteOff',
'startup.homepage_override_url',
'startup.homepage_welcome_url',
'startup.homepage_welcome_url.additional',
'toolkit.telemetry.archive.enabled',
'toolkit.telemetry.bhrPing.enabled',
'toolkit.telemetry.cachedClientID',
'toolkit.telemetry.enabled',
'toolkit.telemetry.firstShutdownPing.enabled',
'toolkit.telemetry.newProfilePing.enabled',
'toolkit.telemetry.server',
'toolkit.telemetry.shutdownPingSender.enabled',
'toolkit.telemetry.unified',
'toolkit.telemetry.updatePing.enabled',
'ui.submenuDelay',
'ui.use_standins_for_native_colors',
'view_source.tab',
'webchannel.allowObject.urlWhitelist',
'webgl.disable-extensions',
'webgl.disable-fail-if-major-performance-caveat',
'webgl.disabled',
'webgl.dxgl.enabled',
'webgl.enable-debug-renderer-info',
'webgl.enable-webgl2',
'webgl.min_capability_mode',
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -0,0 +1,167 @@
/***
This will reset EVERYTHING that is INACTIVE in the ghacks user.js
release 57-alpha master, but excludes the following:
- prefs removed since publishing on github
- e10s section 1100
- privacy.resistFingerprinting alternatives sections 4600 & 4700
- deprecated section 9999
It does not matter if you clear everything, as a restart will reapply your user.js
Total 477 prefs from 57-alpha master: 118 inactive, 359 active
These have been broken into two scripts for convenience
For instructions see:
https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.1-Resetting-Inactive-Prefs-[Scripts]
***/
(function() {
let ops = [
/* 118 INACTIVE prefs in 57-alpha master */
'accessibility.typeaheadfind',
'app.update.enabled',
'browser.cache.memory.capacity',
'browser.cache.memory.enable',
'browser.chrome.favicons',
'browser.chrome.site_icons',
'browser.download.autohideButton',
'browser.privatebrowsing.autostart',
'browser.safebrowsing.allowOverride',
'browser.safebrowsing.blockedURIs.enabled',
'browser.safebrowsing.downloads.enabled',
'browser.safebrowsing.downloads.remote.block_dangerous',
'browser.safebrowsing.downloads.remote.block_dangerous_host',
'browser.safebrowsing.downloads.remote.block_potentially_unwanted',
'browser.safebrowsing.downloads.remote.block_uncommon',
'browser.safebrowsing.malware.enabled',
'browser.safebrowsing.phishing.enabled',
'browser.safebrowsing.provider.google.gethashURL',
'browser.safebrowsing.provider.google.updateURL',
'browser.safebrowsing.provider.google4.gethashURL',
'browser.safebrowsing.provider.google4.updateURL',
'browser.safebrowsing.provider.mozilla.gethashURL',
'browser.safebrowsing.provider.mozilla.updateURL',
'browser.sessionhistory.max_total_viewers',
'browser.startup.page',
'browser.stopReloadAnimation.enabled',
'browser.storageManager.enabled',
'browser.tabs.loadBookmarksInTabs',
'browser.urlbar.autocomplete.enabled',
'browser.urlbar.maxRichResults',
'clipboard.autocopy',
'dom.event.contextmenu.enabled',
'dom.indexedDB.enabled',
'dom.presentation.controller.enabled',
'dom.presentation.discoverable',
'dom.presentation.discovery.enabled',
'dom.presentation.enabled',
'dom.presentation.receiver.enabled',
'dom.presentation.session_transport.data_channel.enable',
'dom.storage.enabled',
'dom.storageManager.enabled',
'dom.vr.enabled',
'extensions.screenshots.disabled',
'extensions.systemAddon.update.url',
'extensions.update.enabled',
'font.name.monospace.x-unicode',
'font.name.monospace.x-western',
'font.name.sans-serif.x-unicode',
'font.name.sans-serif.x-western',
'font.name.serif.x-unicode',
'font.name.serif.x-western',
'font.system.whitelist',
'full-screen-api.warning.delay',
'full-screen-api.warning.timeout',
'general.autoScroll',
'geo.wifi.logging.enabled',
'gfx.direct2d.disabled',
'javascript.options.baselinejit',
'javascript.options.ion',
'media.flac.enabled',
'media.mediasource.enabled',
'media.mediasource.mp4.enabled',
'media.mediasource.webm.audio.enabled',
'media.mediasource.webm.enabled',
'media.mp4.enabled',
'media.ogg.enabled',
'media.ogg.flac.enabled',
'media.opus.enabled',
'media.raw.enabled',
'media.wave.enabled',
'media.webm.enabled',
'media.wmf.amd.vp9.enabled',
'media.wmf.enabled',
'media.wmf.vp9.enabled',
'network.cookie.lifetime.days',
'network.cookie.lifetimePolicy',
'network.dns.disableIPv6',
'network.dnsCacheEntries',
'network.dnsCacheExpiration',
'network.http.fast-fallback-to-IPv4',
'offline-apps.quota.warn',
'permissions.memory_only',
'places.history.enabled',
'plugin.state.flash',
'privacy.clearOnShutdown.openWindows',
'privacy.cpd.downloads',
'privacy.cpd.openWindows',
'privacy.resistFingerprinting.block_mozAddonManager',
'privacy.trackingprotection.annotate_channels',
'privacy.trackingprotection.enabled',
'privacy.trackingprotection.lower_network_priority',
'privacy.trackingprotection.pbmode.enabled',
'privacy.usercontext.about_newtab_segregation.enabled',
'privacy.userContext.enabled',
'privacy.userContext.longPressBehavior',
'privacy.userContext.ui.enabled',
'privacy.window.maxInnerHeight',
'privacy.window.maxInnerWidth',
'reader.parse-on-load.enabled',
'security.mixed_content.block_display_content',
'security.nocertdb',
'security.ssl.require_safe_negotiation',
'security.ssl3.dhe_rsa_aes_128_sha',
'security.ssl3.dhe_rsa_aes_256_sha',
'security.ssl3.ecdhe_ecdsa_aes_128_sha',
'security.ssl3.ecdhe_rsa_aes_128_sha',
'security.ssl3.rsa_aes_128_sha',
'security.ssl3.rsa_aes_256_sha',
'security.ssl3.rsa_des_ede3_sha',
'services.blocklist.addons.collection',
'services.blocklist.gfx.collection',
'services.blocklist.onecrl.collection',
'services.blocklist.plugins.collection',
'signon.rememberSignons',
'svg.disabled',
'toolkit.cosmeticAnimations.enabled',
'urlclassifier.trackingTable',
'xpinstall.signatures.required',
/* reset parrot: check your open about:config after running the script */
'_user.js.parrot'
]
if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
let c = 0;
for (let i = 0, len = ops.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(ops[i])) {
Services.prefs.clearUserPref(ops[i]);
if (!Services.prefs.prefHasUserValue(ops[i])) {
console.log("reset", ops[i]);
c++;
} else { console.log("failed to reset", ops[i]); }
}
}
focus();
let d = (c==1) ? " pref" : " prefs";
if (c > 0) {
alert("successfully reset " + c + d + "\n\nfor details check the Browser Console (Ctrl+Shift+J)");
} else { alert("nothing to reset"); }
})();

View File

@ -1,10 +1,65 @@
/*** arkenfox user.js troubleshooter.js v1.6.3 ***/
/*** ghacks-user.js troubleshooter.js v1.5 ***/
(function() { (function() {
if ("undefined" === typeof(Services)) return alert('about:config needs to be the active tab!'); if("undefined" === typeof(Services)) {
alert("about:config needs to be the active tab!");
return;
}
const aPREFS = [ function getMyList(arr) {
let aRet = [];
let dummy = 0;
for (let i = 0, len = arr.length; i < len; i++) {
if (Services.prefs.prefHasUserValue(arr[i])) {
dummy = Services.prefs.getPrefType(arr[i]);
switch (dummy) {
case 32: // string (see https://dxr.mozilla.org/mozilla-central/source/modules/libpref/nsIPrefBranch.idl#31)
dummy = Services.prefs.getCharPref(arr[i]);
aRet.push({'name':arr[i],'value': dummy,'type':32});
break;
case 64: // int
dummy = Services.prefs.getIntPref(arr[i]);
aRet.push({'name':arr[i],'value': dummy,'type':64});
break;
case 128: // boolean
dummy = Services.prefs.getBoolPref(arr[i]);
aRet.push({'name':arr[i],'value': dummy,'type':128});
break;
default:
console.log("error detecting pref-type for '"+arr[i]+"' !");
}
}
}
return aRet;
}
function reapply(arr) {
for (let i = 0, len = arr.length; i < len; i++) {
switch (arr[i].type) {
case 32: // string
Services.prefs.setCharPref(arr[i].name, arr[i].value);
break;
case 64: // int
Services.prefs.setIntPref(arr[i].name, arr[i].value);
break;
case 128: // boolean
Services.prefs.setBoolPref(arr[i].name, arr[i].value);
break;
default:
console.log("error re-appyling value for '"+arr[i].name+"' !"); // should never happen
}
}
}
function myreset(arr) {
for (let i = 0, len = arr.length; i < len; i++) {
Services.prefs.clearUserPref(arr[i].name);
}
}
let ops = [
/* known culprits */ /* known culprits */
'network.cookie.cookieBehavior', 'network.cookie.cookieBehavior',
@ -16,7 +71,9 @@
/* Storage + Cache */ /* Storage + Cache */
'browser.cache.offline.enable', 'browser.cache.offline.enable',
'dom.indexedDB.enabled',
'dom.storage.enabled', 'dom.storage.enabled',
'browser.storageManager.enabled',
'dom.storageManager.enabled', 'dom.storageManager.enabled',
/* Workers, Web + Push Notifications */ /* Workers, Web + Push Notifications */
@ -25,12 +82,14 @@
'dom.push.enabled', 'dom.push.enabled',
'dom.push.serverURL', 'dom.push.serverURL',
'dom.serviceWorkers.enabled', 'dom.serviceWorkers.enabled',
'dom.workers.enabled',
'dom.webnotifications.enabled', 'dom.webnotifications.enabled',
'dom.webnotifications.serviceworker.enabled', 'dom.webnotifications.serviceworker.enabled',
/* Fonts */ /* Fonts */
'browser.display.use_document_fonts', 'browser.display.use_document_fonts',
'font.blacklist.underline_offset', 'font.blacklist.underline_offset',
'gfx.downloadable_fonts.woff2.enabled',
'gfx.font_rendering.graphite.enabled', 'gfx.font_rendering.graphite.enabled',
'gfx.font_rendering.opentype_svg.enabled', 'gfx.font_rendering.opentype_svg.enabled',
'layout.css.font-loading-api.enabled', 'layout.css.font-loading-api.enabled',
@ -43,10 +102,12 @@
'dom.IntersectionObserver.enabled', 'dom.IntersectionObserver.enabled',
'dom.popup_allowed_events', 'dom.popup_allowed_events',
'full-screen-api.enabled', 'full-screen-api.enabled',
'geo.wifi.uri',
'intl.accept_languages', 'intl.accept_languages',
'javascript.options.asmjs', 'javascript.options.asmjs',
'javascript.options.wasm', 'javascript.options.wasm',
'permissions.default.shortcuts', 'permissions.default.shortcuts',
'security.csp.experimentalEnabled',
/* Hardware */ /* Hardware */
'dom.vr.enabled', 'dom.vr.enabled',
@ -54,8 +115,7 @@
/* Audio + Video */ /* Audio + Video */
'dom.webaudio.enabled', 'dom.webaudio.enabled',
'media.autoplay.default', // FF63+ 'media.autoplay.enabled',
'media.autoplay.blocking_policy', // FF78+
/* Forms */ /* Forms */
'browser.formfill.enable', 'browser.formfill.enable',
@ -65,6 +125,7 @@
/* HTTPS */ /* HTTPS */
'security.cert_pinning.enforcement_level', 'security.cert_pinning.enforcement_level',
'security.family_safety.mode', 'security.family_safety.mode',
'security.mixed_content.use_hsts',
'security.OCSP.require', 'security.OCSP.require',
'security.pki.sha1_enforcement_level', 'security.pki.sha1_enforcement_level',
'security.ssl.require_safe_negotiation', 'security.ssl.require_safe_negotiation',
@ -82,129 +143,74 @@
/* Plugins + Flash */ /* Plugins + Flash */
'plugin.default.state', 'plugin.default.state',
'plugin.defaultXpi.state',
'plugin.sessionPermissionNow.intervalInMinutes',
'plugin.state.flash', 'plugin.state.flash',
/* unlikely to cause problems */ /* unlikely to cause problems */
'browser.tabs.remote.allowLinkedWebInFileUriProcess',
'dom.popup_maximum', 'dom.popup_maximum',
'geo.provider.network.url',
'layout.css.visited_links_enabled', 'layout.css.visited_links_enabled',
'mathml.disabled', 'mathml.disabled',
'network.auth.subresource-http-auth-allow', 'network.auth.subresource-img-cross-origin-http-auth-allow',
'network.http.redirection-limit', 'network.http.redirection-limit',
'network.protocol-handler.external.ms-windows-store', 'network.protocol-handler.external.ms-windows-store',
'privacy.trackingprotection.enabled', 'privacy.trackingprotection.enabled',
'security.data_uri.block_toplevel_data_uri_navigations', 'security.data_uri.block_toplevel_data_uri_navigations',
'privacy.window.name.update.enabled', // FF82+
'last.one.without.comma' 'last.one.without.comma'
] ]
// any runtime-set pref that everyone will have and that can be safely reset
const oFILLER = { type: 64, name: 'app.update.lastUpdateTime.browser-cleanup-thumbnails', value: 1580000000 };
function getMyList(arr) { // reset prefs that set the same value as FFs default value
const aRet = []; let aTEMP = getMyList(ops);
for (const sPname of arr) { myreset(aTEMP);
if (Services.prefs.prefHasUserValue(sPname)) { reapply(aTEMP);
const ptype = Services.prefs.getPrefType(sPname);
switch (ptype) {
case 32: // string (see https://dxr.mozilla.org/mozilla-central/source/modules/libpref/nsIPrefBranch.idl#31)
aRet.push({'type':ptype,'name':sPname,'value':Services.prefs.getCharPref(sPname)});
break;
case 64: // int
aRet.push({'type':ptype,'name':sPname,'value':Services.prefs.getIntPref(sPname)});
break;
case 128: // boolean
aRet.push({'type':ptype,'name':sPname,'value':Services.prefs.getBoolPref(sPname)});
break;
default:
console.log("error detecting pref-type for '"+sPname+"' !");
}
}
}
return aRet;
}
function reapply(arr) { const aBACKUP = getMyList(ops);
for (const oPref of arr) { //console.log(aBACKUP.length, "user-set prefs from our list detected and their values stored.");
switch (oPref.type) {
case 32: // string
Services.prefs.setCharPref(oPref.name, oPref.value);
break;
case 64: // int
Services.prefs.setIntPref(oPref.name, oPref.value);
break;
case 128: // boolean
Services.prefs.setBoolPref(oPref.name, oPref.value);
break;
default:
console.log("error re-appyling value for '"+oPref.name+"' !"); // should never happen
}
}
}
function myreset(arr) {
for (const oPref of arr) Services.prefs.clearUserPref(oPref.name);
}
function resetAllMatchingDefault(arr) {
const aTmp = getMyList(arr);
myreset(aTmp);
reapply(aTmp);
}
function _main(aALL) {
const _h = (arr) => Math.ceil(arr.length/2);
let aTmp = aALL, aDbg = aALL;
reapply(aALL);
myreset(aTmp.slice(0, _h(aTmp)));
while (aTmp.length) {
alert('NOW TEST AGAIN !');
if (confirm('if the problem still exists click OK, otherwise click Cancel.')) {
aTmp = aTmp.slice(_h(aTmp));
} else {
aTmp = aTmp.slice(0, _h(aTmp));
aDbg = aTmp; // update narrowed down list
if (aDbg.length == 1) break;
}
reapply(aALL);
myreset(aTmp.slice(0, _h(aTmp))); // reset half of the remaining prefs
}
reapply(aALL);
if (aDbg.length == 1) return alert("narrowed it down to:\n\n"+aDbg[0].name+"\n");
if (aDbg.length == aALL.length) {
const msg = "Failed to narrow it down beyond the initial "+aALL.length+" prefs. The problem is most likely caused by at least 2 prefs!\n\n" +
"Either those prefs are too far apart in the list or there are exactly 2 culprits and they just happen to be at the wrong place.\n\n" +
"In case it's the latter, the script can add a dummy pref and you can try again - Try again?";
if (confirm(msg)) return _main([...aALL, oFILLER]);
} else if (aDbg.length > 10 && confirm("Narrowed it down to "+aDbg.length+" prefs. Try narrowing it down further?")) {
return _main(aDbg.reverse());
}
alert("Narrowed it down to "+ aDbg.length.toString() +" prefs, check the console ...");
console.log('The problem is caused by 2 or more of these prefs:');
for (const oPref of aDbg) console.log(oPref.name);
}
resetAllMatchingDefault(aPREFS); // reset user-set prefs matching FFs default value
const aBAK = getMyList(aPREFS);
//console.log(aBAK.length, "user-set prefs from our list detected and their values stored.");
const sMsg = "all detected prefs reset.\n\n" +
"!! KEEP THIS PROMPT OPEN AND TEST THE SITE IN ANOTHER TAB !!\n\n" +
"IF the problem still exists, this script can't help you - click Cancel to re-apply your values and exit.\n\n" +
"Click OK if your problem is fixed.";
let myArr = aBACKUP;
let found = false;
let aDbg = [];
focus(); focus();
myreset(aBAK); myreset(aBACKUP); // reset all detected prefs
if (!confirm(sMsg)) { if (confirm("all detected prefs reset.\n\n!! KEEP THIS PROMPT OPEN AND TEST THE SITE IN ANOTHER TAB !!\n\nIF the problem still exists, this script can't help you - click cancel to re-apply your values and exit.\n\nClick OK if your problem is fixed.")) {
reapply(aBAK); aDbg = myArr;
reapply(aBACKUP);
myreset(myArr.slice(0, parseInt(myArr.length/2)));
while (myArr.length >= 2) {
alert("NOW TEST AGAIN !");
if (confirm("if the problem still exists click OK, otherwise click cancel.")) {
myArr = myArr.slice(parseInt(myArr.length/2));
if (myArr.length == 1) {
alert("The problem is caused by more than 1 pref !\n\nNarrowed it down to "+ aDbg.length.toString() +" prefs, check the console ...");
break;
}
} else {
myArr = myArr.slice(0, parseInt(myArr.length/2));
aDbg = myArr;
if (myArr.length == 1) { found = true; break; }
}
reapply(aBACKUP);
myreset(myArr.slice(0, parseInt(myArr.length/2))); // reset half of the remaining prefs
}
reapply(aBACKUP);
}
else {
reapply(aBACKUP);
return; return;
} }
_main(aBAK);
if (found) {
alert("narrowed it down to:\n\n"+myArr[0].name+"\n");
myreset(myArr); // reset the culprit
}
else {
console.log("the problem is caused by a combination of the following prefs:");
for (let i = 0, len = aDbg.length; i < len; i++) {
console.log(aDbg[i].name);
}
}
})(); })();

View File

@ -1,18 +1,13 @@
@ECHO OFF & SETLOCAL EnableDelayedExpansion @ECHO OFF & SETLOCAL EnableDelayedExpansion
TITLE arkenfox user.js updater TITLE ghacks user.js updater
REM ## arkenfox user.js updater for Windows REM ## ghacks-user.js updater for Windows
REM ## author: @claustromaniac REM ## author: @claustromaniac
REM ## version: 4.20 REM ## version: 4.4
REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows REM ## instructions: https://github.com/ghacksuserjs/ghacks-user.js/wiki/3.3-Updater-Scripts
SET v=4.19
VERIFY ON
CD /D "%~dp0"
SET _myname=%~n0 SET _myname=%~n0
SET _myparams=%* SET _myparams=%*
:parse :parse
IF "%~1"=="" (GOTO endparse) IF "%~1"=="" (GOTO endparse)
IF /I "%~1"=="-unattended" (SET _ua=1) IF /I "%~1"=="-unattended" (SET _ua=1)
@ -22,34 +17,20 @@ IF /I "%~1"=="-multioverrides" (SET _multi=1)
IF /I "%~1"=="-merge" (SET _merge=1) IF /I "%~1"=="-merge" (SET _merge=1)
IF /I "%~1"=="-updatebatch" (SET _updateb=1) IF /I "%~1"=="-updatebatch" (SET _updateb=1)
IF /I "%~1"=="-singlebackup" (SET _singlebackup=1) IF /I "%~1"=="-singlebackup" (SET _singlebackup=1)
IF /I "%~1"=="-esr" (SET _esr=1)
SHIFT SHIFT
GOTO parse GOTO parse
:endparse :endparse
FOR /F %%i IN ('PowerShell -Command "[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'"') DO (
IF "%%i" == "False" (
CALL :message "Your PowerShell version doesn't support TLS1.2 ^!"
ECHO: Instructions to update PowerShell are on the arkenfox wiki
PAUSE
EXIT
)
)
IF DEFINED _updateb ( IF DEFINED _updateb (
REM The normal flow here goes from phase 1 to phase 2 and then phase 3. REM The normal flow here goes from phase 1 to phase 2 and then phase 3.
IF NOT "!_myname:~0,9!"=="[updated]" ( IF NOT "!_myname:~0,9!"=="[updated]" (
IF EXIST "[updated]!_myname!.bat" ( IF EXIST "[updated]!_myname!.bat" (
REM ## Phase 3 ##: The new script, with the original name, will: REM ## Phase 3 ##: The new script, with the original name, will:
REM * Delete the [updated]*.bat and *.bat.old scripts REM * Delete the [updated]*.bat script
REM * Begin the normal routine REM * Begin the normal routine
FC "[updated]!_myname!.bat" "!_myname!.bat.old" >nul
IF NOT "!errorlevel!"=="0" (
CALL :message "Script updated to version !v!"
TIMEOUT 3 >nul
)
REN "[updated]!_myname!.bat" "[updated]!_myname!.bat.old" REN "[updated]!_myname!.bat" "[updated]!_myname!.bat.old"
DEL /F "!_myname!.bat.old" "[updated]!_myname!.bat.old" DEL /F "[updated]!_myname!.bat.old"
CALL :message "Script updated^!"
TIMEOUT 3 >nul
GOTO begin GOTO begin
) )
REM ## Phase 1 ## REM ## Phase 1 ##
@ -57,9 +38,11 @@ IF DEFINED _updateb (
REM * Start that script in a new CMD window REM * Start that script in a new CMD window
REM * Exit REM * Exit
CALL :message "Updating script..." CALL :message "Updating script..."
REM Uncomment the next line and comment out the PowerShell call for testing. REM Uncomment the next line and comment the powershell call for testing.
REM COPY /B /Y "!_myname!.bat" "[updated]!_myname!.bat" >nul REM COPY /B /V /Y "!_myname!.bat" "[updated]!_myname!.bat"
CALL :psdownload https://raw.githubusercontent.com/arkenfox/user.js/master/updater.bat "[updated]!_myname!.bat" (
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/updater.bat', '[updated]!_myname!.bat')"
) >nul 2>&1
IF EXIST "[updated]!_myname!.bat" ( IF EXIST "[updated]!_myname!.bat" (
START /min CMD /C "[updated]!_myname!.bat" !_myparams! START /min CMD /C "[updated]!_myname!.bat" !_myparams!
) ELSE ( ) ELSE (
@ -72,17 +55,19 @@ IF DEFINED _updateb (
TIMEOUT 300 >nul TIMEOUT 300 >nul
) ELSE ( ) ELSE (
REM ## Phase 2 ##: The [updated]*.bat script will: REM ## Phase 2 ##: The [updated]*.bat script will:
REM * Rename the old script and make a copy of itself with the original name. REM * Copy itself overwriting the original batch
REM * Run that copy in a new CMD instance REM * Start that script in a new CMD instance
REM * Exit REM * Exit
IF EXIST "!_myname:~9!.bat" ( REN "!_myname:~9!.bat" "!_myname:~9!.bat.old" ) IF EXIST "!_myname:~9!.bat" (
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat" REN "!_myname:~9!.bat" "!_myname:~9!.bat.old"
DEL /F "!_myname:~9!.bat.old"
)
COPY /B /V /Y "!_myname!.bat" "!_myname:~9!.bat"
START CMD /C "!_myname:~9!.bat" !_myparams! START CMD /C "!_myname:~9!.bat" !_myparams!
) )
) )
EXIT /B EXIT /B
) )
:begin :begin
CLS CLS
ECHO: ECHO:
@ -90,7 +75,7 @@ ECHO:
ECHO: ######################################## ECHO: ########################################
ECHO: #### user.js Updater for Windows #### ECHO: #### user.js Updater for Windows ####
ECHO: #### by claustromaniac #### ECHO: #### by claustromaniac ####
ECHO: #### v!v! #### ECHO: #### v4.4 ####
ECHO: ######################################## ECHO: ########################################
ECHO: ECHO:
SET /A "_line=0" SET /A "_line=0"
@ -106,10 +91,7 @@ IF NOT EXIST user.js (
) )
:exitloop :exitloop
IF NOT "!_name!"=="" ( IF NOT "!_name!"=="" (
SET "_tempvar=" IF /I NOT "!_name!"=="!_name:ghacks=!" (
IF /I NOT "!_name!"=="!_name:ghacks=!" SET _tempvar=1
IF /I NOT "!_name!"=="!_name:arkenfox=!" SET _tempvar=1
IF !_tempvar! EQU 1 (
CALL :message "!_name! !_version:~2!,!_date!" CALL :message "!_name! !_version:~2!,!_date!"
) ELSE (CALL :message "Current user.js version not recognised.") ) ELSE (CALL :message "Current user.js version not recognised.")
) ELSE (CALL :message "Current user.js version not recognised.") ) ELSE (CALL :message "Current user.js version not recognised.")
@ -117,7 +99,7 @@ IF NOT EXIST user.js (
ECHO: ECHO:
IF NOT DEFINED _ua ( IF NOT DEFINED _ua (
CALL :message "This batch should be run from your Firefox profile directory." CALL :message "This batch should be run from your Firefox profile directory."
ECHO: It will download the latest version of arkenfox user.js from github and then ECHO: It will download the latest version of ghacks user.js from github and then
CALL :message "append any of your own changes from user-overrides.js to it." CALL :message "append any of your own changes from user-overrides.js to it."
CALL :message "Visit the wiki for more detailed information." CALL :message "Visit the wiki for more detailed information."
ECHO: ECHO:
@ -138,29 +120,27 @@ IF DEFINED _log (
) )
IF EXIST user.js.new (DEL /F "user.js.new") IF EXIST user.js.new (DEL /F "user.js.new")
CALL :message "Retrieving latest user.js file from github repository..." CALL :message "Retrieving latest user.js file from github repository..."
CALL :psdownload https://raw.githubusercontent.com/arkenfox/user.js/master/user.js "user.js.new" (
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js', 'user.js.new')"
) >nul 2>&1
IF EXIST user.js.new ( IF EXIST user.js.new (
IF DEFINED _esr (
CALL :message "Activating ESR section..."
CALL :activate user.js.new ".x still uses all the following prefs"
)
IF DEFINED _multi ( IF DEFINED _multi (
FORFILES /P user.js-overrides /M *.js >nul 2>&1 FORFILES /P user.js-overrides /M *.js >nul 2>&1
IF NOT ERRORLEVEL 1 ( IF NOT ERRORLEVEL 1 (
IF DEFINED _merge ( IF DEFINED _merge (
CALL :message "Merging..." CALL :message "Merging..."
COPY /B /Y user.js-overrides\*.js user-overrides-merged.js COPY /B /V /Y user.js-overrides\*.js user-overrides-merged.js
CALL :merge user-overrides-merged.js CALL :merge user-overrides-merged.js
COPY /B /Y user.js.new+user-overrides-merged.js user.js.new COPY /B /V /Y user.js.new+user-overrides-merged.js user.js.new
CALL :merge user.js.new CALL :merge user.js.new
) ELSE ( ) ELSE (
CALL :message "Appending..." CALL :message "Appending..."
COPY /B /Y user.js.new+"user.js-overrides\*.js" user.js.new COPY /B /V /Y user.js.new+"user.js-overrides\*.js" user.js.new
) )
) ELSE (CALL :message "No override files found.") ) ELSE (CALL :message "No override files found.")
) ELSE ( ) ELSE (
IF EXIST "user-overrides.js" ( IF EXIST "user-overrides.js" (
COPY /B /Y user.js.new+"user-overrides.js" "user.js.new" COPY /B /V /Y user.js.new+"user-overrides.js" "user.js.new"
IF DEFINED _merge ( IF DEFINED _merge (
CALL :message "Merging user-overrides.js..." CALL :message "Merging user-overrides.js..."
CALL :merge user.js.new CALL :merge user.js.new
@ -177,8 +157,7 @@ IF EXIST user.js.new (
IF DEFINED _singlebackup ( IF DEFINED _singlebackup (
MOVE /Y user.js user.js.bak >nul MOVE /Y user.js user.js.bak >nul
) ELSE ( ) ELSE (
FOR /F "delims=" %%# IN ('powershell -command get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%# MOVE /Y user.js "user-backup-!date:/=-!_!time::=.!.js" >nul
MOVE /Y user.js "user-backup-!ldt!.js" >nul
) )
REN user.js.new user.js REN user.js.new user.js
CALL :message "Update complete." CALL :message "Update complete."
@ -189,7 +168,6 @@ IF EXIST user.js.new (
) ELSE ( ) ELSE (
REN user.js.new user.js REN user.js.new user.js
CALL :message "Update complete." CALL :message "Update complete."
SET "_changed=true"
) )
) )
) ELSE ( ) ELSE (
@ -197,19 +175,11 @@ IF EXIST user.js.new (
ECHO: No changes were made. ECHO: No changes were made.
) )
IF NOT DEFINED _log ( IF NOT DEFINED _log (
IF NOT DEFINED _ua ( IF NOT DEFINED _ua (PAUSE)
IF EXIST prefsCleaner.bat (
IF "!_changed!"=="true" (
CALL :message "Would you like to run the prefsCleaner now?"
CHOICE /C YN /N /M "(Y/N) "
IF "1"=="!errorlevel!" ( START "" cmd.exe /C "prefsCleaner.bat" )
) ELSE (PAUSE)
) ELSE (PAUSE)
)
) )
EXIT /B EXIT /B
::::::::::::::: Message ::::::::::::::: REM ########### Message Function ###########
:message :message
SETLOCAL DisableDelayedExpansion SETLOCAL DisableDelayedExpansion
IF NOT "2"=="%_log%" (ECHO:) IF NOT "2"=="%_log%" (ECHO:)
@ -217,41 +187,11 @@ ECHO: %~1
IF NOT "2"=="%_log%" (ECHO:) IF NOT "2"=="%_log%" (ECHO:)
ENDLOCAL ENDLOCAL
GOTO :EOF GOTO :EOF
REM ############ Merge function ############
::::::::::::::: Download :::::::::::::::
:psdownload
(
PowerShell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('%~1', '%~2')"
) >nul 2>&1
GOTO :EOF
::::::::::::::: Activate Section :::::::::::::::
:activate
:: arg1 = file
:: arg2 = line substring
SETLOCAL DisableDelayedExpansion
(
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" "%~1"') DO (
SET "_temp=%%H"
SETLOCAL EnableDelayedExpansion
IF "!_temp:%~2=!"=="!_temp!" (
ENDLOCAL & ECHO:%%H
) ELSE (
ECHO://!_temp:~2!
ENDLOCAL
)
)
)>updatertempfile
MOVE /Y updatertempfile "%~1" >nul
ENDLOCAL
GOTO :EOF
::::::::::::::: Merge :::::::::::::::
:merge :merge
SETLOCAL DisableDelayedExpansion SETLOCAL DisableDelayedExpansion
FOR /F tokens^=2^,^*^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^user_pref[ ]*\([ ]*[\"'].*[\"'][ ]*,.*\)[ ]*;" "%~1"') DO (SET "[%%G]=%%H")
FOR /F tokens^=2^,^*^ delims^=^' %%G IN ('FINDSTR /R /C:"^//// --- comment-out --- '[^'][^']*'.*" "%~1"') DO (SET "__unset__%%G=1")
( (
FOR /F tokens^=2^,^*^ delims^=^'^" %%G IN ('FINDSTR /B /R /C:"user_pref.*\)[ ]*;" "%~1"') DO (IF NOT "%%H"=="" (SET "%%G=%%H"))
FOR /F "tokens=1,* delims=:" %%I IN ('FINDSTR /N "^" "%~1"') DO ( FOR /F "tokens=1,* delims=:" %%I IN ('FINDSTR /N "^" "%~1"') DO (
SET "_temp=%%J" SET "_temp=%%J"
SETLOCAL EnableDelayedExpansion SETLOCAL EnableDelayedExpansion
@ -264,15 +204,11 @@ FOR /F tokens^=2^,^*^ delims^=^' %%G IN ('FINDSTR /R /C:"^//// --- comment-out -
ENDLOCAL ENDLOCAL
FOR /F tokens^=2^ delims^=^'^" %%K IN ("%%J") DO ( FOR /F tokens^=2^ delims^=^'^" %%K IN ("%%J") DO (
IF NOT "_user.js.parrot"=="%%K" ( IF NOT "_user.js.parrot"=="%%K" (
IF DEFINED __unset__%%K ( IF DEFINED %%K (
ECHO://%%J SETLOCAL EnableDelayedExpansion
) ELSE ( FOR /F "delims=" %%L IN ("!%%K!") DO (
IF DEFINED [%%K] ( ENDLOCAL & ECHO:user_pref("%%K"%%L
SETLOCAL EnableDelayedExpansion SET "%%K="
FOR /F "delims=" %%L IN ("![%%K]!") DO (
ENDLOCAL & ECHO:user_pref("%%K"%%L
SET "[%%K]="
)
) )
) )
) ELSE (ECHO:%%J) ) ELSE (ECHO:%%J)
@ -284,14 +220,11 @@ FOR /F tokens^=2^,^*^ delims^=^' %%G IN ('FINDSTR /R /C:"^//// --- comment-out -
MOVE /Y updatertempfile "%~1" >nul MOVE /Y updatertempfile "%~1" >nul
ENDLOCAL ENDLOCAL
GOTO :EOF GOTO :EOF
REM ############### Help ##################
::::::::::::::: Help :::::::::::::::
:showhelp :showhelp
MODE 80,54 MODE 80,46
CLS CLS
CALL :message "Available arguments (case-insensitive):" CALL :message "Available arguments (case-insensitive):"
CALL :message " -esr"
ECHO: Activate ESR related preferences
CALL :message " -log" CALL :message " -log"
ECHO: Write the console output to a logfile (user.js-update-log.txt) ECHO: Write the console output to a logfile (user.js-update-log.txt)
CALL :message " -logP" CALL :message " -logP"
@ -315,9 +248,10 @@ ECHO: Run without user input.
CALL :message " -singleBackup" CALL :message " -singleBackup"
ECHO: Use a single backup file and overwrite it on new updates, instead of ECHO: Use a single backup file and overwrite it on new updates, instead of
ECHO: cumulative backups. This was the default behaviour before v4.3. ECHO: cumulative backups. This was the default behaviour before v4.3.
CALL :message " -updateBatch" CALL :message " -updatebatch"
ECHO: Update the script itself on execution, before the normal routine. ECHO: Update the script itself on execution, before the normal routine.
CALL :message "" CALL :message ""
PAUSE PAUSE
MODE 80,25 MODE 80,25
GOTO :begin GOTO :begin
REM #####################################

425
updater.sh Executable file → Normal file
View File

@ -1,407 +1,58 @@
#!/usr/bin/env bash #!/bin/bash
## arkenfox user.js updater for macOS and Linux ### ghacks-user.js updater for Mac/Linux
## author: @overdodactyl
## version: 1.2
## version: 4.0 ghacksjs="https://raw.githubusercontent.com/ghacksuserjs/ghacks-user.js/master/user.js"
## Author: Pat Johnson (@overdodactyl)
## Additional contributors: @earthlng, @ema-pe, @claustromaniac, @infinitewarp
## DON'T GO HIGHER THAN VERSION x.9 !! ( because of ASCII comparison in update_updater() ) echo -e "\nThis script should be run from your Firefox profile directory.\n"
# Check if running as root currdir=$(pwd)
if [ "${EUID:-"$(id -u)"}" -eq 0 ]; then
printf "You shouldn't run this with elevated privileges (such as with doas/sudo).\n"
exit 1
fi
readonly CURRDIR=$(pwd) ## get the full path of this script (readlink for Linux, greadlink for Mac with coreutils installed)
sfp=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null) ## fallback for Macs without coreutils
[ -z "$SCRIPT_FILE" ] && SCRIPT_FILE=${BASH_SOURCE[0]} if [ -z "$sfp" ]; then sfp=${BASH_SOURCE[0]}; fi
readonly SCRIPT_DIR=$(dirname "${SCRIPT_FILE}")
## change directory to the Firefox profile directory
cd "$(dirname "${sfp}")"
######################### echo -e "Updating the user.js for Firefox profile:\n$(pwd)\n"
# Base variables #
#########################
# Colors used for printing if [ -e user.js ]; then
RED='\033[0;31m' echo "Your current user.js file for this profile will be backed up and the latest ghacks version from github will take its place."
BLUE='\033[0;34m' echo -e "\nIf currently using the ghacks user.js, please compare versions:"
BBLUE='\033[1;34m' echo " Available online: $(curl -s ${ghacksjs} | sed -n '4p')"
GREEN='\033[0;32m' echo " Currently using: $(sed -n '4p' user.js)"
ORANGE='\033[0;33m'
CYAN='\033[0;36m'
NC='\033[0m' # No Color
# Argument defaults
UPDATE='check'
CONFIRM='yes'
OVERRIDE='user-overrides.js'
BACKUP='multiple'
COMPARE=false
SKIPOVERRIDE=false
VIEW=false
PROFILE_PATH=false
ESR=false
# Download method priority: curl -> wget
DOWNLOAD_METHOD=''
if command -v curl >/dev/null; then
DOWNLOAD_METHOD='curl --max-redirs 3 -so'
elif command -v wget >/dev/null; then
DOWNLOAD_METHOD='wget --max-redirect 3 --quiet -O'
else else
echo -e "${RED}This script requires curl or wget.\nProcess aborted${NC}" echo "A user.js file does not exist in this profile. If you continue, the latest ghacks version from github will be downloaded."
exit 1
fi fi
echo -e "\nIf a user-overrides.js file exists in this profile, it will be appended to the user.js.\n"
show_banner() { read -p "Continue Y/N? " -n 1 -r
echo -e "${BBLUE} echo -e "\n\n"
############################################################################
#### ####
#### arkenfox user.js ####
#### Hardening the Privacy and Security Settings of Firefox ####
#### Maintained by @Thorin-Oakenpants and @earthlng ####
#### Updater for macOS and Linux by @overdodactyl ####
#### ####
############################################################################"
echo -e "${NC}\n"
echo -e "Documentation for this script is available here: ${CYAN}https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-maclinux${NC}\n"
}
######################### if [[ $REPLY =~ ^[Yy]$ ]]; then
# Arguments # if [ -e user.js ]; then
######################### # backup current user.js
bakfile="user.js.backup.$(date +"%Y-%m-%d_%H%M")"
usage() { mv user.js "${bakfile}" && echo "Your previous user.js file was backed up: ${bakfile}"
echo
echo -e "${BLUE}Usage: $0 [-bcdehlnrsuv] [-p PROFILE] [-o OVERRIDE]${NC}" 1>&2 # Echo usage string to standard error
echo -e "
Optional Arguments:
-h Show this help message and exit.
-p PROFILE Path to your Firefox profile (if different than the dir of this script)
IMPORTANT: If the path contains spaces, wrap the entire argument in quotes.
-l Choose your Firefox profile from a list
-u Update updater.sh and execute silently. Do not seek confirmation.
-d Do not look for updates to updater.sh.
-s Silently update user.js. Do not seek confirmation.
-b Only keep one backup of each file.
-c Create a diff file comparing old and new user.js within userjs_diffs.
-o OVERRIDE Filename or path to overrides file (if different than user-overrides.js).
If used with -p, paths should be relative to PROFILE or absolute paths
If given a directory, all files inside will be appended recursively.
You can pass multiple files or directories by passing a comma separated list.
Note: If a directory is given, only files inside ending in the extension .js are appended
IMPORTANT: Do not add spaces between files/paths. Ex: -o file1.js,file2.js,dir1
IMPORTANT: If any file/path contains spaces, wrap the entire argument in quotes.
Ex: -o \"override folder\"
-n Do not append any overrides, even if user-overrides.js exists.
-v Open the resulting user.js file.
-r Only download user.js to a temporary file and open it.
-e Activate ESR related preferences."
echo
exit 1
}
#########################
# File Handling #
#########################
download_file() { # expects URL as argument ($1)
declare -r tf=$(mktemp)
$DOWNLOAD_METHOD "${tf}" "$1" &>/dev/null && echo "$tf" || echo '' # return the temp-filename or empty string on error
}
open_file() { # expects one argument: file_path
if [ "$(uname)" == 'Darwin' ]; then
open "$1"
elif [ "$(uname -s | cut -c -5)" == "Linux" ]; then
xdg-open "$1"
else
echo -e "${RED}Error: Sorry, opening files is not supported for your OS.${NC}"
fi
}
readIniFile() { # expects one argument: absolute path of profiles.ini
declare -r inifile="$1"
# tempIni will contain: [ProfileX], Name=, IsRelative= and Path= (and Default= if present) of the only (if) or the selected (else) profile
if [ "$(grep -c '^\[Profile' "${inifile}")" -eq "1" ]; then ### only 1 profile found
tempIni="$(grep '^\[Profile' -A 4 "${inifile}")"
else
echo -e "Profiles found:\n"
## 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
echo -e "\n"
if [[ $REPLY =~ ^(0|[1-9][0-9]*)$ ]]; then
tempIni="$(grep "^\[Profile${REPLY}" -A 4 "${inifile}")" || {
echo -e "${RED}Profile${REPLY} does not exist!${NC}" && exit 1
}
else
echo -e "${RED}Invalid selection!${NC}" && exit 1
fi
fi fi
# extracting 0 or 1 from the "IsRelative=" line # download latest ghacks user.js
declare -r pathisrel=$(sed -n 's/^IsRelative=\([01]\)$/\1/p' <<< "${tempIni}") echo "downloading latest ghacks user.js file"
curl -O ${ghacksjs} && echo "ghacks user.js has been downloaded"
# extracting only the path itself, excluding "Path=" if [ -e user-overrides.js ]; then
PROFILE_PATH=$(sed -n 's/^Path=\(.*\)$/\1/p' <<< "${tempIni}") echo "user-overrides.js file found"
# update global variable if path is relative cat user-overrides.js >> user.js && echo "user-overrides.js has been appended to user.js"
[[ ${pathisrel} == "1" ]] && PROFILE_PATH="$(dirname "${inifile}")/${PROFILE_PATH}"
}
getProfilePath() {
declare -r f1=~/Library/Application\ Support/Firefox/profiles.ini
declare -r f2=~/.mozilla/firefox/profiles.ini
if [ "$PROFILE_PATH" = false ]; then
PROFILE_PATH="$SCRIPT_DIR"
elif [ "$PROFILE_PATH" = 'list' ]; then
if [[ -f "$f1" ]]; then
readIniFile "$f1" # updates PROFILE_PATH or exits on error
elif [[ -f "$f2" ]]; then
readIniFile "$f2"
else
echo -e "${RED}Error: Sorry, -l is not supported for your OS${NC}"
exit 1
fi
#else
# PROFILE_PATH already set by user with -p
fi
}
#########################
# Update updater.sh #
#########################
# Returns the version number of a updater.sh file
get_updater_version() {
echo "$(sed -n '5 s/.*[[:blank:]]\([[:digit:]]*\.[[:digit:]]*\)/\1/p' "$1")"
}
# Update updater.sh
# Default: Check for update, if available, ask user if they want to execute it
# Args:
# -d: New version will not be looked for and update will not occur
# -u: Check for update, if available, execute without asking
update_updater() {
[ "$UPDATE" = 'no' ] && return 0 # User signified not to check for updates
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
if [[ $(get_updater_version "$SCRIPT_FILE") < $(get_updater_version "${tmpfile}") ]]; then
if [ "$UPDATE" = 'check' ]; then
echo -e "There is a newer version of updater.sh available. ${RED}Update and execute Y/N?${NC}"
read -p "" -n 1 -r
echo -e "\n\n"
[[ $REPLY =~ ^[Yy]$ ]] || return 0 # Update available, but user chooses not to update
fi
else
return 0 # No update available
fi
mv "${tmpfile}" "$SCRIPT_FILE"
chmod u+x "$SCRIPT_FILE"
"$SCRIPT_FILE" "$@" -d
exit 0
}
#########################
# Update user.js #
#########################
# Returns version number of a user.js file
get_userjs_version() {
[ -e "$1" ] && echo "$(sed -n '4p' "$1")" || echo "Not detected."
}
add_override() {
input=$1
if [ -f "$input" ]; then
echo "" >> user.js
cat "$input" >> user.js
echo -e "Status: ${GREEN}Override file appended:${NC} ${input}"
elif [ -d "$input" ]; then
SAVEIFS=$IFS
IFS=$'\n\b' # Set IFS
FILES="${input}"/*.js
for f in $FILES
do
add_override "$f"
done
IFS=$SAVEIFS # restore $IFS
else
echo -e "${ORANGE}Warning: Could not find override file:${NC} ${input}"
fi
}
remove_comments() { # expects 2 arguments: from-file and to-file
sed -e '/^\/\*.*\*\/[[:space:]]*$/d' -e '/^\/\*/,/\*\//d' -e 's|^[[:space:]]*//.*$||' -e '/^[[:space:]]*$/d' -e 's|);[[:space:]]*//.*|);|' "$1" > "$2"
}
# Applies latest version of user.js and any custom overrides
update_userjs() {
declare -r newfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
[ -z "${newfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && return 1 # check if download failed
echo -e "Please observe the following information:
Firefox profile: ${ORANGE}$(pwd)${NC}
Available online: ${ORANGE}$(get_userjs_version "$newfile")${NC}
Currently using: ${ORANGE}$(get_userjs_version user.js)${NC}\n\n"
if [ "$CONFIRM" = 'yes' ]; then
echo -e "This script will update to the latest user.js file and append any custom configurations from user-overrides.js. ${RED}Continue Y/N? ${NC}"
read -p "" -n 1 -r
echo -e "\n"
if ! [[ $REPLY =~ ^[Yy]$ ]]; then
echo -e "${RED}Process aborted${NC}"
rm "$newfile"
return 1
fi
fi
# Copy a version of user.js to diffs folder for later comparison
if [ "$COMPARE" = true ]; then
mkdir -p userjs_diffs
cp user.js userjs_diffs/past_user.js &>/dev/null
fi
# backup user.js
mkdir -p userjs_backups
local bakname="userjs_backups/user.js.backup.$(date +"%Y-%m-%d_%H%M")"
[ "$BACKUP" = 'single' ] && bakname='userjs_backups/user.js.backup'
cp user.js "$bakname" &>/dev/null
mv "${newfile}" user.js
echo -e "Status: ${GREEN}user.js has been backed up and replaced with the latest version!${NC}"
if [ "$ESR" = true ]; then
sed -e 's/\/\* \(ESR[0-9]\{2,\}\.x still uses all.*\)/\/\/ \1/' user.js > user.js.tmp && mv user.js.tmp user.js
echo -e "Status: ${GREEN}ESR related preferences have been activated!${NC}"
fi
# apply overrides
if [ "$SKIPOVERRIDE" = false ]; then
while IFS=',' read -ra FILES; do
for FILE in "${FILES[@]}"; do
add_override "$FILE"
done
done <<< "$OVERRIDE"
fi
# create diff
if [ "$COMPARE" = true ]; then
pastuserjs='userjs_diffs/past_user.js'
past_nocomments='userjs_diffs/past_userjs.txt'
current_nocomments='userjs_diffs/current_userjs.txt'
remove_comments "$pastuserjs" "$past_nocomments"
remove_comments user.js "$current_nocomments"
diffname="userjs_diffs/diff_$(date +"%Y-%m-%d_%H%M").txt"
diff=$(diff -w -B -U 0 "$past_nocomments" "$current_nocomments")
if [ -n "$diff" ]; then
echo "$diff" > "$diffname"
echo -e "Status: ${GREEN}A diff file was created:${NC} ${PWD}/${diffname}"
else
echo -e "Warning: ${ORANGE}Your new user.js file appears to be identical. No diff file was created.${NC}"
[ "$BACKUP" = 'multiple' ] && rm "$bakname" &>/dev/null
fi
rm "$past_nocomments" "$current_nocomments" "$pastuserjs" &>/dev/null
fi
[ "$VIEW" = true ] && open_file "${PWD}/user.js"
}
#########################
# Execute #
#########################
if [ $# != 0 ]; then
# Display usage if first argument is -help or --help
if [ "$1" = '--help' ] || [ "$1" = '-help' ]; then
usage
else
while getopts ":hp:ludsno:bcvre" opt; do
case $opt in
h)
usage
;;
p)
PROFILE_PATH=${OPTARG}
;;
l)
PROFILE_PATH='list'
;;
u)
UPDATE='yes'
;;
d)
UPDATE='no'
;;
s)
CONFIRM='no'
;;
n)
SKIPOVERRIDE=true
;;
o)
OVERRIDE=${OPTARG}
;;
b)
BACKUP='single'
;;
c)
COMPARE=true
;;
v)
VIEW=true
;;
e)
ESR=true
;;
r)
tfile="$(download_file 'https://raw.githubusercontent.com/arkenfox/user.js/master/user.js')"
[ -z "${tfile}" ] && echo -e "${RED}Error! Could not download user.js${NC}" && exit 1 # check if download failed
mv "$tfile" "${tfile}.js"
echo -e "${ORANGE}Warning: user.js was saved to temporary file ${tfile}.js${NC}"
open_file "${tfile}.js"
exit 0
;;
\?)
echo -e "${RED}\n Error! Invalid option: -$OPTARG${NC}" >&2
usage
;;
:)
echo -e "${RED}Error! Option -$OPTARG requires an argument.${NC}" >&2
exit 2
;;
esac
done
fi fi
else
echo "Process aborted"
fi fi
show_banner ## change directory back to the original working directory
update_updater "$@" cd "${currdir}"
getProfilePath # updates PROFILE_PATH or exits on error
cd "$PROFILE_PATH" || exit 1
# Check if any files have the owner as root/wheel.
if [ -n "$(find ./ -user 0)" ]; then
printf 'It looks like this script was previously run with elevated privileges,
you will need to change ownership of the following files to your user:\n'
find . -user 0
cd "$CURRDIR"
exit 1
fi
update_userjs
cd "$CURRDIR"

3109
user.js

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="78" height="20"><linearGradient id="b" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="a"><rect width="78" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#a)"><path fill="#555" d="M0 0h47v20H0z"/><path fill="#dfb317" d="M47 0h31v20H47z"/><path fill="url(#b)" d="M0 0h78v20H0z"/></g><g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110"> <text x="245" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">license</text><text x="245" y="140" transform="scale(.1)" textLength="370">license</text><text x="615" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="210">MIT</text><text x="615" y="140" transform="scale(.1)" textLength="210">MIT</text></g> </svg>

Before

Width:  |  Height:  |  Size: 950 B

BIN
wikipiki/backup01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
wikipiki/bullet01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
wikipiki/concurrent01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
wikipiki/concurrent02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
wikipiki/concurrent03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
wikipiki/concurrent04.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

BIN
wikipiki/exceptions01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
wikipiki/exceptions02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
wikipiki/exceptions03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
wikipiki/exclamation.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

BIN
wikipiki/overview01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

BIN
wikipiki/overview02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
wikipiki/overview03.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

BIN
wikipiki/profiles01.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

BIN
wikipiki/profiles02.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB