Compare commits

..

No commits in common. "master" and "v128.0" have entirely different histories.

5 changed files with 463 additions and 478 deletions

15
.gitattributes vendored

@ -1,15 +0,0 @@
* text=auto
*.js text
*.md text
*.yml text
*.sh text
## *.bat text eol=crlf
*.bat -text
*.png binary
.gitattributes export-ignore
*.yml export-ignore
/wiki export-ignore
/.github export-ignore

@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2019-2025 HorlogeSkynet Copyright (c) 2019-2024 HorlogeSkynet
Copyright (c) 2019 dngray Copyright (c) 2019 dngray
Copyright (c) 2019 arkenfox [prev. ghacksuserjs] Copyright (c) 2019 arkenfox [prev. ghacksuserjs]

@ -1,134 +1,134 @@
@ECHO OFF & SETLOCAL DisableDelayedExpansion @ECHO OFF & SETLOCAL DisableDelayedExpansion
TITLE prefs.js cleaner TITLE prefs.js cleaner
REM ## prefs.js cleaner for Windows REM ## prefs.js cleaner for Windows
REM ## /!\ This script is a vendored/adapted version of Arkenfox own prefsCleaner.bat /!\ REM ## /!\ This script is a vendored/adapted version of Arkenfox own prefsCleaner.bat /!\
REM ## author: @claustromaniac REM ## author: @claustromaniac
REM ## version: 2.7 REM ## version: 2.7
CD /D "%~dp0" CD /D "%~dp0"
IF /I "%~1"=="-unattended" (SET _ua=1) IF /I "%~1"=="-unattended" (SET _ua=1)
: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.7 #### ECHO #### v2.7 ####
ECHO ######################################## ECHO ########################################
ECHO: ECHO:
CALL :message "This script should be run from your Thunderbird profile directory." CALL :message "This script should be run from your Thunderbird profile directory."
ECHO It will remove any entries from prefs.js that also exist in user.js. ECHO It will remove any entries from prefs.js that also exist in user.js.
CALL :message "This will allow inactive preferences to be reset to their default values." CALL :message "This will allow inactive preferences to be reset to their default values."
ECHO This Thunderbird profile shouldn't be in use during the process. ECHO This Thunderbird profile shouldn't be in use during the process.
CALL :message "" CALL :message ""
TIMEOUT 1 /nobreak >nul TIMEOUT 1 /nobreak >nul
IF NOT DEFINED _ua ( IF NOT DEFINED _ua (
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]" CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
CLS CLS
IF ERRORLEVEL 3 (EXIT /B) IF ERRORLEVEL 3 (EXIT /B)
IF ERRORLEVEL 2 (GOTO :showhelp) 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 :strlenCheck
CALL :FFcheck CALL :FFcheck
CALL :message "Backing up prefs.js..." CALL :message "Backing up prefs.js..."
FOR /F "delims=" %%# IN ('powershell get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%# FOR /F "delims=" %%# IN ('powershell get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%#
COPY /B /V /Y prefs.js "prefs-backup-%ldt%.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!" CALL :message "All done!"
TIMEOUT 5 >nul TIMEOUT 5 >nul
ENDLOCAL ENDLOCAL
EXIT /B EXIT /B
REM ########## Abort Function ########### REM ########## Abort Function ###########
:abort :abort
CALL :message %1 CALL :message %1
TIMEOUT %~2 >nul TIMEOUT %~2 >nul
EXIT EXIT
REM ########## Message Function ######### REM ########## Message Function #########
:message :message
ECHO: ECHO:
ECHO: %~1 ECHO: %~1
ECHO: ECHO:
GOTO :EOF GOTO :EOF
REM ### string length Check Function #### REM ### string length Check Function ####
:strlenCheck :strlenCheck
SET /a cnt=0 SET /a cnt=0
setlocal ENABLEDELAYEDEXPANSION setlocal ENABLEDELAYEDEXPANSION
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO ( FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
ECHO:%%H >nul ECHO:%%H >nul
SET /a cnt += 1 SET /a cnt += 1
IF /I "%%G" NEQ "!cnt!" ( IF /I "%%G" NEQ "!cnt!" (
ECHO: ECHO:
CALL :message "ERROR: line !cnt! in prefs.js is too long." CALL :message "ERROR: line !cnt! in prefs.js is too long."
(CALL :abort "Aborting ..." 30) (CALL :abort "Aborting ..." 30)
) )
) )
endlocal endlocal
GOTO :EOF GOTO :EOF
REM ####### Thunderbird Check Function ###### REM ####### Thunderbird Check Function ######
:FFcheck :FFcheck
TASKLIST /FI "IMAGENAME eq thunderbird.exe" 2>NUL | FIND /I /N "thunderbird.exe">NUL TASKLIST /FI "IMAGENAME eq thunderbird.exe" 2>NUL | FIND /I /N "thunderbird.exe">NUL
IF NOT ERRORLEVEL 1 ( IF NOT ERRORLEVEL 1 (
CLS CLS
CALL :message "Thunderbird is still running." CALL :message "Thunderbird 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 Thunderbird first!" CALL :message "close Thunderbird first!"
ECHO: ECHO:
PAUSE PAUSE
CLS CLS
CALL :message "Resuming..." CALL :message "Resuming..."
TIMEOUT 5 /nobreak >nul TIMEOUT 5 /nobreak >nul
) )
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 ( FOR /F tokens^=2^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^[^\"']*user_pref[ ]*\([ ]*[\"'][^\"']*[\"'][ ]*," user.js') DO (
IF NOT ""=="%%G" (SET "[%%G]=1") 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" ( IF ""=="%%H" (
ECHO: ECHO:
) ELSE ( ) ELSE (
FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO ( FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO (
IF NOT DEFINED [%%J] (ECHO:%%H) IF NOT DEFINED [%%J] (ECHO:%%H)
) )
) )
) )
)>tempcleanedprefs )>tempcleanedprefs
MOVE /Y tempcleanedprefs prefs.js MOVE /Y tempcleanedprefs prefs.js
GOTO :EOF GOTO :EOF
REM ############### Help ################## REM ############### Help ##################
:showhelp :showhelp
MODE 80,34 MODE 80,34
CLS CLS
CALL :message "This script creates a backup of your prefs.js file before doing anything." CALL :message "This script creates a backup of your prefs.js file before doing anything."
ECHO It should be safe, but you can follow these steps if something goes wrong: ECHO It should be safe, but you can follow these steps if something goes wrong:
ECHO: ECHO:
CALL :message " 1. Make sure Thunderbird is closed." CALL :message " 1. Make sure Thunderbird is closed."
ECHO 2. Delete prefs.js in your profile folder. ECHO 2. Delete prefs.js in your profile folder.
CALL :message " 3. Delete Invalidprefs.js if you have one in the same folder." CALL :message " 3. Delete Invalidprefs.js if you have one in the same folder."
ECHO 4. Rename or copy your latest backup to prefs.js. ECHO 4. Rename or copy your latest backup to prefs.js.
CALL :message " 5. Run Thunderbird and see if you notice anything wrong with it." CALL :message " 5. Run Thunderbird and see if you notice anything wrong with it."
ECHO 6. If you do notice something wrong, especially with your extensions, ECHO 6. If you do notice something wrong, especially with your extensions,
CALL :message " and/or with the UI, go to about:support, and restart Thunderbird with" CALL :message " and/or with the UI, go to about:support, and restart Thunderbird with"
ECHO add-ons disabled. Then, restart it again normally, and see if the 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 thunderbird user.js GitHub repository. ECHO on thunderbird user.js GitHub repository.
ECHO: ECHO:
ECHO: ECHO:
PAUSE PAUSE
CLS CLS
GOTO :begin GOTO :begin
REM ##################################### REM #####################################

