Compare commits

...

163 Commits

Author SHA1 Message Date
Samuel FORESTIER
2b839ae6ca [META] Updates copyrights for 2025 2025-01-05 15:01:56 +01:00
Samuel FORESTIER
7f75658282 Adds SETUP-CHROME tag to 5590 (see #31)
Co-Authored-By: Daniel Rudolf <github.com@daniel-rudolf.de>
2025-01-05 15:01:24 +01:00
Samuel FORESTIER
eec031aa69 Prevents MUA information leakage through User-Agent header
> closes #60
2024-11-16 12:13:33 +01:00
Samuel FORESTIER
8e9bc01c00 Adds (adapted) upstream .gitattributes 2024-11-09 16:30:25 +01:00
Phong Tran
4d986fffc6 Add thunderbird as recognized version 2024-11-09 15:15:06 +00:00
Phong Tran
8f7158ebe2 Convert scripts to dos CRLF 2024-11-09 15:15:06 +00:00
Samuel FORESTIER
b6d6d1564b Bumps to 128.0 2024-11-07 21:24:00 +01:00
Samuel FORESTIER
6183dda54a Vendors Arkenfox updater/prefsCleaner scripts
Also see related : arkenfox/user.js#910

> closes #1, #10, #29, #35 and #41
2024-11-07 20:21:24 +00:00
Samuel FORESTIER
b814b88b93 Applies Arkenfox v115.1..v128.0 migration 2024-11-07 20:21:24 +00:00
Samuel FORESTIER
5d33d6b50e Fixes ESLint configuration filename in GitHub pull request template 2024-11-07 20:21:24 +00:00
Samuel FORESTIER
100b5537e9 Resets mail.showCondensedAddresses (9111) as it's disabled by default 2024-11-07 20:21:24 +00:00
Samuel FORESTIER
55cf3041a7 Adds preferences from TB 128 ESR mailnews.js 2024-11-07 20:21:24 +00:00
boredsquirrel
824edabe63
Enforces secure auto-configuration and fetching from Exchange (#50)
This patch enforces `mailnews.auto_config.fetchFromISP.sslOnly` and resets `mailnews.auto_config.fetchFromExchange.enabled` to allow fetching from Exchange servers when auto-configuration is enabled.

It also resets two auto-configuration URL preferences as doing so prevented users from re-enabling this feature.

Co-authored-by: Samuel FORESTIER <samuel+dev@forestier.app>
2024-07-09 19:47:44 +00:00
boredsquirrel
48529d1963
Enables sending HTML emails and "resume from crash" (#49)
This patch re-allows users to send HTML emails (when needed).

It also re-enables "resume from crash" (`browser.sessionstore.resume_from_crash`) and resets `calendar.extract.service.enabled` (already disabled by default).

Co-authored-by: Samuel FORESTIER <samuel+dev@forestier.app>
2024-07-09 19:36:44 +00:00
boredsquirrel
c6fef1356e
Enables project notes (start page) (#52)
This is to show (by default) update notifications, and allow users to check changelog.

Co-authored-by: Samuel FORESTIER <samuel+dev@forestier.app>
2024-07-09 18:53:26 +00:00
Samuel FORESTIER
ebeb8cf3fb Updates GitHub Actions to v4 to address Node.js 16 deprecation 2024-04-24 23:32:01 +02:00
Samuel FORESTIER
ee7649a8b4 Migrates ESLint configuration to new (9+) "flat format" 2024-04-24 23:28:00 +02:00
Samuel FORESTIER
7390a8056c [META] Updates copyrights for 2024 2024-04-24 23:28:00 +02:00
Samuel FORESTIER
e6c5df30f2 Disables ESLint "flat configuration" format 2024-04-21 21:47:04 +02:00
Samuel FORESTIER
ad0cac10b2 Mentions RFP breaks mozAddonManager integration (AMO/ATN)
It appears that re-enabling JavaScript is also required. See wiki page :
<https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/4.1-Extensions#installing-extensions-from-amo-atn>

> closes #43
2024-04-21 20:29:29 +02:00
Samuel FORESTIER
d6b18302e4 Bumps to v115.0 2023-11-18 15:02:30 +01:00
Samuel FORESTIER
ee80afc278 Prevents donation appeal page opening on fresh profiles unconditionally 2023-11-18 13:57:45 +00:00
Samuel FORESTIER
3996c279fd Enforces datareporting.policy.dataSubmissionPolicyBypassNotification
to completely disable telemetry (by preventing new data submission)
2023-11-18 13:57:45 +00:00
Samuel FORESTIER
088da14f7e Applies Arkenfox v102.1..v115.1 migration 2023-11-18 13:57:45 +00:00
Samuel FORESTIER
87b0d325e2 Revert "Workaround ETP Strict Mode lack of support in 102"
This reverts commit d8d79d6c84d24fc9c9ca6ad72e1f5625e0c66309.
2023-11-18 13:57:45 +00:00
Samuel FORESTIER
5a59c1b7e7 Enforces mail.html_sanitize.drop_conditional_css (TB 78 ESR) 2023-11-18 13:57:45 +00:00
Samuel FORESTIER
167ddc02be Removes preferences related to charset dropped in ESR 78 2023-11-18 13:57:45 +00:00
Samuel FORESTIER
8bd612fd82 Adds preferences from TB 115 ESR mailnews.js 2023-11-18 13:57:45 +00:00
Samuel FORESTIER
fc144d3cb1 Fixes related project repository link
> closes #38
2023-09-14 09:57:47 +02:00
Samuel FORESTIER
ac8a715b06 Adds missing semi-colon in reset mail.rights.version 2023-07-15 19:13:06 +02:00
Samuel FORESTIER
439e5b5e7d Adds mail.inline_attachments.text to template
This preference controls whether "text attachments" (e.g. CSV, HTML or even plain text) should **also** be directly rendered in message body.

> see #35
2023-07-15 19:03:42 +02:00
Samuel FORESTIER
07d26c7881 Resets mail.SpellCheckBeforeSend
> see #35
2023-07-15 18:56:50 +02:00
Samuel FORESTIER
d2283b8c91 Bumps to v102.2 2023-03-06 18:46:48 +01:00
Samuel FORESTIER
32afc0b38d Removes duplicate network.cookie.lifetimePolicy
This commit is a follow-up for d8d79d6c, where we re-introduced this
preference, during a (partial) revert, to workaround the lack of strict
ETP support.

> closes #33
2023-03-02 18:51:00 +01:00
Samuel FORESTIER
32663905d0 Adds mail.compose.warned_about_customize_from preference to template 2023-02-28 17:13:11 +01:00
Samuel FORESTIER
4f5cde426c Resets signon.rememberSignons preference to let the user choose
By disabling this preference, we prevented Thunderbird from even asking
whether passwords of new setup mail accounts should be saved or not.
This could be pretty confusing and not handy for daily usage.

Users with _specific_ needs can still unconditionally disable passwords
saving by uncommenting `5003`.

> closes #30

Co-Authored-By: atomGit <atomGit@users.noreply.github.com>
2022-11-27 15:36:16 +01:00
Samuel FORESTIER
cc6cab6525 Restores security.cert_pinning.enforcement_level note about PM Bridge
It has been silently dropped during 5342ec1 (v78 -> v91 Arkenfox migration).
2022-10-22 17:01:54 +02:00
Samuel FORESTIER
eba6bc4dea Bumps to v102.1 2022-10-02 11:23:04 +02:00
Samuel FORESTIER
d8d79d6c84 Workaround ETP Strict Mode lack of support in 102
In #24, we wrongly assumed that ETP Strict Mode was available in TB 102 (as it was for FF 102).

This patch aims to workaround this (security) issue by :

* Re-enabling FPI ;
* Re-enabling DNT header ;
* Restoring `network.cookie.cookieBehavior` tweak ;
* Re-enabling ETP with custom settings (including query parameter stripping) ;
* Re-dealing with persistent storage-related preferences (`2700`).

This increases divergence with Arkenfox upstream template.

> see #27
2022-10-02 09:18:05 +00:00
Samuel FORESTIER
494f684d74 Adds mail.openpgp.remind_encryption_possible (TB 102.2+) 2022-10-01 17:43:15 +02:00
Samuel FORESTIER
8970a6fda1 Removes privacy.userContext.newTabContainerOnLeftClick.enabled
It appears this preference has never been implemented in Thunderbird.
2022-10-01 16:22:28 +02:00
Samuel FORESTIER
08713b3ea9 Resets mail.biff.alert.* back to default values
Let's leave new email alert preferences to their default values, but note that they may be appreciated in some environments.

> See #27
2022-10-01 11:18:23 +02:00
Samuel FORESTIER
a3a5c4ad86 Bumps to v102.0 2022-09-28 20:51:45 +02:00
Samuel FORESTIER
6798bda078
Merge pull request #24 from thunderbird/esr_102 2022-09-28 18:47:43 +00:00
Samuel FORESTIER
c1e6a54f75 Bumps to v102.0-beta2 2022-09-10 17:28:00 +02:00
Samuel FORESTIER
0dcc49687f Enforces mailnews.message_display.disable_remote_image 2022-09-10 17:27:55 +02:00
Samuel FORESTIER
0ccd0c0e99 Enforces mail.compose.add_link_preview 2022-09-10 17:27:50 +02:00
Samuel FORESTIER
d778e6d7b6 Adds corresponding SETTING tag for mail.default_send_format 2022-09-10 14:20:05 +02:00
Samuel FORESTIER
902231ecf0 Restores two preferences in section 2700
`privacy.antitracking.enableWebcompat` & `privacy.partition.serviceWorkers` are actually present in TB ESR 102.
2022-09-10 14:19:29 +02:00
Samuel FORESTIER
ea3c48a7a9 Leaves app.use_without_mail_account disabled not to hide emails UI
> See <https://searchfox.org/comm-esr102/rev/d9800535d0b488462c8ae64f7fe6647cc42535e1/mail/base/content/msgMail3PaneWindow.js#714-722>

Co-Authored-By: Dupond <Dupond@users.noreply.github.com>
2022-09-03 10:00:56 +02:00
Samuel FORESTIER
f885b50de5 Removes unnecessary leading spaces in some documentation lines 2022-08-24 10:22:54 +02:00
Samuel FORESTIER
255ccd84ae Applies Arkenfox v102.0..v102.1 migration 2022-08-24 10:22:53 +02:00
Samuel FORESTIER
0abbda8e39 Adds mail.biff.show_alert and mail.biff.alert.show_* preferences 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
03c86462d8 Disables new calendar.extract.service.enabled preference 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
838529ffbd Cleans outdated 0300 section documentation (related to auto-install) 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
5387c41c91 Gets rid of mail.calendar-integration.opt-out (removed in TB 68 ESR) 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
22efe76834 Gets rid of calendar.useragent.extra (removed in TB 78 ESR) 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
fdcaf8570b Adds mail.biff.use_new_count_in_badge to template (left to default) 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
5caedc08de Switches to mail.default_send_format to send plaintext email (v101)
Thunderbird 101 replaced legacy `mail.default_html_action` and
`mailnews.sendformat.auto_downgrade` by `mail.default_send_format` new
preference to choose email sending format.

Whereas a proper "migration" is performed on first start, we stick to
plaintext email enforcement in this template, as done before.

See <https://bugzilla.mozilla.org/show_bug.cgi?id=1727493>.

> see #21
2022-08-24 10:22:36 +02:00
Samuel FORESTIER
5a787eb8ce Adds mail.compose.warn_public_recipients.* preferences
* Adds `mail.compose.warn_public_recipients.threshold` with its default value
* Enables `mail.compose.warn_public_recipients.aggressive` to show an alert if previous setting warning has not be addressed (v93+)
2022-08-24 10:22:36 +02:00
Samuel FORESTIER
39aaee7fa3 Allows Thunderbird to be used without any configured email account (v93) 2022-08-24 10:22:36 +02:00
Samuel FORESTIER
4dc99eb87f Applies Arkenfox v91..v102 migration
> **WORK IN PROGRESS FOR ESR 102 : DO NOT USE IT AS IS**

Migration status :
    * updated README
    * updated header
    * updated index
    * updated sections
2022-08-24 10:22:35 +02:00
Samuel FORESTIER
e95dc540c9 [META] Bumps to v91.2 2022-08-24 10:10:01 +02:00
Samuel FORESTIER
6c5d84bc89 Leaves mail.tabs.autoHide to its default value (disabled)
This preference is strictly _personal_ and should not be enforced in the
template.

> see #21
> closes #25
2022-08-24 10:09:15 +02:00
Samuel FORESTIER
db12db282f Improves permissions.memory_only preference documentation
* Replaces `NOTE` tag by a proper `SETUP-CHROME` as it affects Thunderbird runtime behavior
* Mentions that reading from disk gets disabled too
* Mentions that "remote mail content" permissions are also affected

> see #23
2022-07-18 19:56:56 +02:00
Samuel FORESTIER
f8466f15dd When "HTML" literal is used in documentation, prefers its uppercase form
This will simplify lookups when case-sensitivity matching is enabled.
2022-06-11 12:20:49 +02:00
Samuel FORESTIER
68628a397a [META] Bumps to v91.1 2022-05-25 09:06:16 +02:00
Samuel FORESTIER
fb31ebb304 Prefers "personal" section (9000) for mail.compose.other.header pref
> followup for e5fdab03ee2417c80a3b2c9f206c6aa9ec787a67.
2022-05-25 09:05:55 +02:00
Samuel FORESTIER
50afdb9a57 Enforces mail.suppress_content_language & mail.sanitize_date_header
> closes #19
2022-05-23 18:49:57 +02:00
Samuel FORESTIER
5c59028af9 Adds a note about empty User-Agent breaking Microsoft Exchange OAuth2
> See #19.
2022-05-23 17:06:03 +02:00
Samuel FORESTIER
e5fdab03ee Adds mail.compose.other.header preference to template
> See #19.
2022-05-23 16:59:43 +02:00
Samuel FORESTIER
f45c0a3d75 [CI] Bumps actions/checkout and actions/setup-node to v3 2022-04-23 11:52:24 +02:00
Samuel FORESTIER
c4172ac672 [META] Bumps to v91.0 2022-04-18 16:47:32 +02:00
Samuel FORESTIER
e8f584b901
Merge pull request #15 from thunderbird/esr_91
* Apply Arkenfox `v78..v91` migration
* Global update for v91 ESR
* `[SETTING]` tags global cleanup
* Enable `mailnews.sendformat.auto_downgrade` preference
* Add `mail.phishing.detection.*` preferences
* Remove Autocrypt and Enigmail addons preferences
* Enforce `mail.phishing.detection.*` preferences
* Add `security.osclientcerts.autoload` preference
* Show a prompt when opening a link in external applications as hardening
* Higher `mail.compose.big_attachments.threshold_kb` to 9220KB
* Hide sensitive information from chat desktop notifications (if enabled)
* Clean removed `mail.cloud_files.inserted_urls.footer.link` preference
2022-04-18 13:46:38 +00:00
Samuel FORESTIER
9b7b22420d Cleans removed mail.cloud_files.inserted_urls.footer.link preference 2022-02-13 13:01:30 +01:00
Samuel FORESTIER
8719ad5a37 Hides sensitive information from chat desktop notifications (if enabled) 2022-02-13 13:00:15 +01:00
Samuel FORESTIER
7ffec7ed57 Highers mail.compose.big_attachments.threshold_kb to 9220KB 2022-02-13 12:54:05 +01:00
Samuel FORESTIER
2d82b7cc0c Shows a prompt when opening a link in external applications as hardening 2022-02-13 12:50:38 +01:00
Samuel FORESTIER
c41232b1c3 Adds security.osclientcerts.autoload preference (left to default) 2022-02-13 12:44:18 +01:00
Samuel FORESTIER
c96eed17c0 Enforces mail.phishing.detection.* preferences 2022-01-08 17:55:30 +01:00
Samuel FORESTIER
616c2b1553 Removes Autocrypt and Enigmail addons preferences
> Rationale : Thunderbird 78+ has builtin OpenPGP support for e-mail encryption.
2022-01-08 17:42:02 +01:00
Samuel FORESTIER
fc22408d19 Fixes mailnews.sendformat.auto_downgrade wrongly left disabled 2022-01-08 17:24:34 +01:00
Samuel FORESTIER
1196a9ce4f Removes and fixes [SETTING] tags according to what is available in UI 2022-01-08 17:22:44 +01:00
Samuel FORESTIER
714fd1898f Merge branch 'master' into thunderbird/esr_91 2021-12-14 14:39:32 +01:00
Samuel FORESTIER
dcf351aa96 [META] Bumps to v78.1 2021-12-14 14:24:28 +01:00
Samuel FORESTIER
de8048fea6 Don't clear mail.collect_addressbook pref (feature already disabled)
> see #17
2021-12-14 14:24:05 +01:00
Samuel FORESTIER
3580cfd3c4 Fixes privacy.sanitize.sanitizeOnShutdown pref getting ignored
> closes #16

Co-Authored-By: atomGit <atomgit@users.noreply.github.com>
2021-12-14 10:51:48 +01:00
Samuel FORESTIER
c54c059011 Removes four leading spaces 2021-10-31 09:42:26 +01:00
Samuel FORESTIER
a492b510df Applies v91.0..v91.1 Arkenfox upstream changes 2021-10-30 11:33:39 +02:00
Samuel FORESTIER
f7788b2c8a Disables very buggy mail.password_protect_local_cache pref. by default 2021-10-17 18:54:35 +02:00
Samuel FORESTIER
ac43ee758d [META] Updates header date 2021-10-17 18:39:32 +02:00
Samuel FORESTIER
74735518be Removes permissions.default.* preferences actually missing from TB 2021-10-17 18:39:08 +02:00
Samuel FORESTIER
881a339584 Fixes v78..v91 Arkenfox migration (accidentally dropped preferences) 2021-10-17 18:24:37 +02:00
Samuel FORESTIER
efe11df8e4 Gets rid of toolkit.telemetry.prompted (apparently removed) preference 2021-10-17 18:12:26 +02:00
Samuel FORESTIER
5a1ff8ddfa Adds new mail.biff.show_badge Thunderbird v91.0.2+ preference 2021-10-17 17:58:04 +02:00
Samuel FORESTIER
57073e7516 [WIP] Continues Arkenfox v78..v91 migration
Migration status :
        * uncommented some preferences from the 7000 section
2021-10-17 17:58:01 +02:00
Samuel FORESTIER
68b3e25656 [WIP] Continues Arkenfox v78..v91 migration
Migration status :
    * updated sections 9XXX
    * fixed one typo in documentation
    * removed `browser.zoom.siteSpecific` (does not seem to be supported by Thunderbird)
2021-10-17 17:07:47 +02:00
Samuel FORESTIER
e639a79445 [WIP] Continues Arkenfox v78..v91 migration
> **WORK IN PROGRESS : DO NOT USE IT AS IS**

Migration status :
    * updated sections 4000 --> 8000
    * some preferences from section 7000 **SHOULD** be enforced (not done yet)
2021-10-17 17:07:47 +02:00
Samuel FORESTIER
3b2afdd532 [WIP] Continues Arkenfox v78..v91 migration
> **WORK IN PROGRESS : DO NOT USE IT AS IS**

Migration status :
    * updated sections 1600 --> 2800
2021-10-17 17:07:47 +02:00
Samuel FORESTIER
5342ec1619 [WIP] Continues Arkenfox v78..v91 migration
> **WORK IN PROGRESS : DO NOT USE IT AS IS**

Migration status :
    * updated sections 0900 --> 1400
2021-10-17 17:07:34 +02:00
Samuel FORESTIER
f675a006d5 [WIP] Begins Arkenfox v78..v91 migration
> **WORK IN PROGRESS : DO NOT USE IT AS IS**

Migration status :
    * updated README
    * updated header
    * updated index
    * moved sections 6000, 6100, 6500 & 6300 to 91XX to comply with new upstream namespace
    * updated sections 01XX -> 08XX
2021-09-12 19:33:39 +02:00
Samuel FORESTIER
d3308d2f5f [META] Bumps to v78.0 2021-08-28 10:20:35 +02:00
Samuel FORESTIER
7c8504b6d0 [META] Updates copyrights for 2021 2021-08-28 10:20:02 +02:00
Samuel FORESTIER
d169ad4ba8 [CI] Bumps actions/setup-node to v2 2021-08-28 10:19:51 +02:00
Samuel FORESTIER
d35ac2f330 [META][GITHUB] Publishes a proper FUNDING.yml sponsoring file
[skip ci]
2021-04-26 16:56:49 +02:00
Samuel FORESTIER
3c70f08468 Bumps to v78-beta6 2020-11-23 18:26:14 +01:00
Samuel FORESTIER
7f3b35ca64 Leaves dom.IntersectionObserver.enabled as it may break error console
> Closes #13
2020-11-23 18:25:48 +01:00
Samuel FORESTIER
b8ef724bb0 Bumps to v78-beta5 2020-11-12 14:54:32 +01:00
Samuel FORESTIER
5f8cb09775 Replaces Mozilla's DXR links by proper SearchFox ones
> See <https://discourse.mozilla.org/t/decommission-dxr/69475>
2020-11-12 14:48:40 +01:00
Samuel FORESTIER
0ca3d51157 Revert "Enables some previously commented-out options related to RSS feeds"
This reverts commit f9413919b56ae4f53af4d35338de3ecb90b8a2df.
+ Replaces irrelevant DXR link by proper SearchFox permalink.

> As of Thunderbird 78, those preferences are still **NOT** implemented.
2020-11-12 14:45:59 +01:00
Samuel FORESTIER
aa773053bf Disable about:rights notification on fresh profiles 2020-11-12 14:36:38 +01:00
Samuel FORESTIER
d751f49340 Copyright/authors cleanup (see privacytools/privacytools.io#2120) 2020-11-09 14:12:06 +01:00
Samuel FORESTIER
b600990f30 Publishes GitHub templates to simplify issue reporting and contributions 2020-11-09 11:10:17 +01:00
Samuel FORESTIER
6d624b759e Adds [SETUP-FEATURE] tag to chat, as it could be an expected feature 2020-11-08 22:54:46 +01:00
Samuel FORESTIER
e7086e6b5f Incorporates some prefs from 12bytes.org's user.js (related project too)
(cc @atomGit)
2020-11-08 22:50:22 +01:00
Samuel FORESTIER
894ae0d78b Bumps to v78-beta4 2020-11-08 17:49:56 +01:00
Samuel FORESTIER
a6a674ad37 Prevent access to emails until the master password is entered 2020-11-08 17:49:33 +01:00
Samuel FORESTIER
700f90e954 Improves consistency across some preferences default set values 2020-11-08 16:18:57 +01:00
Samuel FORESTIER
352394a62f Specifies that mail.collect_* could be changed from settings 2020-11-08 16:10:32 +01:00
Samuel FORESTIER
fc6ea5582f TorBirdy is not compatible against Thunderbird v78, removing advice 2020-11-08 16:10:32 +01:00
Samuel FORESTIER
428fa861b9 Prevents pages refresh or reload when tab/window is inactive or idle 2020-11-08 15:15:50 +01:00
Samuel FORESTIER
148bfac882 Definitely removes link to CHEF-KOCH/TBCK in "related projects" list
> See: <https://github.com/arkenfox/user.js/issues/323>
2020-11-08 15:15:32 +01:00
Samuel FORESTIER
13b544b208 These UX features actually do not exist anymore 2020-11-07 23:06:39 +01:00
Samuel FORESTIER
667189eedb Specifies that calendar.timezone.local could be changed from settings 2020-11-07 19:19:32 +01:00
Samuel FORESTIER
b4a7a771ec Improves addr collect. doc + Explains how it could be done with CardBook 2020-11-07 19:05:58 +01:00
Samuel FORESTIER
e859c40916 [CARDBOOK] Prevent contacts display names leakages in recipients list 2020-11-07 19:00:33 +01:00
Samuel FORESTIER
b36710a76e Replaces Acorn over Travis CI by ESLint over (Microsoft) GitHub Actions
> See #11, Acorn was great but not sufficient for Mozilla's libPref syntax...
2020-11-05 16:11:13 +01:00
Samuel FORESTIER
ba65d33451 Bumps version field in sources according to latest tag
[skip ci]
2020-11-04 21:18:13 +01:00
Samuel FORESTIER
accbfcc009 Adds missing semicolons to mail.instrumentation.* prefs (closes #11) 2020-11-04 21:05:32 +01:00
Samuel FORESTIER
5ee06c6d89 "Format replies not to disclose additional information such as locale"
Commit imported (before being adjusted) from CHEF-KOCH/TBCK project, external contribution by @komachi

Co-authored-by: Anton Nesterov <anton@nesterov.cc>
2020-11-04 10:47:31 +01:00
Samuel FORESTIER
8591d9b2c8 Re-affects 6000 section identifiers to allow new intermediate prefs 2020-11-04 09:59:45 +01:00
Samuel FORESTIER
ac6137d6f4 Adds "Privacy Haters" as one more related project
> The HTTP link has been set, as the website uses a self-signed certificate.
2020-11-03 20:45:51 +01:00
Samuel FORESTIER
7bc7c89ac7 Exposes the default return receipt behavior pref in 5000 ("personal") 2020-11-03 20:34:12 +01:00
Samuel FORESTIER
52d0864e41 Incorporates some hardening from CHEF-KOCH/TBCK (abandoned?) project :
+ Disables MathML by default
+ Lowers the HTTP redirects limit
+ Disables any add-on installed outside profile directory
+ Disables accessibility services access
+ Disables system timezone detection
+ Disables UI instrumentation
+ Disables network connectivity checks
+ Disables IPv6 network detection changes
2020-11-03 18:56:53 +01:00
Samuel FORESTIER
37066f8c06 Somehow, checkDefaultMail option got renamed to checkDefaultClient 2020-11-03 18:53:06 +01:00
Samuel FORESTIER
787ca411fb Prefers pointing to Arkenfox maintenance section as we do not have one 2020-11-03 14:48:00 +01:00
Samuel FORESTIER
68d36833f7 Fixes wrong value type set for mail.collect_addressbook option...
and adds the default value to template for re-enabling purposes
2020-11-03 10:59:41 +01:00
Samuel FORESTIER
f9413919b5 Enables some previously commented-out options related to RSS feeds 2020-11-03 10:58:34 +01:00
Samuel FORESTIER
b58655a422 The option following 6001 should definitely be 6002 :-) 2020-11-02 09:58:33 +01:00
Samuel FORESTIER
08b2bf9467 TBCK project is now unavailable on GitHub, waiting for owner feedback... 2020-11-01 23:27:59 +01:00
Samuel FORESTIER
bc1a74afa7 @tya99's account does not exist on GitHub anymore 2020-11-01 23:26:35 +01:00
Samuel FORESTIER
8c2ef50da0 TorBirdy is actually not compatible against Thunderbird >= v68
> See <https://trac.torproject.org/projects/tor/ticket/31341>
2020-11-01 23:25:58 +01:00
Samuel FORESTIER
3cd96847ca [BREAKING] Let's prefer plain text email disregarding HTML presence 2020-11-01 22:58:48 +01:00
Samuel FORESTIER
10b1bb2b7c Merges some options and behavior from Privacy Handbuch project for v78 2020-11-01 22:57:55 +01:00
Samuel FORESTIER
1692de442c Applies Arkenfox v68..v78 changes 2020-11-01 19:11:47 +01:00
Samuel FORESTIER
a9b0166323 Updates README layout to reflect latest arkenfox design 2020-11-01 13:26:51 +01:00
Samuel FORESTIER
ce8dfe3329 Bumps to v68.0 2020-10-31 22:26:10 +01:00
Samuel FORESTIER
30848dd7e7 Replaces gHacks occurrences by arkenfox (see arkenfox/user.js#1009) 2020-10-31 22:25:47 +01:00
Samuel FORESTIER
b90bbe45b2 Bumps to v68-beta5 2020-05-01 08:49:19 +02:00
Samuel FORESTIER
5ede0acaaa Fixes mailnews.use_received_date type and unsets it by default 2020-05-01 08:49:08 +02:00
Samuel FORESTIER
eb8cade42e Let's update these metadata before new tag 2020-04-16 15:03:58 +02:00
Samuel FORESTIER
c57ead1b76 Disables Mozilla telemetry prompt on fresh installs 2020-04-16 15:03:34 +02:00
Samuel FORESTIER
3ce96df737 Adds a note about certificate pinning and ProtonMail's Bridge usage 2020-04-16 15:03:02 +02:00
Samuel FORESTIER
49921ed98c Updates LICENSE to reflect the consecutive project maintainers 2020-03-24 09:44:07 +01:00
Samuel FORESTIER
5f9bf7f88d Some more README's blemish fixes 2020-03-23 14:54:57 +01:00
Samuel FORESTIER
989a0f9447 Adds a "Related Projects" section in README 2020-03-23 14:53:05 +01:00
Samuel FORESTIER
c549b95263 Adds back [SETUP-*] tags explanations from official gHacks project 2020-03-23 14:49:08 +01:00
Samuel FORESTIER
634914c41f Hardens default template and explicits Lightning integration opt-out
> Closes #9.
2020-03-23 14:44:08 +01:00
Samuel FORESTIER
59d8211ff4 Sets [SETUP-*] tag to some existing preferences to help installation
> Closes #8.
2020-03-23 11:41:07 +01:00
Samuel FORESTIER
3fa04abd7a Fixes little blemish on README 2020-03-23 10:32:53 +01:00
Samuel FORESTIER
bc6e3335f9
Adds a new [SETUP-INSTALL] tag to address TB setting up process
> Closes #6 (auto-configuration causing breakage for new users).
2019-12-26 15:20:47 +00:00
Samuel FORESTIER
d51c67fc70
Adds some new preferences for v68 (#4)
Co-Authored-By: atomGit <atomgit@users.noreply.github.com>
2019-11-30 21:34:58 +00:00
Samuel FORESTIER
9d9fb07b8e Adds a note about colors bug due to RFP (closes #2) 2019-11-28 23:19:54 +01:00
15 changed files with 2546 additions and 1304 deletions

36
.eslint.config.mjs Normal file
View File

@ -0,0 +1,36 @@
// Thunderbird User.JS ESLint configuration file
import js from "@eslint/js";
export default [
js.configs.recommended,
{
rules: {
// Expect only double-quoted strings.
quotes: ["error", "double"],
// Expect a semicolon after each statement.
semi: ["error", "always", {"omitLastInOneLineBlock": false}],
// As project code style, don't allow tabulation nor trailing whitespaces.
"no-tabs": "error",
"no-trailing-spaces": "error",
// Don't allow whitespace before semicolons.
"semi-spacing": ["error", {"before": false}],
// Don't allow irregular whitespace characters in our sheet.
"no-irregular-whitespace": ["error", {"skipStrings": false, "skipComments": false}],
},
languageOptions: {
// From <https://searchfox.org/mozilla-central/rev/c938c7416c633639a5c8ce4412be586eefb48005/modules/libpref/parser/src/lib.rs#296>
globals: {
pref: "readonly",
user_pref: "readonly",
sticky: "readonly",
locked: "readonly",
sticky_pref: "readonly",
},
},
},
];

15
.gitattributes vendored Normal file
View File

@ -0,0 +1,15 @@
* 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

4
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,4 @@
# repo: HorlogeSkynet/thunderbird-user.js
# filename: FUNDING.YML
liberapay: HorlogeSkynet

38
.github/ISSUE_TEMPLATE/bug.md vendored Normal file
View File

@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve Thunderbird User.JS
title: "[BUG] "
labels: 'bug'
assignees: ''
---
**Describe the bug**
<!-- A clear and concise description of what the bug is. -->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen. -->
**Screenshots**
<!-- If applicable (i.e. graphical glitch), add screenshots to help explain your problem. -->
**Environment**
<!-- Please complete the following information: -->
- Thunderbird version used (X.Y.Z) :
- `thunderbird user.js` template version used (X.Y or commit SHA) :
- Operating system and version :
- \[IF RELEVANT\] Graphical environment name and version :
**Additional context**
<!-- If applicable, add any other context about the problem here. -->
**Checklist**
<!--- Put an `X` in all the boxes that apply : -->
- [ ] I can confirm the bug is due to `thunderbird user.js` **template** and not an overridden preference nor an add-on ;
- [ ] I have searched for `[SETUP-*]` tags and read them up ;
- [ ] I have searched the GitHub project (issues and Wiki) for my issue.

View File

@ -0,0 +1,30 @@
---
name: Change request
about: Suggest a change for Thunderbird User.JS
title: "[RFC] "
labels: 'enhancement'
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**List the concerned preferences**
<!-- A clear and concise list of the preferences you want to add/remove/change. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context (Thunderbird version, OS, etc.) or screenshots about the feature request here. -->
**Checklist**
<!--- Put an `X` in all the boxes that apply : -->
- [ ] I know `thunderbird user.js` is a **template** and personal preferences should be stored elsewhere ;
- [ ] The change I want to propose should globally improve the `usability / ( privacy + security + anti-fingerprinting )` ratio ;
- [ ] I agree that subsequent modifications to my change scope may occur in the future.

28
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@ -0,0 +1,28 @@
<!--- Provide a general summary of your changes in the title above -->
## Description
<!--- Describe your changes in detail -->
## Reason and / or context
<!--- Why is this change required ? What problem does it solve ? -->
<!--- If it fixes an open issue, please link to the issue here -->
## How has this been tested ?
<!--- Include details of your testing environment here -->
## Types of changes :
<!--- What types of changes does your code introduce ? Put an `X` in all the boxes that apply : -->
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Typo / style fix (non-breaking change which improves readability)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
## Checklist :
<!--- Put an `X` in all the boxes that apply : -->
- [ ] My changes looks good ;
- [ ] I agree that my code may be modified in the future ;
- [ ] My code follows the code style of this project (see `.eslint.config.mjs`).

17
.github/workflows/linting.yml vendored Normal file
View File

@ -0,0 +1,17 @@
---
name: Linting
on: [push, pull_request]
jobs:
build:
name: Run ESLint on user.js
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install eslint @eslint/js
- run: npx eslint -c .eslint.config.mjs user.js

View File

@ -1,8 +0,0 @@
language: node_js
node_js:
- 'node'
before_script:
- npm install -g acorn
script:
- acorn --silent user.js

View File

@ -1,6 +1,8 @@
MIT License
Copyright (c) 2019 ghacksuserjs
Copyright (c) 2019-2025 HorlogeSkynet
Copyright (c) 2019 dngray
Copyright (c) 2019 arkenfox [prev. ghacksuserjs]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1,25 +1,42 @@
# Thunderbird User.JS
> An ongoing comprehensive user.js template for configuring and hardening Thunderbird privacy, security and anti-fingerprinting
> Thunderbird privacy, security and anti-fingerprinting: a comprehensive user.js template for configuration and hardening
### :large_blue_diamond: user.js
### 🟪 user.js
An `user.js` is a configuration file that can control hundreds of Thunderbird settings. For a more technical breakdown and explanation, you can read more on the [overview](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/1.1-Overview) wiki page.
An `user.js` is a configuration file that can control Thunderbird settings - for a more technical breakdown and explanation, you can read more in the [wiki](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/1.1-Overview).
### :large_blue_diamond: thunderbird user.js
### 🟩 Thunderbird user.js
The Thunderbird `user.js` is a **template** which aims to provide as much privacy and enhanced security as possible. It differs from the `ghacks user.js` in that the focus is to keep Thunderbird as an **email client** and disable as many web browsing features as possible. We believe web browsing should be done in a web browser, and not an email client.
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
- If you're using Thunderbird with Tor we suggest that you install the [TorBirdy](https://addons.thunderbird.net/addon/torbirdy) addon. If you are using Tor, you should also consider using [Tails](https://tails.boum.org/) or [Whonix](https://www.whonix.org/).
- If you're a **Gmail** user see [this article about OAuth2](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/3.1-OAuth2-Users).
- For information about [extensions](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/4.1-Extensions), see the wiki. **Calendar** users should [see this page](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/4.1.1-Calendar).
The `thunderbird 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).
Also be aware that this `user.js` is made specifically for Thunderbird and has only been tested in the latest stable release.
Everyone, experts included, should at least read the [wiki](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki), as it contains important information regarding a few `user.js` settings.
### :large_blue_diamond: acknowledgments
It differs from the `arkenfox user.js` in that the focus is to keep Thunderbird as an **e-mail client** and disable as many web browsing features as possible. We believe web browsing should be done in a web browser, and not an email client.
* [tya99](https://github.com/tya99) most of the ground work and initial port from the Firefox version of [ghacks user.js](https://github.com/ghacksuserjs/ghacks-user.js)
* [dngray](https://github.com/dngray) continual maintenance and Wiki
* [HorlogeSkynet](https://github.com/HorlogeSkynet) continual maintenance
- If you're using Thunderbird (< 68) with Tor we suggest that you install the [TorBirdy](https://addons.thunderbird.net/addon/torbirdy) add-on. If you are using Tor, you should also consider using [Tails](https://tails.boum.org/) or [Whonix](https://www.whonix.org/).
- If you're using **Gmail**, please check [this article about OAuth2](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/3.1-OAuth2-Users).
- For information about [extensions](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/4.1-Extensions), see the Wiki.
- **Calendar** users should [see this page](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki/4.1.1-Calendar).
### :large_blue_diamond: [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Also be aware that this `user.js` is made specifically for Thunderbird and is only being tested against releases with extended support (ESR).
### 🟧 Sitemap
- [Releases](https://github.com/HorlogeSkynet/thunderbird-user.js/releases)
- [Issues](https://github.com/HorlogeSkynet/thunderbird-user.js/issues)
- [Wiki](https://github.com/HorlogeSkynet/thunderbird-user.js/wiki)
### 🟥 Acknowledgments
* @tya99 most of the ground work and initial port from the Firefox version of [arkenfox user.js](https://github.com/arkenfox/user.js)
* [@dngray](https://github.com/dngray) continual maintenance and Wiki
* [@HorlogeSkynet](https://github.com/HorlogeSkynet) continual maintenance
### 🟦 Related Projects
* [Privacy Handbuch](https://www.privacy-handbuch.de/handbuch_31p.htm)
* [Privacy Haters](http://r-36.net/scm/privacy-haters/file/README.md.html)
* [12bytes's user-overrides.js](https://codeberg.org/12bytes/thunderbird-user.js-supplement)

134
prefsCleaner.bat Normal file
View File

@ -0,0 +1,134 @@
@ECHO OFF & SETLOCAL DisableDelayedExpansion
TITLE prefs.js cleaner
REM ## prefs.js cleaner for Windows
REM ## /!\ This script is a vendored/adapted version of Arkenfox own prefsCleaner.bat /!\
REM ## author: @claustromaniac
REM ## version: 2.7
CD /D "%~dp0"
IF /I "%~1"=="-unattended" (SET _ua=1)
:begin
ECHO:
ECHO:
ECHO ########################################
ECHO #### prefs.js cleaner for Windows ####
ECHO #### by claustromaniac ####
ECHO #### v2.7 ####
ECHO ########################################
ECHO:
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.
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.
CALL :message ""
TIMEOUT 1 /nobreak >nul
IF NOT DEFINED _ua (
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
CLS
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 "prefs.js" (CALL :abort "prefs.js not found in the current directory." 30)
CALL :strlenCheck
CALL :FFcheck
CALL :message "Backing up prefs.js..."
FOR /F "delims=" %%# IN ('powershell get-date -format "{yyyyMMdd_HHmmss}"') DO @SET ldt=%%#
COPY /B /V /Y prefs.js "prefs-backup-%ldt%.js"
CALL :message "Cleaning prefs.js..."
CALL :cleanup
CALL :message "All done!"
TIMEOUT 5 >nul
ENDLOCAL
EXIT /B
REM ########## Abort Function ###########
:abort
CALL :message %1
TIMEOUT %~2 >nul
EXIT
REM ########## Message Function #########
:message
ECHO:
ECHO: %~1
ECHO:
GOTO :EOF
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
REM ####### Thunderbird Check Function ######
:FFcheck
TASKLIST /FI "IMAGENAME eq thunderbird.exe" 2>NUL | FIND /I /N "thunderbird.exe">NUL
IF NOT ERRORLEVEL 1 (
CLS
CALL :message "Thunderbird is still running."
ECHO If you're not currently using this profile you can continue, otherwise
CALL :message "close Thunderbird first!"
ECHO:
PAUSE
CLS
CALL :message "Resuming..."
TIMEOUT 5 /nobreak >nul
)
GOTO :EOF
REM ######### Cleanup Function ##########
:cleanup
FOR /F tokens^=2^ delims^=^'^" %%G IN ('FINDSTR /R /C:"^[^\"']*user_pref[ ]*\([ ]*[\"'][^\"']*[\"'][ ]*," user.js') DO (
IF NOT ""=="%%G" (SET "[%%G]=1")
)
(
FOR /F "tokens=1,* delims=:" %%G IN ('FINDSTR /N "^" prefs.js') DO (
IF ""=="%%H" (
ECHO:
) ELSE (
FOR /F tokens^=1^,2^ delims^=^"^' %%I IN ("%%H") DO (
IF NOT DEFINED [%%J] (ECHO:%%H)
)
)
)
)>tempcleanedprefs
MOVE /Y tempcleanedprefs prefs.js
GOTO :EOF
REM ############### Help ##################
:showhelp
MODE 80,34
CLS
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:
CALL :message " 1. Make sure Thunderbird is closed."
ECHO 2. Delete prefs.js in your profile 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.
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,
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
CALL :message " problems were solved."
ECHO:
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:
ECHO:
PAUSE
CLS
GOTO :begin
REM #####################################

186
prefsCleaner.sh Executable file
View File

@ -0,0 +1,186 @@
#!/usr/bin/env bash
## prefs.js cleaner for Linux/Mac
## /!\ This script is a vendored/adapted version of Arkenfox own prefsCleaner.sh /!\
## 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 thunderbird 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 Thunderbird profile seems to be in use. Close Thunderbird 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/HorlogeSkynet/thunderbird-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 Thunderbird 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 Thunderbird 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 Thunderbird 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 Thunderbird 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 Thunderbird 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 Thunderbird 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 thunderbird user.js GitHub repository.\n"
;;
Exit)
fQuit 0
;;
esac
done
fQuit 0

323
updater.bat Normal file
View File

@ -0,0 +1,323 @@
@ECHO OFF & SETLOCAL EnableDelayedExpansion
TITLE thunderbird user.js updater
REM ## thunderbird user.js updater for Windows
REM ## /!\ This script is a vendored/adapted version of Arkenfox own updater.bat /!\
REM ## author: @claustromaniac
REM ## version: 4.19
REM ## instructions: https://github.com/arkenfox/user.js/wiki/5.1-Updater-[Options]#-windows
SET v=4.19
VERIFY ON
CD /D "%~dp0"
SET _myname=%~n0
SET _myparams=%*
:parse
IF "%~1"=="" (GOTO endparse)
IF /I "%~1"=="-unattended" (SET _ua=1)
IF /I "%~1"=="-log" (SET _log=1)
IF /I "%~1"=="-logp" (SET _log=1 & SET _logp=1)
IF /I "%~1"=="-multioverrides" (SET _multi=1)
IF /I "%~1"=="-merge" (SET _merge=1)
IF /I "%~1"=="-updatebatch" (SET _updateb=1)
IF /I "%~1"=="-singlebackup" (SET _singlebackup=1)
IF /I "%~1"=="-esr" (SET _esr=1)
SHIFT
GOTO parse
: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 (
REM The normal flow here goes from phase 1 to phase 2 and then phase 3.
IF NOT "!_myname:~0,9!"=="[updated]" (
IF EXIST "[updated]!_myname!.bat" (
REM ## Phase 3 ##: The new script, with the original name, will:
REM * Delete the [updated]*.bat and *.bat.old scripts
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"
DEL /F "!_myname!.bat.old" "[updated]!_myname!.bat.old"
GOTO begin
)
REM ## Phase 1 ##
REM * Download new batch and name it [updated]*.bat
REM * Start that script in a new CMD window
REM * Exit
CALL :message "Updating script..."
REM Uncomment the next line and comment out the PowerShell call for testing.
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"
IF EXIST "[updated]!_myname!.bat" (
START /min CMD /C "[updated]!_myname!.bat" !_myparams!
) ELSE (
CALL :message "Failed. Make sure PowerShell is allowed internet access."
TIMEOUT 120 >nul
)
) ELSE (
IF "!_myname!"=="[updated]" (
CALL :message "The [updated] label is reserved. Rename this script and try again."
TIMEOUT 300 >nul
) ELSE (
REM ## Phase 2 ##: The [updated]*.bat script will:
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 * Exit
IF EXIST "!_myname:~9!.bat" ( REN "!_myname:~9!.bat" "!_myname:~9!.bat.old" )
COPY /B /Y "!_myname!.bat" "!_myname:~9!.bat"
START CMD /C "!_myname:~9!.bat" !_myparams!
)
)
EXIT /B
)
:begin
CLS
ECHO:
ECHO:
ECHO: ########################################
ECHO: #### user.js Updater for Windows ####
ECHO: #### by claustromaniac ####
ECHO: #### v!v! ####
ECHO: ########################################
ECHO:
SET /A "_line=0"
IF NOT EXIST user.js (
CALL :message "user.js not detected in the current directory."
) ELSE (
FOR /F "skip=1 tokens=1,* delims=:" %%G IN (user.js) DO (
SET /A "_line+=1"
IF !_line! GEQ 4 (GOTO exitloop)
IF !_line! EQU 1 (SET _name=%%H)
IF !_line! EQU 2 (SET _date=%%H)
IF !_line! EQU 3 (SET _version=%%H)
)
:exitloop
IF NOT "!_name!"=="" (
SET "_tempvar="
IF /I NOT "!_name!"=="!_name:thunderbird=!" SET _tempvar=1
IF !_tempvar! EQU 1 (
CALL :message "!_name! !_version:~2!,!_date!"
) ELSE (CALL :message "Current user.js version not recognised.")
) ELSE (CALL :message "Current user.js version not recognised.")
)
ECHO:
IF NOT DEFINED _ua (
CALL :message "This batch should be run from your Thunderbird profile directory."
ECHO: It will download the latest version of thunderbird user.js from github and then
CALL :message "append any of your own changes from user-overrides.js to it."
CALL :message "Visit the wiki for more detailed information."
ECHO:
TIMEOUT 1 /nobreak >nul
CHOICE /C SHE /N /M "Start [S] Help [H] Exit [E]"
CLS
IF ERRORLEVEL 3 (EXIT /B)
IF ERRORLEVEL 2 (GOTO :showhelp)
)
IF DEFINED _log (
CALL :log >>user.js-update-log.txt 2>&1
IF DEFINED _logp (START user.js-update-log.txt)
EXIT /B
:log
SET _log=2
ECHO:##################################################################
ECHO: %date%, %time%
)
IF EXIST user.js.new (DEL /F "user.js.new")
CALL :message "Retrieving latest user.js file from github repository..."
CALL :psdownload https://raw.githubusercontent.com/HorlogeSkynet/thunderbird-user.js/master/user.js "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 (
FORFILES /P user.js-overrides /M *.js >nul 2>&1
IF NOT ERRORLEVEL 1 (
IF DEFINED _merge (
CALL :message "Merging..."
COPY /B /Y user.js-overrides\*.js user-overrides-merged.js
CALL :merge user-overrides-merged.js
COPY /B /Y user.js.new+user-overrides-merged.js user.js.new
CALL :merge user.js.new
) ELSE (
CALL :message "Appending..."
COPY /B /Y user.js.new+"user.js-overrides\*.js" user.js.new
)
) ELSE (CALL :message "No override files found.")
) ELSE (
IF EXIST "user-overrides.js" (
COPY /B /Y user.js.new+"user-overrides.js" "user.js.new"
IF DEFINED _merge (
CALL :message "Merging user-overrides.js..."
CALL :merge user.js.new
) ELSE (
CALL :message "user-overrides.js appended."
)
) 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 "!_changed!"=="true" (
CALL :message "Backing up..."
IF DEFINED _singlebackup (
MOVE /Y user.js user.js.bak >nul
) ELSE (
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."
) ELSE (
IF "!_changed!"=="false" (
DEL /F user.js.new >nul
CALL :message "Update completed without changes."
) ELSE (
REN user.js.new user.js
CALL :message "Update complete."
SET "_changed=true"
)
)
) ELSE (
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 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
::::::::::::::: Message :::::::::::::::
:message
SETLOCAL DisableDelayedExpansion
IF NOT "2"=="%_log%" (ECHO:)
ECHO: %~1
IF NOT "2"=="%_log%" (ECHO:)
ENDLOCAL
GOTO :EOF
::::::::::::::: 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
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=1,* delims=:" %%I IN ('FINDSTR /N "^" "%~1"') DO (
SET "_temp=%%J"
SETLOCAL EnableDelayedExpansion
IF NOT "!_temp:~0,9!"=="user_pref" (
ENDLOCAL & ECHO:%%J
) ELSE (
IF "!_temp:;=!"=="!_temp!" (
ENDLOCAL & ECHO:%%J
) ELSE (
ENDLOCAL
FOR /F tokens^=2^ delims^=^'^" %%K IN ("%%J") DO (
IF NOT "_user.js.parrot"=="%%K" (
IF DEFINED __unset__%%K (
ECHO://%%J
) ELSE (
IF DEFINED [%%K] (
SETLOCAL EnableDelayedExpansion
FOR /F "delims=" %%L IN ("![%%K]!") DO (
ENDLOCAL & ECHO:user_pref("%%K"%%L
SET "[%%K]="
)
)
)
) ELSE (ECHO:%%J)
)
)
)
)
)>updatertempfile
MOVE /Y updatertempfile "%~1" >nul
ENDLOCAL
GOTO :EOF
::::::::::::::: Help :::::::::::::::
:showhelp
MODE 80,54
CLS
CALL :message "Available arguments (case-insensitive):"
CALL :message " -esr"
ECHO: Activate ESR related preferences
CALL :message " -log"
ECHO: Write the console output to a logfile (user.js-update-log.txt)
CALL :message " -logP"
ECHO: Like -log, but also open the logfile after updating.
CALL :message " -merge"
ECHO: Merge overrides instead of appending them. Single-line comments and
ECHO: _user.js.parrot lines are appended normally. Overrides for inactive
ECHO: user.js prefs will be appended. When -Merge and -MultiOverrides are used
ECHO: together, a user-overrides-merged.js file is also generated in the root
ECHO: directory for quick reference. It contains only the merged data from
ECHO: override files and can be safely discarded after updating, or used as the
ECHO: new user-overrides.js. When there are conflicting records for the same
ECHO: pref, the value of the last one declared will be used. Visit the wiki
ECHO: for usage examples and more detailed information.
CALL :message " -multiOverrides"
ECHO: Use any and all .js files in a user.js-overrides sub-folder as overrides
ECHO: instead of the default user-overrides.js file. Files are appended in
ECHO: alphabetical order.
CALL :message " -unattended"
ECHO: Run without user input.
CALL :message " -singleBackup"
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.
CALL :message " -updateBatch"
ECHO: Update the script itself on execution, before the normal routine.
CALL :message ""
PAUSE
MODE 80,25
GOTO :begin

408
updater.sh Executable file
View File

@ -0,0 +1,408 @@
#!/usr/bin/env bash
## thunderbird user.js updater for macOS and Linux
## /!\ This script is a vendored/adapted version of Arkenfox own updater.sh /!\
## version: 4.0
## 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() )
# Check if running as root
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)
SCRIPT_FILE=$(readlink -f "${BASH_SOURCE[0]}" 2>/dev/null || greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null)
[ -z "$SCRIPT_FILE" ] && SCRIPT_FILE=${BASH_SOURCE[0]}
readonly SCRIPT_DIR=$(dirname "${SCRIPT_FILE}")
#########################
# Base variables #
#########################
# Colors used for printing
RED='\033[0;31m'
BLUE='\033[0;34m'
BBLUE='\033[1;34m'
GREEN='\033[0;32m'
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
echo -e "${RED}This script requires curl or wget.\nProcess aborted${NC}"
exit 1
fi
show_banner() {
echo -e "${BBLUE}
############################################################################
#### ####
#### thunderbird user.js ####
#### Hardening the Privacy and Security Settings of Thunderbird ####
#### 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"
}
#########################
# Arguments #
#########################
usage() {
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 Thunderbird profile (if different than the dir of this script)
IMPORTANT: If the path contains spaces, wrap the entire argument in quotes.
-l Choose your Thunderbird 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
# extracting 0 or 1 from the "IsRelative=" line
declare -r pathisrel=$(sed -n 's/^IsRelative=\([01]\)$/\1/p' <<< "${tempIni}")
# extracting only the path itself, excluding "Path="
PROFILE_PATH=$(sed -n 's/^Path=\(.*\)$/\1/p' <<< "${tempIni}")
# update global variable if path is relative
[[ ${pathisrel} == "1" ]] && PROFILE_PATH="$(dirname "${inifile}")/${PROFILE_PATH}"
}
getProfilePath() {
declare -r f1=~/Library/Application\ Support/Thunderbird/profiles.ini
declare -r f2=~/.thunderbird/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/HorlogeSkynet/thunderbird-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/HorlogeSkynet/thunderbird-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:
Thunderbird 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/HorlogeSkynet/thunderbird-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
show_banner
update_updater "$@"
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"

2574
user.js

File diff suppressed because it is too large Load Diff