mirror of
https://codeberg.org/claui/mobile-config-firefox.git
synced 2025-02-21 18:11:43 +00:00
In the Tor browser user agent, the "geckotrail" part has been changed. Apparently following an upstream change in Firefox: > From Firefox 10 on mobile, geckotrail is the same as firefoxversion. Note: I'm simply running latest Tor browser on Android and visit websites showing the user agent to figure out the latest one. I tried to figure it out from the source code once, but didn't find a place where it could be looked up trivially (since it gets built of multiple components etc.). Related: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/User-Agent/Firefox
52 lines
2 KiB
JavaScript
52 lines
2 KiB
JavaScript
// Copyright 2021 Arnaud Ferraris, Oliver Smith
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// This is a Firefox autoconfig file:
|
|
// https://support.mozilla.org/en-US/kb/customizing-firefox-using-autoconfig
|
|
|
|
// Import custom userChrome.css on startup or new profile creation
|
|
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
Cu.import("resource://gre/modules/FileUtils.jsm");
|
|
|
|
// Create <profile>/chrome/ directory if not already present
|
|
var chromeDir = Services.dirsvc.get("ProfD", Ci.nsIFile);
|
|
chromeDir.append("chrome");
|
|
if (!chromeDir.exists()) {
|
|
chromeDir.create(Ci.nsIFile.DIRECTORY_TYPE, FileUtils.PERMS_DIRECTORY);
|
|
}
|
|
|
|
// Create nsIFile objects for userChrome.css in <profile>/chrome/ and in /etc/
|
|
var chromeFile = chromeDir.clone();
|
|
chromeFile.append("userChrome.css");
|
|
var defaultChrome = new FileUtils.File("/etc/mobile-config-firefox/userChrome.css");
|
|
|
|
// Remove the existing userChrome.css if older than the installed one
|
|
if (chromeFile.exists() && defaultChrome.exists() &&
|
|
chromeFile.lastModifiedTime < defaultChrome.lastModifiedTime) {
|
|
chromeFile.remove(false);
|
|
}
|
|
|
|
// Copy userChrome.css to <profile>/chrome/
|
|
if (!chromeFile.exists()) {
|
|
defaultChrome.copyTo(chromeDir, "userChrome.css");
|
|
}
|
|
|
|
// Create nsIFile objects for userContent.css in <profile>/chrome/ and in /etc/
|
|
var contentFile = chromeDir.clone();
|
|
contentFile.append("userContent.css");
|
|
var defaultContent = new FileUtils.File("/etc/mobile-config-firefox/userContent.css");
|
|
|
|
// Remove the existing userContent.css if older than the installed one
|
|
if (contentFile.exists() && defaultContent.exists() &&
|
|
contentFile.lastModifiedTime < defaultContent.lastModifiedTime) {
|
|
contentFile.remove(false);
|
|
}
|
|
|
|
// Copy userContent.css to <profile>/chrome/
|
|
if (!contentFile.exists()) {
|
|
defaultContent.copyTo(chromeDir, "userContent.css");
|
|
}
|
|
|
|
// Select a mobile user agent for firefox (same as tor browser on android)
|
|
defaultPref('general.useragent.override', 'Mozilla/5.0 (Android 9; Mobile; rv:78.0) Gecko/78.0 Firefox/78.0');
|