From b33bfb5a038c47df45e5101ead2610fff50e7c63 Mon Sep 17 00:00:00 2001 From: ohfp <1813007-ohfp@users.noreply.gitlab.com> Date: Mon, 26 Apr 2021 11:43:42 +0200 Subject: [PATCH] Allow overriding prefs This commit would allow overriding prefs (locked or otherwise) with a user accessible file even on sandboxed/restricted releases (like AppImage or Flatpak). This works because the last specific pref value that is parsed during startup is the one that gets actually applied; this way an empty / non existing overrides file will not have any effect, and only prefs changed in this file will be changed, while other prefs from the `librewolf.cfg` will still be applied. The difference to a `user.js` is that at this stage / with this file, even locked prefs can still be modified. Should we desire to have some prefs _really_ locked down (which we do not want to be changeable with this override method), we could just place them after the changes from this MR - so they would be parsed after those defined in the overrides file and could override pref changes made there. Somewhat related to #45, #27; should partially fix #8 and basically mitigate the recurring issues of users unable to edit some locked settings when using a more restricted release variant. Should probably be added to the docs, once merged. --- librewolf.cfg | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/librewolf.cfg b/librewolf.cfg index b9a337e..645c6e0 100644 --- a/librewolf.cfg +++ b/librewolf.cfg @@ -2772,3 +2772,11 @@ defaultPref("devtools.selfxss.count", 0); // enable HTTPS only mode by default defaultPref("dom.security.https_only_mode", true); defaultPref("dom.security.https_only_mode_ever_enabled", true); + +// allow settings to be overriden with a file at `~/.librewolf/librewolf.overrides.cfg` +// or `~/.var/app/io.gitlab.librewolf-community/.librewolf/librewolf.overrides.cfg` (Flatpak). +// not yet verified to work on Windows and MacOS releases +let home_directory = getenv("HOME"); +if (home_directory) { + pref("autoadmin.global_config_url", `file://${home_directory}/.librewolf/librewolf.overrides.cfg`); +}