@ -1,323 +1,324 @@
@ECHO OFF & SETLOCAL EnableDelayedExpansion @ECHO OFF & SETLOCAL EnableDelayedExpansion
TITLE thunderbird user.js updater TITLE thunderbird user.js updater
REM ## thunderbird user.js updater for Windows REM ## thunderbird user.js updater for Windows
REM ## /!\ This script is a vendored/adapted version of Arkenfox own updater.bat /!\ REM ## /!\ This script is a vendored/adapted version of Arkenfox own updater.bat /!\
REM ## author: @claustromaniac REM ## author: @claustromaniac
REM ## version: 4.19 REM ## version: 4.19
REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows
SET v=4.19 SET v=4.19
VERIFY ON VERIFY ON
CD /D "%~dp0" 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)
IF /I "%~1"=="-log" (SET _log=1) IF /I "%~1"=="-log" (SET _log=1)
IF /I "%~1"=="-logp" (SET _log=1 & SET _logp=1) IF /I "%~1"=="-logp" (SET _log=1 & SET _logp=1)
IF /I "%~1"=="-multioverrides" (SET _multi=1) 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) 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 ( FOR /F %%i IN ('PowerShell -Command "[Enum]::GetNames([Net.SecurityProtocolType]) -contains 'Tls12'"') DO (
IF "%%i" == "False" ( IF "%%i" == "False" (
CALL :message "Your PowerShell version doesn't support TLS1.2 ^!" CALL :message "Your PowerShell version doesn't support TLS1.2 ^!"
ECHO: Instructions to update PowerShell are on the arkenfox wiki ECHO: Instructions to update PowerShell are on the arkenfox wiki
PAUSE PAUSE
EXIT 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 and *.bat.old scripts
REM * Begin the normal routine REM * Begin the normal routine
FC "[updated]!_myname!.bat" "!_myname!.bat.old" >nul FC "[updated]!_myname!.bat" "!_myname!.bat.old" >nul
IF NOT "!errorlevel!"=="0" ( IF NOT "!errorlevel!"=="0" (
CALL :message "Script updated to version !v!" CALL :message "Script updated to version !v!"
TIMEOUT 3 >nul 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 "!_myname!.bat.old" "[updated]!_myname!.bat.old"
GOTO begin GOTO begin
) )
REM ## Phase 1 ## REM ## Phase 1 ##
REM * Download new batch and name it [updated]*.bat REM * Download new batch and name it [updated]*.bat
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 out the PowerShell call for testing.
REM COPY /B /Y "!_myname!.bat" "[updated]!_myname!.bat" >nul REM COPY /B /Y "!_myname!.bat" "[updated]!_myname!.bat" >nul
CALL :psdownload https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/updater.bat "[updated]!_myname!.bat" CALL :psdownload https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/updater.bat "[updated]!_myname!.bat"
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 (
CALL :message "Failed. Make sure PowerShell is allowed internet access." CALL :message "Failed. Make sure PowerShell is allowed internet access."
TIMEOUT 120 >nul TIMEOUT 120 >nul
) )
) ELSE ( ) ELSE (
IF "!_myname!"=="[updated]" ( IF "!_myname!"=="[updated]" (
CALL :message "The [updated] label is reserved. Rename this script and try again." CALL :message "The [updated] label is reserved. Rename this script and try again."
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 * Rename the old script and make a copy of itself with the original name.
REM * Run that copy in a new CMD instance REM * Run that copy 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" ( REN "!_myname:~9!.bat" "!_myname:~9!.bat.old" )
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat" COPY /B /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:
ECHO: 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: #### v!v! ####
ECHO: ######################################## ECHO: ########################################
ECHO: ECHO:
SET /A "_line=0" SET /A "_line=0"
IF NOT EXIST user.js ( IF NOT EXIST user.js (
CALL :message "user.js not detected in the current directory." CALL :message "user.js not detected in the current directory."
) ELSE ( ) ELSE (
FOR /F "skip=1 tokens=1,* delims=:" %%G IN (user.js) DO ( FOR /F "skip=1 tokens=1,* delims=:" %%G IN (user.js) DO (
SET /A "_line+=1" SET /A "_line+=1"
IF !_line! GEQ 4 (GOTO exitloop) IF !_line! GEQ 4 (GOTO exitloop)
IF !_line! EQU 1 (SET _name=%%H) IF !_line! EQU 1 (SET _name=%%H)
IF !_line! EQU 2 (SET _date=%%H) IF !_line! EQU 2 (SET _date=%%H)
IF !_line! EQU 3 (SET _version=%%H) IF !_line! EQU 3 (SET _version=%%G)
) )
:exitloop :exitloop
IF NOT "!_name!"=="" ( IF NOT "!_name!"=="" (
SET "_tempvar=" SET "_tempvar="
IF /I NOT "!_name!"=="!_name:thunderbird=!" SET _tempvar=1 IF /I NOT "!_name!"=="!_name:ghacks=!" SET _tempvar=1
IF !_tempvar! EQU 1 ( IF /I NOT "!_name!"=="!_name:arkenfox=!" SET _tempvar=1
CALL :message "!_name! !_version:~2!,!_date!" IF !_tempvar! EQU 1 (
) ELSE (CALL :message "Current user.js version not recognised.") 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.")
ECHO: )
IF NOT DEFINED _ua ( ECHO:
CALL :message "This batch should be run from your Thunderbird profile directory." IF NOT DEFINED _ua (
ECHO: It will download the latest version of thunderbird user.js from github and then CALL :message "This batch should be run from your Thunderbird profile directory."
CALL :message "append any of your own changes from user-overrides.js to it." ECHO: It will download the latest version of thunderbird user.js from github and then
CALL :message "Visit the wiki for more detailed information." CALL :message "append any of your own changes from user-overrides.js to it."
ECHO: CALL :message "Visit the wiki for more detailed information."
TIMEOUT 1 /nobreak >nul ECHO:
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]" TIMEOUT 1 /nobreak >nul
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 DEFINED _log ( )
CALL :log >>user.js-update-log.txt 2>&1 IF DEFINED _log (
IF DEFINED _logp (START user.js-update-log.txt) CALL :log >>user.js-update-log.txt 2>&1
EXIT /B IF DEFINED _logp (START user.js-update-log.txt)
:log EXIT /B
SET _log=2 :log
ECHO:################################################################## SET _log=2
ECHO: %date%, %time% ECHO:##################################################################
) ECHO: %date%, %time%
IF EXIST user.js.new (DEL /F "user.js.new") )
CALL :message "Retrieving latest user.js file from github repository..." IF EXIST user.js.new (DEL /F "user.js.new")
CALL :psdownload https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/user.js "user.js.new" CALL :message "Retrieving latest user.js file from github repository..."
IF EXIST user.js.new ( CALL :psdownload https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/user.js "user.js.new"
IF DEFINED _esr ( IF EXIST user.js.new (
CALL :message "Activating ESR section..." IF DEFINED _esr (
CALL :activate user.js.new ".x still uses all the following prefs" CALL :message "Activating ESR section..."
) CALL :activate user.js.new ".x still uses all the following prefs"
IF DEFINED _multi ( )
FORFILES /P user.js-overrides /M *.js >nul 2>&1 IF DEFINED _multi (
IF NOT ERRORLEVEL 1 ( FORFILES /P user.js-overrides /M *.js >nul 2>&1
IF DEFINED _merge ( IF NOT ERRORLEVEL 1 (
CALL :message "Merging..." IF DEFINED _merge (
COPY /B /Y user.js-overrides\*.js user-overrides-merged.js CALL :message "Merging..."
CALL :merge user-overrides-merged.js COPY /B /Y user.js-overrides\*.js user-overrides-merged.js
COPY /B /Y user.js.new+user-overrides-merged.js user.js.new CALL :merge user-overrides-merged.js
CALL :merge user.js.new COPY /B /Y user.js.new+user-overrides-merged.js user.js.new
) ELSE ( CALL :merge user.js.new
CALL :message "Appending..." ) ELSE (
COPY /B /Y user.js.new+"user.js-overrides\*.js" user.js.new CALL :message "Appending..."
) COPY /B /Y user.js.new+"user.js-overrides\*.js" user.js.new
) ELSE (CALL :message "No override files found.") )
) ELSE ( ) ELSE (CALL :message "No override files found.")
IF EXIST "user-overrides.js" ( ) ELSE (
COPY /B /Y user.js.new+"user-overrides.js" "user.js.new" IF EXIST "user-overrides.js" (
IF DEFINED _merge ( COPY /B /Y user.js.new+"user-overrides.js" "user.js.new"
CALL :message "Merging user-overrides.js..." IF DEFINED _merge (
CALL :merge user.js.new CALL :message "Merging user-overrides.js..."
) ELSE ( CALL :merge user.js.new
CALL :message "user-overrides.js appended." ) ELSE (
) CALL :message "user-overrides.js appended."
) ELSE (CALL :message "user-overrides.js not found.") )
) ) ELSE (CALL :message "user-overrides.js not found.")
IF EXIST user.js ( )
FC user.js.new user.js >nul && SET "_changed=false" || SET "_changed=true" IF EXIST user.js (
) FC user.js.new user.js >nul && SET "_changed=false" || SET "_changed=true"
IF "!_changed!"=="true" ( )
CALL :message "Backing up..." IF "!_changed!"=="true" (
IF DEFINED _singlebackup ( CALL :message "Backing up..."
MOVE /Y user.js user.js.bak >nul IF DEFINED _singlebackup (
) ELSE ( MOVE /Y user.js user.js.bak >nul
FOR /F "delims=" %%# IN ('powershell get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%# ) ELSE (
MOVE /Y user.js "user-backup-!ldt!.js" >nul FOR /F "delims=" %%# IN ('powershell get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%#
) MOVE /Y user.js "user-backup-!ldt!.js" >nul
REN user.js.new user.js )
CALL :message "Update complete." REN user.js.new user.js
) ELSE ( CALL :message "Update complete."
IF "!_changed!"=="false" ( ) ELSE (
DEL /F user.js.new >nul IF "!_changed!"=="false" (
CALL :message "Update completed without changes." DEL /F user.js.new >nul
) ELSE ( CALL :message "Update completed without changes."
REN user.js.new user.js ) ELSE (
CALL :message "Update complete." REN user.js.new user.js
SET "_changed=true" CALL :message "Update complete."
) SET "_changed=true"
) )
) ELSE ( )
CALL :message "Update failed. Make sure PowerShell is allowed internet access." ) ELSE (
ECHO: No changes were made. CALL :message "Update failed. Make sure PowerShell is allowed internet access."
) ECHO: No changes were made.
IF NOT DEFINED _log ( )
IF NOT DEFINED _ua ( IF NOT DEFINED _log (
IF EXIST prefsCleaner.bat ( IF NOT DEFINED _ua (
IF "!_changed!"=="true" ( IF EXIST prefsCleaner.bat (
CALL :message "Would you like to run the prefsCleaner now?" IF "!_changed!"=="true" (
CHOICE /C YN /N /M "(Y/N) " CALL :message "Would you like to run the prefsCleaner now?"
IF "1"=="!errorlevel!" ( START "" cmd.exe /C "prefsCleaner.bat" ) CHOICE /C YN /N /M "(Y/N) "
) ELSE (PAUSE) IF "1"=="!errorlevel!" ( START "" cmd.exe /C "prefsCleaner.bat" )
) ELSE (PAUSE) ) ELSE (PAUSE)
) ) ELSE (PAUSE)
) )
EXIT /B )
EXIT /B
::::::::::::::: Message :::::::::::::::
:message ::::::::::::::: Message :::::::::::::::
SETLOCAL DisableDelayedExpansion :message
IF NOT "2"=="%_log%" (ECHO:) SETLOCAL DisableDelayedExpansion
ECHO: %~1 IF NOT "2"=="%_log%" (ECHO:)
IF NOT "2"=="%_log%" (ECHO:) ECHO: %~1
ENDLOCAL IF NOT "2"=="%_log%" (ECHO:)
GOTO :EOF ENDLOCAL
GOTO :EOF
::::::::::::::: Download :::::::::::::::
:psdownload ::::::::::::::: Download :::::::::::::::
( :psdownload
PowerShell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('%~1', '%~2')" (
) >nul 2>&1 PowerShell -Command "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; (New-Object Net.WebClient).DownloadFile('%~1', '%~2')"
GOTO :EOF ) >nul 2>&1
GOTO :EOF
::::::::::::::: Activate Section :::::::::::::::
:activate ::::::::::::::: Activate Section :::::::::::::::
:: arg1 = file :activate
:: arg2 = line substring :: arg1 = file
SETLOCAL DisableDelayedExpansion :: arg2 = line substring
( SETLOCAL DisableDelayedExpansion
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" "%~1"') DO ( (
SET "_temp=%%H" FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" "%~1"') DO (
SETLOCAL EnableDelayedExpansion SET "_temp=%%H"
IF "!_temp:%~2=!"=="!_temp!" ( SETLOCAL EnableDelayedExpansion
ENDLOCAL & ECHO:%%H IF "!_temp:%~2=!"=="!_temp!" (
) ELSE ( ENDLOCAL & ECHO:%%H
ECHO://!_temp:~2! ) ELSE (
ENDLOCAL ECHO://!_temp:~2!
) ENDLOCAL
) )
)>updatertempfile )
MOVE /Y updatertempfile "%~1" >nul )>updatertempfile
ENDLOCAL MOVE /Y updatertempfile "%~1" >nul
GOTO :EOF ENDLOCAL
GOTO :EOF
::::::::::::::: Merge :::::::::::::::
:merge ::::::::::::::: Merge :::::::::::::::
SETLOCAL DisableDelayedExpansion :merge
FOR /F tokens^=2^,^*^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^user_pref[ ]*\([ ]*[\"'].*[\"'][ ]*,.*\)[ ]*;" "%~1"') DO (SET "[%%G]=%%H") SETLOCAL DisableDelayedExpansion
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 /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=1,* delims=:" %%I IN ('FINDSTR /N "^" "%~1"') DO ( (
SET "_temp=%%J" FOR /F "tokens=1,* delims=:" %%I IN ('FINDSTR /N "^" "%~1"') DO (
SETLOCAL EnableDelayedExpansion SET "_temp=%%J"
IF NOT "!_temp:~0,9!"=="user_pref" ( SETLOCAL EnableDelayedExpansion
ENDLOCAL & ECHO:%%J IF NOT "!_temp:~0,9!"=="user_pref" (
) ELSE ( ENDLOCAL & ECHO:%%J
IF "!_temp:;=!"=="!_temp!" ( ) ELSE (
ENDLOCAL & ECHO:%%J IF "!_temp:;=!"=="!_temp!" (
) ELSE ( ENDLOCAL & ECHO:%%J
ENDLOCAL ) ELSE (
FOR /F tokens^=2^ delims^=^'^" %%K IN ("%%J") DO ( ENDLOCAL
IF NOT "_user.js.parrot"=="%%K" ( FOR /F tokens^=2^ delims^=^'^" %%K IN ("%%J") DO (
IF DEFINED __unset__%%K ( IF NOT "_user.js.parrot"=="%%K" (
ECHO://%%J IF DEFINED __unset__%%K (
) ELSE ( ECHO://%%J
IF DEFINED [%%K] ( ) ELSE (
SETLOCAL EnableDelayedExpansion IF DEFINED [%%K] (
FOR /F "delims=" %%L IN ("![%%K]!") DO ( SETLOCAL EnableDelayedExpansion
ENDLOCAL & ECHO:user_pref("%%K"%%L FOR /F "delims=" %%L IN ("![%%K]!") DO (
SET "[%%K]=" ENDLOCAL & ECHO:user_pref("%%K"%%L
) SET "[%%K]="
) )
) )
) ELSE (ECHO:%%J) )
) ) ELSE (ECHO:%%J)
) )
) )
) )
)>updatertempfile )
MOVE /Y updatertempfile "%~1" >nul )>updatertempfile
ENDLOCAL MOVE /Y updatertempfile "%~1" >nul
GOTO :EOF ENDLOCAL
GOTO :EOF
::::::::::::::: Help :::::::::::::::
:showhelp ::::::::::::::: Help :::::::::::::::
MODE 80,54 :showhelp
CLS MODE 80,54
CALL :message "Available arguments (case-insensitive):" CLS
CALL :message " -esr" CALL :message "Available arguments (case-insensitive):"
ECHO: Activate ESR related preferences CALL :message " -esr"
CALL :message " -log" ECHO: Activate ESR related preferences
ECHO: Write the console output to a logfile (user.js-update-log.txt) CALL :message " -log"
CALL :message " -logP" ECHO: Write the console output to a logfile (user.js-update-log.txt)
ECHO: Like -log, but also open the logfile after updating. CALL :message " -logP"
CALL :message " -merge" ECHO: Like -log, but also open the logfile after updating.
ECHO: Merge overrides instead of appending them. Single-line comments and CALL :message " -merge"
ECHO: _user.js.parrot lines are appended normally. Overrides for inactive ECHO: Merge overrides instead of appending them. Single-line comments and
ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used ECHO: _user.js.parrot lines are appended normally. Overrides for inactive
ECHO: together, a user-overrides-merged.js file is also generated in the root ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used
ECHO: directory for quick reference. It contains only the merged data from ECHO: together, a user-overrides-merged.js file is also generated in the root
ECHO: override files and can be safely discarded after updating, or used as the ECHO: directory for quick reference. It contains only the merged data from
ECHO: new user-overrides.js. When there are conflicting records for the same ECHO: override files and can be safely discarded after updating, or used as the
ECHO: pref, the value of the last one declared will be used. Visit the wiki ECHO: new user-overrides.js. When there are conflicting records for the same
ECHO: for usage examples and more detailed information. ECHO: pref, the value of the last one declared will be used. Visit the wiki
CALL :message " -multiOverrides" ECHO: for usage examples and more detailed information.
ECHO: Use any and all .js files in a user.js-overrides sub-folder as overrides CALL :message " -multiOverrides"
ECHO: instead of the default user-overrides.js file. Files are appended in ECHO: Use any and all .js files in a user.js-overrides sub-folder as overrides
ECHO: alphabetical order. ECHO: instead of the default user-overrides.js file. Files are appended in
CALL :message " -unattended" ECHO: alphabetical order.
ECHO: Run without user input. CALL :message " -unattended"
CALL :message " -singleBackup" ECHO: Run without user input.
ECHO: Use a single backup file and overwrite it on new updates, instead of CALL :message " -singleBackup"
ECHO: cumulative backups. This was the default behaviour before v4.3. ECHO: Use a single backup file and overwrite it on new updates, instead of
CALL :message " -updateBatch" ECHO: cumulative backups. This was the default behaviour before v4.3.
ECHO: Update the script itself on execution, before the normal routine. CALL :message " -updateBatch"
CALL :message "" ECHO: Update the script itself on execution, before the normal routine.
PAUSE CALL :message ""
MODE 80,25 PAUSE
GOTO :begin MODE 80,25
GOTO :begin

@ -1023,7 +1023,7 @@ user_pref("network.http.referer.XOriginPolicy", 2);
* When set to a valid, working value that matches your "network.trr.uri" (0712) Thunderbird * When set to a valid, working value that matches your "network.trr.uri" (0712) Thunderbird
* won't use the system DNS. If the IP doesn't match then DoH won't work ***/ * won't use the system DNS. If the IP doesn't match then DoH won't work ***/
// user_pref("network.trr.bootstrapAddr", "10.0.0.1"); // [HIDDEN PREF] // user_pref("network.trr.bootstrapAddr", "10.0.0.1"); // [HIDDEN PREF]
/* 5590: show a prompt when opening a link in external applications [SETUP-CHROME] ***/ /* 5590: show a prompt when opening a link in external applications ***/
user_pref("security.external_protocol_requires_permission", true); user_pref("security.external_protocol_requires_permission", true);
/*** [SECTION 6000]: DON'T TOUCH ***/ /*** [SECTION 6000]: DON'T TOUCH ***/
@ -1300,10 +1300,9 @@ user_pref("mailnews.display.date_senders_timezone", false);
* "Received" header. Set the following preference. New messages will show the time the message * "Received" header. Set the following preference. New messages will show the time the message
* was received, rather than when it was sent. ***/ * was received, rather than when it was sent. ***/
// user_pref("mailnews.use_received_date", true); // user_pref("mailnews.use_received_date", true);
/* 9126: Prevent any MUA information leakage through User-Agent header in outgoing email messages /* 9126: Send minimal User-Agent in outgoing email messages (default) */
* [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1114475 ***/ user_pref("mailnews.headers.sendUserAgent", true);
user_pref("mailnews.headers.sendUserAgent", false); user_pref("mailnews.headers.useMinimalUserAgent", true);
// user_pref("mailnews.headers.useMinimalUserAgent", true);
/** ADDRESS BOOK ***/ /** ADDRESS BOOK ***/
/* 9130: Address book collection [SETUP-FEATURE] /* 9130: Address book collection [SETUP-FEATURE]