Find a file
Oliver Smith 160a1056c2
policies.json: install uBlock origin by default (MR 19)
Here's something controversial. Install the wide-spectrum blocker uBlock
origin by default. This enables blocking of ads, trackers and malware
sites. I think these should be blocked for several reasons:

1. Performance on mobile devices

It's clear when browsing the web with this add-on, that there is a major
performance benefit in blocking advertising and tracking on websites. We
don't have these resources to waste on Mobile Linux.

2. Privacy

From uBlock origin's README.md:
> [...] it's important to note that using a blocker is NOT theft. Don't fall
> for this creepy idea. The ultimate logical consequence of blocking = theft
> is the criminalisation of the inalienable right to privacy.

> Ads, "unintrusive" or not, are just the visible portions of privacy-invading
> apparatus entering your browser when you visit most sites nowadays. uBlock
> Origin's main goal is to help users neutralize such privacy-invading
> apparatus — in a way that welcomes those users who don't wish to use more
> technical, involved means (such as uMatrix).

3. Manipulation

Modern advertising platforms are used to manipulate people in the scale
of influencing elections of world leaders. From Cambridge Analytica and
similar companies' perspective, one of the workflows is showing the user
an advertisement, then monitoring search queries to determine if the ad
was effective, then adjusting the ad to convince you better to vote for
a certain party, repeat. This has severe negative effects on society,
for people unfamiliar with the topic I recommend watching the movies
"The Great Hack" and "The Social Dilemma". The mentioned workflow is
described in the "Your Undivided Attention" podcast, episode 10, "Rock
the Voter" in an interview with a former Cambridge Analyticer insider.

Related: https://github.com/gorhill/uBlock
Related: cab6a5076c/README.md (policiesjson-45)
Related: https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/
2021-12-05 11:45:42 +01:00
.ci CI: lint: detect indent errors in json (MR 19) 2021-12-05 11:45:42 +01:00
contrib contrib/extract-search-engines.sh: new file (MR 19) 2021-12-05 11:45:42 +01:00
src policies.json: install uBlock origin by default (MR 19) 2021-12-05 11:45:42 +01:00
.editorconfig editorconfig: new file (MR 19) 2021-12-05 11:45:40 +01:00
.gitignore Makefile: new file 2020-08-06 17:01:14 +02:00
.gitlab-ci.yml CI: archive complete package (MR 15) 2021-07-11 15:36:11 +02:00
LICENSE License under GPL-3.0-or-higher 2020-08-06 17:01:14 +02:00
Makefile Makefile: add variable for config directory (MR 16) 2021-07-16 09:35:51 +02:00
org.postmarketos.mobile_config_firefox.metainfo.xml Add appstream data file (MR 14) 2021-06-15 01:04:29 +02:00
README.md README: add link to FirefoxCSS subreddit as additional resource (MR 7) 2021-05-19 23:25:36 +02:00

mobile-config-firefox

An attempt at creating a distro-independent mobile and privacy friendly configuration for Firefox ESR 78 (supported by Mozilla until ~2021-04) and newer versions. As of writing, these configs work with Phosh and Firefox 78 (ESR) and 82.0.3.

This does not replace a proper implementation in Firefox upstream (interesting stuff happens in issues linked in "References"). Some dialogs are still hard to use or look a bit awkward. But overall, it makes the browser usable on mobile.

What this config does

Visual

Starting with version 2.0.0, the visual tweaks only get activated if you have a small window width. It works nicely with convergence.

mobile-config-firefox installs a userChrome.css file to reduce the minimum width of the main window, so it fits the screen without scaling it down. The content of popup windows (settings menu, install add-on confirmation, ...) would be cut off with the default configuration, so as workaround the content is reduced to make it fit the windows again. (It was not possible to increase the size of these windows merely with CSS). The find bar (appears with ^F on your PC, can be toggled from the menu too) is tweaked to fit the mobile screen as well.

The visible width of the URL is increased by hiding buttons around the urlbar (most features behind those buttons can be accessed through other menus), and by decreasing the font size. Furthermore, the urlbar will float above buttons on the left and right when focused, to leave even more space for typing the URL or search query.

Before and after screenshots

  • Enable zooming with fingers (Change in about:config; apz.allow_zooming, apz.allow_double_tap_zooming, dom.w3c.touch_events.enabled)
  • Mobile user agent (from Tor browser for Android) (Change in about:config; general.useragent.override)

Privacy

  • Disable search suggestions, so URLs do not get sent to search engines as they are getting typed (Change in Preferences)
  • Disable Firefox studies (Change in Preferences)
  • Disable Telemetry (Change in Preferences)
  • Set DuckDuckGo as default search engine (Change in Preferences)

Uncluttering

To save screen space, remove broken features, and have less distractions in the browser in general:

  • Custom start page (loads faster, explains mobile config and how to use settings, links to addons)
  • Empty "new tab" page (loads faster, no annoying "top sites" etc.) (Change in Preferences)
  • Disable "Firefox Screenshots": the feature did not work with the mobile resolution in Phosh. (Change in /etc/firefox/policies/policies.json)
  • No default bookmarks from Firefox (Change in /etc/firefox/policies/policies.json)
  • Disable First Run Page (Change in /etc/firefox/policies/policies.json)
  • Disable Post Update Page (Change in /etc/firefox/policies/policies.json)
  • Disable "User Messaging" (What's new, Extension/Feature Recommendations, Urlbar Interventions) (Change in /etc/firefox/policies/policies.json)

How to build and package

  • Replace src/homepage/distro_links.html
  • Build with make DISTRO=yourdistroname
  • In your packaging recipie, run something like make DESTDIR=$pkgdir install

Contributing changes to userChrome

Firefox' developer tools include a remote debugger, which even has the "pick an element" feature. You will be able to click that button on your PC, then tap on an element of the Firefox UI on your phone, and then you will see the HTML code and CSS properties on your PC just as if it was a website. So this is highly recommended when contributing changes to userChrome.css.

  • Connect your phone and your PC to the same network (Wi-Fi or USB network)
  • On your phone, open Firefox and about:config:
    • Change devtools.chrome.enabled to true
    • Change devtools.debugger.remote-enabled to true
    • The debugger will only listen on localhost by default. If you know what you are doing, you may set devtools.debugger.force-local to false, so it listens on all interfaces. Otherwise you'll need something like an SSH tunnel.
    • Close firefox
  • Connect to your phone via SSH
    • Set up environment variables properly, so you can start programs (one lazy way to do it, is tmux on your phone in the terminal, then tmux a in SSH)
    • Run firefox --start-debugger-server 6000 (or another port if you desire)
  • Run Firefox on your PC
    • Go to about:debugging
    • Add your phone as "network location"
    • Press the connect button on the left
  • On your phone
    • Confirm the connection on your phone's screen
      • If the button is not visible on the screen, try switching to a terminal virtual keyboard, hit "tab" three times and then return
  • On your PC
    • Scroll down to Processes, Main Process, and click "Inspect"
    • Now use the "Pick an element" button as described in the introduction. Find the userChrome.css file in the "Style editor" tab and edit it as you like.
    • Consider copy pasting the contents to a text editor every now and then, so you don't lose it when closing Firefox by accident.

Additional resources