diff options
author | ene <ene@sils.li> | 2023-02-11 12:22:46 +0100 |
---|---|---|
committer | ene <ene@sils.li> | 2023-02-11 12:22:46 +0100 |
commit | 16b74bfaab48fa8e890881eead078b09dcefbcf8 (patch) | |
tree | 48dbe0f014d22246cc6594db655866929e5d3cde /home-manager/firefox | |
parent | Fix: Import the configurations (diff) | |
download | nixos-config-16b74bfaab48fa8e890881eead078b09dcefbcf8.tar.gz nixos-config-16b74bfaab48fa8e890881eead078b09dcefbcf8.zip |
Fix: Remove typo from home-manager directory name
Diffstat (limited to 'home-manager/firefox')
-rw-r--r-- | home-manager/firefox/chrome/userChrome.css | 41 | ||||
-rw-r--r-- | home-manager/firefox/default.nix | 220 | ||||
-rw-r--r-- | home-manager/firefox/extensions.json | 30 | ||||
-rwxr-xr-x | home-manager/firefox/generate-extension.py | 41 | ||||
-rw-r--r-- | home-manager/firefox/settings.nix | 660 | ||||
-rw-r--r-- | home-manager/firefox/settings/override.js | 137 | ||||
-rwxr-xr-x | home-manager/firefox/unzip_mozlz4.py | 43 |
7 files changed, 1172 insertions, 0 deletions
diff --git a/home-manager/firefox/chrome/userChrome.css b/home-manager/firefox/chrome/userChrome.css new file mode 100644 index 00000000..0b3aff77 --- /dev/null +++ b/home-manager/firefox/chrome/userChrome.css @@ -0,0 +1,41 @@ +/* thickness of tab when you have too many open tabs */ +.tabbrowser-tab:not([pinned="true"]) { + min-width: 10px !important; + min-height: 10px !important; +} + +/* tab height +#TabsToolbar .tabbrowser-tabs { +min-height: 10px !important; +} +*/ + +/* +.tabbrowser-tab {min-width: 016px !important;} +.tabbrowser-tab {clip-width: 016px !important;} +*/ + +/* the + button that opens new tabs */ +#TabsToolbar .tabs-newtab-button { + margin-left: 10px !important; + height: Auto !important; +} + +#main-window[privatebrowsingmode="temporary"] #navigator-toolbox { + background-color: #c40944 !important; +} + +/* close button inside a tab */ +.tab-close-button * { + width: 10px !important; + height: 10px !important; +} + +/* bookmark toolbar */ +#personal-bookmarks .bookmark-item > .toolbarbutton-text { + font-size: 10pt !important; +} +#personal-bookmarks .bookmark-item > .toolbarbutton-icon { + height: 12px !important; + width: 12px !important; +} diff --git a/home-manager/firefox/default.nix b/home-manager/firefox/default.nix new file mode 100644 index 00000000..5e9b9632 --- /dev/null +++ b/home-manager/firefox/default.nix @@ -0,0 +1,220 @@ +# vim: ts=2 +{ + config, + pkgs, + lib, + stdenv, + ... +}: let + user_js_override = "./settings/override.js"; + user_js = lib.runCommand "user.js" {} '' + mkdir $out; + ${config.inputs.strip_js_comments}/bin ${config.inputs.user_js} > $out/user.js; + cat ${user_js_override} >> $out/user.js; + sed 's/user_pref(\(.*\)",\(.*\));/\1" = \2;/' $out/user.js > $out/user.nix; + ''; + + # source: https://gitlab.com/rycee/nur-expressions/-/blob/master/pkgs/firefox-addons/default.nix + buildFirefoxXpiAddon = { + pname, + version, + addonId, + url, + sha256, + meta, + ... + }: + builtins.stdenv.mkDerivation { + name = "${pname}-${version}"; + + inherit meta; + + src = builtins.fetchurl {inherit url sha256;}; + + preferLocalBuild = true; + allowSubstitutes = true; + + buildCommand = '' + dst="$out/share/mozilla/extensions/{ec8030f7-c20a-464f-9b0e-13a3a9e97384}" + mkdir -p "$dst" + install -v -m644 "$src" "$dst/${addonId}.xpi" + ''; + }; + + settings = + pkgs.lib.recursiveUpdate + { + # Allow my custom css + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + + # might improve performance TODO + "gfx.webrender.all" = true; + + # disable updates (pretty pointless with nix) + "extensions.update.autoUpdateDefault" = false; + "extensions.update.enabled" = false; + "app.update.channel" = "default"; + + "browser.ctrlTab.recentlyUsedOrder" = false; + + "browser.download.useDownloadDir" = true; + "browser.download.dir" = "${config.user.soisha.home}/media/downloads"; + "browser.download.folderList" = 2; # TODO + "browser.download.viewableInternally.typeWasRegistered.svg" = true; + "browser.download.viewableInternally.typeWasRegistered.webp" = true; + "browser.download.viewableInternally.typeWasRegistered.xml" = true; + + # TODO what does this do? + "browser.search.widget.inNavBar" = true; + + "browser.shell.checkDefaultBrowser" = false; + "browser.tabs.loadInBackground" = true; + "browser.urlbar.placeholderName" = "Brave"; + + "general.autoScroll" = true; + + # Set the tabs and bookmarks + "browser.tabs.inTitlebar" = 1; + "browser.toolbars.bookmarks.visibility" = "always"; + + # Theme + "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + + # highlight all entries when searching + "findbar.highlightAll" = true; + + # TODO + #"extensions.webcompat.enable_picture_in_picture_overrides" = true; + #"extensions.webcompat.enable_shims" = true; + #"extensions.webcompat.perform_injections" = true; + #"extensions.webcompat.perform_ua_overrides" = true; + + # onlykey / copied from a yubikey config + #"security.webauth.u2f" = true; + #"security.webauth.webauthn" = true; + #"security.webauth.webauthn_enable_softtoken" = true; + #"security.webauth.webauthn_enable_usbtoken" = true; + } + builtins.readFile + "${user_js}/user.nix"; +in { + home-manager.users.${config.soisha.user.username} = { + packages = [ + pkgs.firefox-wayland + ]; + sessionVariables = { + # improve touch input & make scrolling smother + MOZ_USE_XINPUT2 = "1"; + # improve wayland support + MOZ_ENABLE_WAYLAND = 1; + XDG_CURRENT_DESKTOP = "river"; + }; + xdg.mimeApps = { + enable = true; + defaultApplications = { + "text/html" = ["firefox.desktop"]; + "x-scheme-handler/http" = ["firefox.desktop"]; + "x-scheme-handler/https" = ["firefox.desktop"]; + "x-scheme-handler/about" = ["firefox.desktop"]; + "x-scheme-handler/unknown" = ["firefox.desktop"]; + }; + }; + programs.firefox = { + enable = true; + package = pkgs.firefox; + extensions = builtins.map buildFirefoxXpiAddon (lib.attrValues (lib.importJSON ./extensions.json)); + profile."default" = { + isDefault = true; + id = 0; + name = "default"; + + userChrome = builtins.readFile "./chrome/userChrome.css"; + + search = { + default = "Brave Search"; + force = true; + + engines = { + "Brave Search" = { + urls = [{template = "https://search.brave.com/search?q={searchTerms}";}]; + iconUpdateURL = "https://cdn.search.brave.com/serp/v1/static/brand/8eabe183f0d1f2cb3e2916b7b20c310efd196d740c8cecd341732fcd396fb665-apple-touch-icon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = ["@bs"]; + }; + + "Nix Packages" = { + urls = [ + { + template = "https://search.nixos.org/packages"; + params = [ + { + name = "type"; + value = "packages"; + } + { + name = "query"; + value = "{searchTerms}"; + } + ]; + } + ]; + + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@np"]; + }; + + "NixOS Wiki" = { + urls = [{template = "https://nixos.wiki/index.php?search={searchTerms}";}]; + iconUpdateURL = "https://nixos.wiki/favicon.png"; + updateInterval = 24 * 60 * 60 * 1000; # every day + definedAliases = ["@nw"]; + }; + "Bing".metaData.hidden = true; + "Google".metaData.hidden = true; + "Amazon.de".metaData.hidden = true; + }; + }; + + bookmarks = [ + { + name = "Rust::std"; + # TODO + url = "file:///home/dt/.local/share/rustup/toolchains/stable-x86_64-unknown-linux-gnu/share/doc/rust/html/std/all.html"; + } + + { + name = "Feed - Piped"; + url = "https://piped.kavin.rocks/feed"; + } + + { + name = "DeepL Translate"; + url = "https://www.deepl.com/translator#en/de/test"; + } + + { + name = "Google Scholar"; + url = "https://scholar.google.com/"; + } + + { + name = "ArchWiki"; + url = "https://wiki.archlinux.org/"; + } + + { + name = "Arch Package "; + url = "https://archlinux.org/packages/"; + } + + { + name = "layout.css.devPixelsPerPx"; + url = "about:config"; + } + ]; + inherit settings; + }; + }; + }; +} diff --git a/home-manager/firefox/extensions.json b/home-manager/firefox/extensions.json new file mode 100644 index 00000000..a7673612 --- /dev/null +++ b/home-manager/firefox/extensions.json @@ -0,0 +1,30 @@ +{ + "darkreader": { + "pname": "darkreader", + "version": "4.9.62", + "addonId": "addon@darkreader.org", + "url": "https://addons.mozilla.org/firefox/downloads/file/4053589/darkreader-4.9.62.xpi", + "sha256": "sha256:e537a2cee45ed7c26f79ecd3ed362620e3f00d24c158532a58e163a63a3d60cc" + }, + "firenvim": { + "pname": "firenvim", + "version": "0.2.14", + "addonId": "firenvim@lacamb.re", + "url": "https://addons.mozilla.org/firefox/downloads/file/4026386/firenvim-0.2.14.xpi", + "sha256": "sha256:a8c495a59e30eaabbb3fcd188db9b5e28b40bffefe41a3f0fa22ecc58c80c2b6" + }, + "keepassxc-browser": { + "pname": "keepassxc-browser", + "version": "1.8.4", + "addonId": "keepassxc-browser@keepassxc.org", + "url": "https://addons.mozilla.org/firefox/downloads/file/4045866/keepassxc_browser-1.8.4.xpi", + "sha256": "sha256:cc39aa058cb8915cfc88424e2e1cebe3ccfc3f95d7bddb2abd0c4905d2b17719" + }, + "simple-tab-groups": { + "pname": "simple-tab-groups", + "version": "4.7.2.1", + "addonId": "simple-tab-groups@drive4ik", + "url": "https://addons.mozilla.org/firefox/downloads/file/3873608/simple_tab_groups-4.7.2.1.xpi", + "sha256": "sha256:75077589098ca62c00b86cf9554c6120bf8dc04c5f916fe26f84915f5147b2a4" + } +} \ No newline at end of file diff --git a/home-manager/firefox/generate-extension.py b/home-manager/firefox/generate-extension.py new file mode 100755 index 00000000..cfb73542 --- /dev/null +++ b/home-manager/firefox/generate-extension.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +# source: https://github.com/etu/nixconfig/blob/ba47d577c8bfb4a1c06927c34ece34118f4a0460/modules/graphical/firefox/generate.py + +from concurrent.futures import ThreadPoolExecutor +import json +import os +import requests + +EXTENSIONS = sorted([ + "darkreader", + "firenvim", + "keepassxc-browser", + "simple-tab-groups", +]) + +def index_ext(ext: str): + print(f"Indexing {ext}...") + + resp = requests.get(f"https://addons.mozilla.org/api/v5/addons/addon/{ext}/").json() + rel = resp["current_version"] + + if not rel["file"]["hash"].startswith("sha256:"): + raise ValueError("Unhandled hash type") + + return { + "pname": ext, + "version": rel["version"], + "addonId": resp["guid"], + "url": rel["file"]["url"], + "sha256": rel["file"]["hash"], + } + +if __name__ == "__main__": + outfile = os.path.dirname(os.path.realpath(__file__)) + "/extensions.json" + + with ThreadPoolExecutor() as e: + extensions = {ext: e.submit(index_ext, ext) for ext in EXTENSIONS} + extensions = {k: v.result() for k, v in extensions.items()} + + with open(outfile, "w") as f: + json.dump(extensions, f, indent=2) diff --git a/home-manager/firefox/settings.nix b/home-manager/firefox/settings.nix new file mode 100644 index 00000000..f38e23b3 --- /dev/null +++ b/home-manager/firefox/settings.nix @@ -0,0 +1,660 @@ +{config, ...}: { + settings = { + accessibility.typeaheadfind.flashBar = 0; + + app = { + normandy = { + first_run = false; + migrationsApplied = 12; + startupRolloutPrefs.extensions.webcompat.disabled_shims.AdvertisingDotCom = true; + user_id = "9b445ee0-1055-4b05-ad18-cdcfd8d15cdb"; + }; + + update.lastUpdateTime = { + addon-background-update-timer = 1675712908; + browser-cleanup-thumbnails = 1675795148; + recipe-client-addon-run = 1675774559; + region-update-timer = 1675779021; + rs-experiment-loader-timer = 1675777057; + search-engine-update-timer = 1675777177; + services-settings-poll-changes = 1675710065; + telemetry_modules_ping = 1675779141; + xpi-signature-verification = 1675706945; + }; + }; + + browser = { + anchor_color = "#57e389"; + + bookmarks = { + editDialog.confirmationHintShowCount = 3; + restore_default_bookmarks = false; + }; + + contentblocking = { + category = "custom"; + cfr-milestone.milestone-achieved = 10000; + report.hide_vpn_banner = true; + }; + + contextual-services.contextId = "{c840a4ea-6278-46b7-bb56-21d7faab57dd}"; + + discovery.enabled = false; + + display = { + background_color = "#551a8b"; + foreground_color = "#ffbe6f"; + use_system_colors = true; + }; + + download = { + dir = "/home/dt/media/downloads"; + folderList = 2; + lastDir = "/home/dt/media/downloads"; + panel.shown = true; + viewableInternally.typeWasRegistered.avif = true; + viewableInternally.typeWasRegistered.webp = true; + }; + + eme.ui.firstContentShown = true; + + engagement = { + ctrlTab.has-used = true; + downloads-button.has-used = true; + }; + + firefox-view.feature-tour = { + message = "FIREFOX_VIEW_FEATURE_TOUR"; + screen = ""; + complete = true; + }; + + firefox-view.view-count = 1; + + laterrun.bookkeeping = { + profileCreationTime = 1654872928; + sessionCount = 39; + }; + + migration.version = 133; + + newtabpage = { + activity-stream = { + impressionId = "{ade7a2f2-7d8f-49b0-a684-d2bb3bda1e09}"; + improvesearch.topSiteSearchShortcuts.havePinned = "google"; + }; + pinned = "[]"; + storageVersion = 1; + }; + + pageActions.persistedActions = { + ids = ["bookmark"]; + idsInUrlbar = ["bookmark"]; + idsInUrlbarPreProton = []; + version = 1; + }; + + pagethumbnails.storage_version = 3; + + protections_panel.infoMessage.seen = true; + + proton.toolbar.version = 3; + + region.update.updated = 1675779022; + + "rights.3.shown" = true; + + safebrowsing.provider = { + google4.lastupdatetime = "1675794837495"; + google4.nextupdatetime = "1675796650495"; + mozilla.lastupdatetime = "1675795004767"; + mozilla.nextupdatetime = "1675816604767"; + }; + + search = { + region = "DE"; + separatePrivateDefault.urlbarResult.enabled = false; + }; + + sessionstore.upgradeBackup.latestBuildID = "20230130183437"; + + shell.mostRecentDateSetAsDefault = "1675756595"; + + startup = { + couldRestoreSession.count = 1; + homepage_override.buildID = "20230130183437"; + homepage_override.mstone = "109.0.1"; + lastColdStartupCheck = 1675756594; + page = 3; + upgradeDialog.version = 106; + }; + + tabs.inTitlebar = 1; + + toolbars.bookmarks.visibility = "always"; + + uiCustomization.state = { + placements = { + widget-overflow-fixed-list = []; + unified-extensions-area = ["yt_pause_example_com-browser-action" "_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action"]; + + nav-bar = [ + "back-button" + "forward-button" + "stop-reload-button" + "urlbar-container" + "save-to-pocket-button" + "downloads-button" + "fxa-toolbar-menu-button" + "enhancerforyoutube_maximerf_addons_mozilla_org-browser-action" + "plasma-browser-integration_kde_org-browser-action" + "tab-stash_condordes_net-browser-action" + "addon_darkreader_org-browser-action" + "vim-vixen_i-beam_org-browser-action" + "simple-tab-groups_drive4ik-browser-action" + "e2933bff1d77b6ea81b2df1dda992244e7892b6c_temporary-addon-browser-action" + "74a30c85e187d69156225de1c415366fafa84866_temporary-addon-browser-action" + "e6fd60f4f456c06312d75c0eceabef8ee0c28bbb_temporary-addon-browser-action" + "addon_example_com-browser-action" + "pause_example_com-browser-action" + "stackoverflowtweakstools_richard_com-browser-action" + "keepassxc-browser_keepassxc_org-browser-action" + "firenvim_lacamb_re-browser-action" + ]; + + toolbar-menubar = ["menubar-items"]; + + TabsToolbar = ["tabbrowser-tabs" "new-tab-button" "alltabs-button"]; + PersonalToolbar = ["personal-bookmarks"]; + + seen = [ + "save-to-pocket-button" + "enhancerforyoutube_maximerf_addons_mozilla_org-browser-action" + "plasma-browser-integration_kde_org-browser-action" + "developer-button" + "tab-stash_condordes_net-browser-action" + "addon_darkreader_org-browser-action" + "vim-vixen_i-beam_org-browser-action" + "simple-tab-groups_drive4ik-browser-action" + "_762f9885-5a13-4abd-9c77-433dcd38b8fd_-browser-action" + "e2933bff1d77b6ea81b2df1dda992244e7892b6c_temporary-addon-browser-action" + "74a30c85e187d69156225de1c415366fafa84866_temporary-addon-browser-action" + "e6fd60f4f456c06312d75c0eceabef8ee0c28bbb_temporary-addon-browser-action" + "addon_example_com-browser-action" + "pause_example_com-browser-action" + "yt_pause_example_com-browser-action" + "stackoverflowtweakstools_richard_com-browser-action" + "keepassxc-browser_keepassxc_org-browser-action" + "firenvim_lacamb_re-browser-action" + ]; + dirtyAreaCache = ["nav-bar" "toolbar-menubar" "PersonalToolbar" "unified-extensions-area"]; + currentVersion = 18; + newElementCount = 6; + browser = { + urlbar = { + quicksuggest = { + migrationVersion = 2; + scenario = "history"; + }; + tabToSearch.onboard.interactionsLeft = 0; + tipShownCount.searchTip_onboard = 4; + }; + visited_color = "#cdab8f"; + }; + + datareporting.policy = { + dataSubmissionPolicyAcceptedVersion = 2; + dataSubmissionPolicyNotifiedTime = "1655649367480"; + }; + + devtools = { + aboutdebugging = { + collapsibilities.processes = false; + tmpExtDirPath = "/home/dt/repos/javascript/firefox-extension/YouTube-Extension"; + }; + + debugger = { + pending-selected-location = { + sourceId = "source-file=///home/dt/repos/web/i5/test/silas.html"; + line = 0; + column = 0; + sourceActorId = "server0.conn0.windowGlobal423054278666/source25"; + url = "file=///home/dt/repos/web/i5/test/silas.html"; + }; + prefs-schema-version = 11; + }; + everOpened = true; + netmonitor = { + columnsData = [ + { + name = "status"; + minWidth = 30; + width = 6.67; + } + { + name = "method"; + minWidth = 30; + width = 6.67; + } + { + name = "domain"; + minWidth = 30; + width = 13.33; + } + { + name = "file"; + minWidth = 30; + width = 33.32; + } + { + name = "url"; + minWidth = 30; + width = 25; + } + { + name = "initiator"; + minWidth = 30; + width = 13.33; + } + { + name = "type"; + minWidth = 30; + width = 6.67; + } + { + name = "transferred"; + minWidth = 30; + width = 13.33; + } + { + name = "contentSize"; + minWidth = 30; + width = 6.67; + } + { + name = "waterfall"; + minWidth = 150; + width = 11.11; + } + ]; + customRequest = { + "method" = "GET"; + "url" = ""; + "urlQueryParams" = []; + "headers" = []; + "postBody" = ""; + }; + msg.visibleColumns = ["data" "time"]; + panes-search-height = 1175; + panes-search-width = 466; + }; + performance.recording = { + entries = 134217728; + features = ["screenshots" "js" "cpu"]; + threads = ["GeckoMain" "Compositor" "Renderer" "DOM Worker"]; + }; + + selfxss.count = 5; + + toolbox = { + alwaysOnTop = false; + footer.height = 692; + host = "right"; + previousHost = "bottom"; + selectedTool = "webconsole"; + sidebar.width = 699; + splitconsoleEnabled = true; + }; + + toolsidebar-height.inspector = 350; + "toolsidebar-width.inspector" = 244; # TODO + toolsidebar-width.inspector.splitsidebar = 0; + + webconsole.filter = { + css = true; + filter = { + net = true; + netxhr = true; + }; + + input = { + editor = true; + editorOnboarding = false; + }; + + persistlog = true; + timestampMessages = true; + }; + }; + distribution = { + archlinux.bookmarksProcessed = true; + iniFile.exists = { + appversion = "109.0.1"; + value = true; + }; + }; + + doh-rollout = { + balrog-migration-done = true; + doneFirstRun = true; + home-region = "DE"; + }; + + dom = { + forms.autocomplete.formautofill = true; + push.userAgentID = "5e34b02066224519abd755189f802422"; + security.https_only_mode_ever_enabled = true; + }; + + extensions = { + activeThemeID = "default-theme@mozilla.org"; + blocklist.pingCountVersion = -1; + databaseSchema = 35; + formautofill.creditCards.used = 2; + getAddons = { + cache.lastUpdate = 1675712909; + databaseSchema = 6; + }; + + lastAppBuildId = "20230130183437"; + lastAppVersion = "109.0.1"; + + lastPlatformVersion = "109.0.1"; + + pendingOperations = false; + pictureinpicture.enable_picture_in_picture_overrides = true; + systemAddonSet = { + "schema" = 1; + "addons" = {}; + }; + ui = { + dictionary.hidden = true; + extension.hidden = false; + lastCategory = "addons://list/extension"; + locale.hidden = true; + sitepermission.hidden = true; + theme.hidden = false; + }; + + webcompat = { + enable_shims = true; + perform_injections = true; + perform_ua_overrides = true; + }; + + webextensions = { + ExtensionStorageIDB.migrated = { + "addon@darkreader.org" = true; + "enhancerforyoutube@maximerf.addons.mozilla.org" = true; + "firenvim@lacamb.re" = true; + "keepassxc-browser@keepassxc.org" = true; + "screenshots@mozilla.org" = true; + "simple-tab-groups@drive4ik" = true; + "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = true; + }; + uuids = { + "doh-rollout@mozilla.org" = "3830b9af-a7ab-45ae-a10a-df08c432e9f7"; + "formautofill@mozilla.org" = "e05754ff-1fe6-4e78-84dc-f5cc845da180"; + "pictureinpicture@mozilla.org" = "d7135e8a-368e-4f92-bd09-e19c0975de7f"; + "screenshots@mozilla.org" = "6a611696-f2f7-41c4-bb4e-a56eda2447a5"; + "webcompat-reporter@mozilla.org" = "99972218-65f7-4a9a-9f1d-8dcd1f86a563"; + "webcompat@mozilla.org" = "71ce01a8-6fa2-4b21-ba57-59b36478daf6"; + "default-theme@mozilla.org" = "f8e9414d-e977-4d2a-8941-93bf72212b01"; + "addons-search-detection@mozilla.com" = "344d2821-32ec-418f-8665-32c5ae14c40b"; + "google@search.mozilla.org" = "caa826ac-7699-4cdc-9a01-3b35145dbb92"; + "wikipedia@search.mozilla.org" = "ee7a4ba4-10d2-440b-a259-33fc62084480"; + "bing@search.mozilla.org" = "bb80bdc4-bd41-47a8-b9d5-10d4a57f2b2d"; + "ddg@search.mozilla.org" = "2ad38783-b68d-41f2-a76d-c4e800f65d64"; + "amazon@search.mozilla.org" = "aac3e95f-8267-4182-b8a2-2b949160adb7"; + "enhancerforyoutube@maximerf.addons.mozilla.org" = "1ecb30aa-dd3a-4e1c-b405-7400176b683a"; + "@contain-facebook" = "7e386381-dd25-43f7-9fcc-c3f541f2a458"; + "addon@darkreader.org" = "9b7b4403-7e99-4138-a9a9-114b72299253"; + "simple-tab-groups@drive4ik" = "3f29df14-5127-4de4-863c-17846549e474"; + "{762f9885-5a13-4abd-9c77-433dcd38b8fd}" = "3f954cd9-0f14-4595-ba83-4dc0f318e002"; + "e2933bff1d77b6ea81b2df1dda992244e7892b6c@temporary-addon" = "b6ad60ec-a560-427d-aaac-c2c568d69495"; + "pause@example.com" = "87db7ee4-2820-4a56-bb94-9d837886e029"; + "yt_pause@example.com" = "ba2218e1-792e-47a5-99ae-942fc46441fd"; + "keepassxc-browser@keepassxc.org" = "00b8fb40-3ba7-4a33-b086-cb71c5bbe952"; + "firenvim@lacamb.re" = "cf26e07b-4e07-4a42-978f-30f92409ae88"; + }; + }; + }; + + findbar.highlightAll = true; + + fission.experiment.max-origins = { + last-disqualified = 1675596365; + last-qualified = 1675793855; + qualified = false; + }; + + gecko.handlerService.defaultHandlersVersion = 1; + + gfx.blacklist = { + layers.opengl.failureid = "FEATURE_FAILURE_SOFTWARE_GL"; + + "vaapi" = 4; + "vaapi.failureid" = "FEATURE_FAILURE_VAAPI_TEST_FAILED"; + }; + + idle.lastDailyNotification = 1675756850; + + intl.regional_prefs.use_os_locales = true; + + media = { + eme.enabled = true; + + gmp-gmpopenh264 = { + abi = "x86_64-gcc3"; + lastDownload = 1668329402; + lastDownloadFailReason = "Error: Failed downloading via ServiceRequest, status: 0, reason: error"; + lastDownloadFailed = 1666889531; + lastInstallStart = 1668329400; + lastUpdate = 1668329402; + version = "1.8.1.2"; + }; + + gmp-manager = { + buildID = "20230130183437"; + lastCheck = 1675756691; + lastEmptyCheck = 1675756691; + }; + + gmp-widevinecdm = { + abi = "x86_64-gcc3"; + lastDownload = 1674828538; + lastInstallStart = 1674828533; + lastUpdate = 1674828538; + version = "4.10.2557.0"; + }; + + gmp.storage.version.observed = 1; + + videocontrols.picture-in-picture.video-toggle.enabled = false; + }; + + network = { + cookie.cookieBehavior = 1; + http.referer.disallowCrossSiteRelaxingDefault.top_navigation = true; + }; + + pdfjs = { + enabledCache.state = true; + migrationVersion = 2; + }; + + permissions.default = { + camera = 2; + desktop-notification = 2; + geo = 2; + microphone = 2; + xr = 2; + }; + + places.database.lastMaintenance = 1675756852; + + pref.privacy.disable_button = { + tracking_protection_exceptions = false; + view_passwords = false; + }; + + print = { + more-settings.open = true; + print = { + printer_Brother.print_in_color = false; + + printer_Brother_DCP_9022CDW = { + print_duplex = 0; + print_footercenter = ""; + print_footerleft = ""; + print_footerright = ""; + print_headercenter = ""; + print_headerleft = ""; + print_headerright = ""; + print_in_color = false; + }; + }; + + print_printer = "Brother_DCP_9022CDW"; + }; + + privacy = { + annotate_channels.strict_list.enabled = true; + donottrackheader.enabled = true; + partition.network_state.ocsp_cache = true; + + purge_trackers = { + date_in_cookie_database = "0"; + last_purge = "1675756851136"; + }; + + "query_stripping.enabled" = true; # TODO + query_stripping.enabled.pbmode = true; + + restrict3rdpartystorage.rollout.enabledByDefault = true; + + sanitize.pending = [ + { + "id" = "newtab-container"; + "itemsToClear" = []; + "options" = {}; + } + ]; + + trackingprotection = { + enabled = true; + socialtracking.enabled = true; + }; + + userContext = { + enabled = true; + extension = "simple-tab-groups@drive4ik"; + ui.enabled = true; + }; + }; + + security = { + remote_settings = { + crlite_filters.checked = 1656529337; + intermediates.checked = 1656529337; + }; + + sandbox.content.tempDirSuffix = "86b82f75-b18b-4db2-a563-ba4380a07a97"; + }; + + services = { + blocklist = { + addons-mlbf.checked = 1656684436; + gfx.checked = 1656684436; + }; + + settings = { + blocklists = { + addons-bloomfilters.last_check = 1675773838; + gfx.last_check = 1675772639; + }; + + clock_skew_seconds = 0; + last_etag = 1675795222827; + last_update_seconds = 1675795598; + + main = { + addons-manager-settings.last_check = 1675772639; + anti-tracking-url-decoration.last_check = 1675772639; + cfr.last_check = 1675772639; + cookie-banner-rules-list.last_check = 1675772639; + devtools-compatibility-browsers.last_check = 1675772639; + devtools-devices.last_check = 1675772639; + doh-config.last_check = 1675772639; + doh-providers.last_check = 1675772639; + fxmonitor-breaches.last_check = 1675772639; + hijack-blocklists.last_check = 1675772639; + language-dictionaries.last_check = 1675772639; + message-groups.last_check = 1675772639; + ms-images.last_check = 1675772639; + nimbus-desktop-experiments.last_check = 1675793197; + normandy-recipes-capabilities.last_check = 1675772639; + partitioning-exempt-urls.last_check = 1675772639; + password-recipes.last_check = 1675772639; + password-rules.last_check = 1675772639; + personality-provider-models.last_check = 1675772639; + personality-provider-recipe.last_check = 1675772639; + pioneer-study-addons-v1.last_check = 1675772639; + public-suffix-list.last_check = 1675772639; + query-stripping.last_check = 1675772639; + search-config.last_check = 1675772639; + search-default-override-allowlist.last_check = 1675772639; + search-telemetry-v2.last_check = 1675772639; + sites-classification.last_check = 1675772639; + tippytop.last_check = 1675772639; + top-sites.last_check = 1675772639; + url-classifier-skip-urls.last_check = 1675772639; + websites-with-shared-credential-backends.last_check = 1675772639; + whats-new-panel.last_check = 1675772639; + }; + + security-state = { + cert-revocations.last_check = 1675772639; + intermediates.last_check = 1675772639; + onecrl.last_check = 1675772639; + }; + security.onecrl.checked = 1656529337; + }; + + sync = { + clients.lastSync = "0"; + declinedEngines = ""; + globalScore = 0; + nextSync = 0; + tabs.lastSync = "0"; + }; + }; + + signon.rememberSignons = false; + + storage.vacuum.last = { + index = 1; + places.sqlite = 1673364894; + }; + + svg.context-properties.content.enabled = true; + + toolkit = { + legacyUserProfileCustomizations.stylesheets = true; + + startup.last_success = 1675756592; + + telemetry = { + cachedClientID = "7d88e3fb-f77d-4d7e-8aa5-623d7349a4dc"; + pioneer-new-studies-available = true; + reportingpolicy.firstRun = false; + previousBuildID = "20230130183437"; + }; + }; + + trailhead.firstrun.didSeeAboutWelcome = true; + }; + }; + }; + }; +} diff --git a/home-manager/firefox/settings/override.js b/home-manager/firefox/settings/override.js new file mode 100644 index 00000000..1f92735b --- /dev/null +++ b/home-manager/firefox/settings/override.js @@ -0,0 +1,137 @@ +/* + 0100: STARTUP + 0200: GEOLOCATION / LANGUAGE / LOCALE + 0300: QUIETER FOX + 0400: SAFE BROWSING + 0600: BLOCK IMPLICIT OUTBOUND + 0700: DNS / DoH / PROXY / SOCKS / IPv6 + 0800: LOCATION BAR / SEARCH BAR / SUGGESTIONS / HISTORY / FORMS + 0900: PASSWORDS + 1000: DISK AVOIDANCE + 1200: HTTPS (SSL/TLS / OCSP / CERTS / HPKP) + 1400: FONTS + 1600: HEADERS / REFERERS + 1700: CONTAINERS + 2000: PLUGINS / MEDIA / WEBRTC + 2400: DOM (DOCUMENT OBJECT MODEL) + 2600: MISCELLANEOUS + 2700: ETP (ENHANCED TRACKING PROTECTION) + 2800: SHUTDOWN & SANITIZING + 4500: RFP (RESIST FINGERPRINTING) + 5000: OPTIONAL OPSEC + 5500: OPTIONAL HARDENING + 6000: DON'T TOUCH + 7000: DON'T BOTHER + 8000: DON'T BOTHER: FINGERPRINTING + 9000: NON-PROJECT RELATED + 9999: DEPRECATED / REMOVED / LEGACY / RENAMED +*/ + + +// restore session +user_pref("browser.startup.page", 3); // 0102 + +user_pref("browser.startup.homepage", "file:///home/dt/home.html"); // 0103 +user_pref("browser.newtabpage.enabled", true); // 0104 + +// disable the geoservice, TODO don't know if I want this +//user_pref("geo.provider.use_geoclue", false); // 0202 + +// TODO is this something useful? +user_pref("datareporting.policy.dataSubmissionEnabled", true); // 0330 + +// enable health reports +user_pref("datareporting.healthreport.uploadEnabled", true); // 0331 + +// Do I want to opt-out? +user_pref("toolkit.telemetry.coverage.opt-out", false); // 0333 + +// enables studies +user_pref("app.shield.optoutstudies.enabled", true); // 0340 + +// I guess that browsing protection is useful +user_pref("browser.safebrowsing.downloads.remote.enabled", true); // 0403 + +// TODO does this (-> set to false) make things slower? +user_pref("network.prefetch-next", true); // 0601 + +// enable ipv6 because the rest of the system uses it +user_pref("network.dns.disableIPv6", true); // 0701 + +// TRR only +user_pref("network.trr.mode", 3); // 0710 + +// I trust my search engine +user_pref("keyword.enabled", true); // 801 +user_pref("browser.search.suggest.enabled", true); // 0804 +user_pref("browser.urlbar.suggest.searches", true); // 0804 + +// prefetch urls, if the get auto completed +user_pref("browser.urlbar.speculativeConnect.enabled", true); // 0805 + +// TODO I might want to enable this +//user_pref("browser.urlbar.suggest.quicksuggest.nonsponsored", false); // 0807 + +// TODO enable form and search history? +//user_pref("browser.formfill.enable", false); // 0810 + +// disk cache should help performance +user_pref("browser.cache.disk.enable", true); // 1001 + +// store extra session data (form content, cookies and POST data) 0: everywhere +user_pref("browser.sessionstore.privacy_level", 0); // 1003 + +// Disable unsafe passive content (images) on https sites +user_pref("security.mixed_content.block_display_content", true); // 1241 + +// Disable the eme banner +user_pref("browser.eme.ui.enabled", false); // 2022 + +// Don't delete my precious temp files +user_pref("browser.helperApps.deleteTempFileOnExit", false); // 2603 + +// Download to the download dir +user_pref("browser.download.useDownloadDir", true); // 2651 + +// Open the download panel +user_pref("browser.download.alwaysOpenPanel", true); // 2652 + +// Block after custom ruleset +user_pref("browser.contentblocking.category", "custom"); // 2701 + +// set the custome settings // 7016 +user_pref("network.cookie.cookieBehavior", 1); +user_pref("network.http.referer.disallowCrossSiteRelaxingDefault", true); +user_pref("network.http.referer.disallowCrossSiteRelaxingDefault.top_navigation", true); +user_pref("privacy.partition.network_state.ocsp_cache", true); +user_pref("privacy.query_stripping.enabled", true); +user_pref("privacy.trackingprotection.enabled", true); +user_pref("privacy.trackingprotection.socialtracking.enabled", true); +user_pref("privacy.trackingprotection.cryptomining.enabled", true); +user_pref("privacy.trackingprotection.fingerprinting.enabled", true); + + +// I might want to change that, when it hinders session restore +//user_pref("privacy.partition.always_partition_third_party_non_cookie_storage.exempt_sessionstorage", false); // 2720 + +// I like my history very much! +user_pref("privacy.sanitize.sanitizeOnShutdown", false); // 2810 + +// The downsides (light theme + potential breakages): +//user_pref("privacy.resistFingerprinting", true); // 4501 +user_pref("privacy.resistFingerprinting.letterboxing", false); // 4504 + +// I would like to keep my gl, even in the web +user_pref("webgl.disabled", false); // 4520 + +// I like my service workers and am using a service using them. +user_pref("dom.serviceWorkers.enabled", true); // 7017 + +// I've got a password manager already +user_pref("signon.rememberSignons", false); // 5003 + +// Do not track header +user_pref("privacy.donottrackheader.enabled", true); // 7015 + +// TODO no idea what this does, enabling it +user_pref("browser.urlbar.showSearchTerms.enabled", true); // 9004 diff --git a/home-manager/firefox/unzip_mozlz4.py b/home-manager/firefox/unzip_mozlz4.py new file mode 100755 index 00000000..311fd214 --- /dev/null +++ b/home-manager/firefox/unzip_mozlz4.py @@ -0,0 +1,43 @@ +#!/usr/bin/python +# source: https://unix.stackexchange.com/a/497861 +# Command-line tool to decompress mozLz4 files used for example by Firefox to store various kinds of session backup information. +# Works in both Python 2.7.15 and 3.6.7, as of version 2.1.6 of the LZ4 Python bindings at pypi.org/project/lz4. +# To use in another script, simply cut and paste the import statement and the mozlz4_to_text() function (lines 8 to 17). + +import lz4.block # pip install lz4 --user + + +def mozlz4_to_text(filepath): + # Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file, + # return the uncompressed text. + bytestream = open(filepath, "rb") + bytestream.read(8) # skip past the b"mozLz40\0" header + valid_bytes = bytestream.read() + text = lz4.block.decompress(valid_bytes) + return text + + +def main(args): + # Given command-line arguments of an input filepath for a ".mozlz4" file + # and optionally an output filepath, write the decompressed text to the + # output filepath. + # Default output filepath is the input filepath minus the last three characters + # (e.g. "foo.jsonlz4" becomes "foo.json") + filepath_in = args[0] + if len(args) < 2: + filepath_out = filepath_in[:-3] + else: + filepath_out = args[1] + text = mozlz4_to_text(filepath_in) + with open(filepath_out, "wb") as outfile: + outfile.write(text) + print("Wrote decompressed text to {}".format(filepath_out)) + + +if __name__ == "__main__": + import sys + args = sys.argv[1:] + if args and not args[0] in ("--help", "-h"): + main(args) + else: + print("Usage: mozlz4.py <mozlz4 file to read> <location to write>") |