librewolf

This commit is contained in:
4DBug committed 2026-10-18 02:51:04 -05:00
1 parent 74076952e2
commit 08d30a3976
7 files changed
+145 -121

No files matched your search

Generated
+42 -80
View File
@@ -104,6 +104,22 @@
"type": "gitlab"
}
},
"bugpass": {
"flake": false,
"locked": {
"lastModified": 1792308657,
"narHash": "sha256-7ab6OqpM9pttdVwgw3iP1nIKY0hLctOctsWb0lz+w54=",
"ref": "refs/heads/main",
"rev": "b98739ca84501ba2f84095af3b3a72d6f41d14ed",
"revCount": 2,
"type": "git",
"url": "https://git.bug.tools/bug/bugpass"
},
"original": {
"type": "git",
"url": "https://git.bug.tools/bug/bugpass"
}
},
"catppuccin": {
"inputs": {
"nixpkgs": "nixpkgs"
@@ -122,48 +138,29 @@
"type": "github"
}
},
"catppuccin-userstyles": {
"flake": false,
"locked": {
"lastModified": 1749817927,
"narHash": "sha256-lftRs+pfcOrqHDtDWX/Vd/CQvDJguCRxlhI/aIkIB/k=",
"owner": "catppuccin",
"repo": "userstyles",
"rev": "714b153c7022c362a37ab8530286a87e4484a828",
"type": "github"
},
"original": {
"owner": "catppuccin",
"repo": "userstyles",
"type": "github"
}
},
"catppuccin-userstyles-nix": {
"inputs": {
"catppuccin-userstyles": "catppuccin-userstyles",
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems"
]
},
"locked": {
"lastModified": 1772639159,
"narHash": "sha256-kMVdp61rzAowZ7ukYq+eam6DMbOSCFXcydKyYjjm7lg=",
"owner": "4DBug",
"repo": "catppuccin-userstyles-nix",
"rev": "20756f27c723caeda354950e89cd9dc041a7b1a7",
"type": "github"
"lastModified": 1792307213,
"narHash": "sha256-nbpgkLLjYeptb9LgUYp62gaGxO0nNDjM416YSGN+SS4=",
"ref": "refs/heads/main",
"rev": "4f84143a8ba2e1854ef1ef6010518d14dcf9a121",
"revCount": 2179,
"type": "git",
"url": "https://git.bug.tools/bug/userstyles"
},
"original": {
"owner": "4DBug",
"repo": "catppuccin-userstyles-nix",
"type": "github"
"type": "git",
"url": "https://git.bug.tools/bug/userstyles"
}
},
"copyparty": {
"inputs": {
"flake-utils": "flake-utils_2",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs_2"
},
"locked": {
@@ -432,27 +429,6 @@
}
},
"flake-utils": {
"inputs": {
"systems": [
"catppuccin-userstyles-nix",
"systems"
]
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1678901627,
"narHash": "sha256-U02riOqrKKzwjsxc/400XnElV+UtPUQWpANPlyazjH0=",
@@ -467,9 +443,9 @@
"type": "github"
}
},
"flake-utils_3": {
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
@@ -485,9 +461,9 @@
"type": "github"
}
},
"flake-utils_4": {
"flake-utils_3": {
"inputs": {
"systems": "systems_3"
"systems": "systems_2"
},
"locked": {
"lastModified": 1791914995,
@@ -704,7 +680,7 @@
},
"minecraft": {
"inputs": {
"flake-utils": "flake-utils_3",
"flake-utils": "flake-utils_2",
"metadata": [
"minecraft-metadata"
],
@@ -726,7 +702,7 @@
},
"minecraft-metadata": {
"inputs": {
"flake-utils": "flake-utils_4",
"flake-utils": "flake-utils_3",
"nixpkgs": "nixpkgs_7"
},
"locked": {
@@ -1352,6 +1328,7 @@
"root": {
"inputs": {
"auto-cpufreq": "auto-cpufreq",
"bugpass": "bugpass",
"catppuccin": "catppuccin",
"catppuccin-userstyles-nix": "catppuccin-userstyles-nix",
"copyparty": "copyparty",
@@ -1435,7 +1412,7 @@
"nixpkgs": [
"nixpkgs"
],
"systems": "systems_4"
"systems": "systems_3"
},
"locked": {
"lastModified": 1792111133,
@@ -1464,7 +1441,7 @@
"nixpkgs"
],
"nur": "nur",
"systems": "systems_5",
"systems": "systems_4",
"tinted-kitty": "tinted-kitty",
"tinted-schemes": "tinted-schemes",
"tinted-tmux": "tinted-tmux",
@@ -1486,16 +1463,16 @@
},
"systems": {
"locked": {
"lastModified": 1689347949,
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default-linux",
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default-linux",
"repo": "default",
"type": "github"
}
},
@@ -1515,21 +1492,6 @@
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_4": {
"locked": {
"lastModified": 1680978846,
"narHash": "sha256-Gtqg8b/v49BFDpDetjclCYXm8mAnTrUzR0JnE2nv5aw=",
@@ -1544,7 +1506,7 @@
"type": "github"
}
},
"systems_5": {
"systems_4": {
"locked": {
"lastModified": 1774449309,
"narHash": "sha256-brhZ8DmuGtzkCYHJg4HEd602amKm89Y9ytsFZ5uWD1w=",
+5 -1
View File
@@ -8,9 +8,13 @@
url = "github:AdnanHodzic/auto-cpufreq";
inputs.nixpkgs.follows = "nixpkgs";
};
bugpass = {
url = "git+https://git.bug.tools/bug/bugpass";
flake = false;
};
catppuccin.url = "github:catppuccin/nix";
catppuccin-userstyles-nix = {
url = "github:4DBug/catppuccin-userstyles-nix";
url = "git+https://git.bug.tools/bug/userstyles";
inputs.nixpkgs.follows = "nixpkgs";
};
copyparty.url = "github:9001/copyparty";
@@ -0,0 +1,13 @@
const filter = { urls: ["*://*.youtube.com/*", "*://youtu.be/*"] };
// Full page loads (address bar, external links, new tabs).
browser.webRequest.onBeforeRequest.addListener(({ url }) => {
const redirectUrl = redirectFor(url);
if (redirectUrl) return { redirectUrl };
}, { ...filter, types: ["main_frame"] }, ["blocking"]);
// SPAs (e.g. YouTube) navigate via history.pushState, no request.
browser.webNavigation.onHistoryStateUpdated.addListener(({ tabId, frameId, url }) => {
const target = frameId === 0 && redirectFor(url);
if (target) browser.tabs.update(tabId, { url: target });
}, { url: [{ hostSuffix: "youtube.com" }] });
@@ -0,0 +1,17 @@
// Rewrite links just before they're used (click, middle-click, context menu),
// so "open in new tab" / "copy link" already point at the redirect target.
const rewrite = (e) => {
const a = e.target.closest?.("a[href]");
if (!a) return;
const target = redirectFor(new URL(a.href, location.href).href);
if (!target) return;
a.href = target;
if (e.type === "click" && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
e.preventDefault();
e.stopImmediatePropagation();
location.href = target;
}
};
for (const t of ["mousedown", "auxclick", "contextmenu", "click"])
document.addEventListener(t, rewrite, true);
@@ -0,0 +1,14 @@
{
"manifest_version": 2,
"name": "Redirect",
"version": "2.0",
"browser_specific_settings": { "gecko": { "id": "redirect@local" } },
"permissions": ["webRequest", "webRequestBlocking", "webNavigation", "tabs", "*://*.youtube.com/*", "*://youtu.be/*"],
"background": { "scripts": ["rules.js", "background.js"] },
"content_scripts": [{
"matches": ["*://*.youtube.com/*"],
"js": ["rules.js", "content.js"],
"run_at": "document_start",
"all_frames": true
}]
}
@@ -0,0 +1,17 @@
// Site rules: each returns a redirect URL or nothing. Add new sites here
// (and their hosts to manifest.json permissions/matches).
const rules = [
// YouTube -> Invidious
(u) => {
const q = u.search.slice(1);
if (/^(www\.|m\.)?youtube\.com$/.test(u.hostname) && u.pathname === "/watch")
return `https://@domain@/watch?${q}`;
if (u.hostname === "youtu.be" && u.pathname.length > 1)
return `https://@domain@/watch?v=${u.pathname.slice(1)}${q ? "&" + q : ""}`;
},
];
const redirectFor = (url) => {
const u = new URL(url);
for (const r of rules) { const t = r(u); if (t) return t; }
};
+37 -40
View File
@@ -1,44 +1,40 @@
{ lib, ... }: {
{ lib, inputs, ... }: {
flake-file.inputs.catppuccin-userstyles-nix = {
url = "github:4DBug/catppuccin-userstyles-nix";
url = "git+https://git.bug.tools/bug/userstyles";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-file.inputs.bugpass = {
url = "git+https://git.bug.tools/bug/bugpass";
flake = false;
};
den.aspects.software.browsers = {
homeManager = { host, ... }: {
# Redirector has no managed storage schema; import once via its settings.
xdg.configFile."redirector/invidious.json".text = builtins.toJSON {
createdBy = "Redirector v3.5.3";
createdAt = "2026-10-17T00:00:00.000Z";
redirects = map (r: {
error = null;
excludePattern = "";
patternDesc = "";
patternType = "R";
processMatches = "noProcessing";
disabled = false;
grouped = false;
appliesTo = [ "main_frame" ];
} // r) [
{
description = "YouTube to Invidious";
exampleUrl = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
exampleResult = "https://tube.${host.domain}/watch?v=dQw4w9WgXcQ";
includePattern = "^https?://(www\\.|m\\.)?youtube\\.com/watch\\?(.*)$";
redirectUrl = "https://tube.${host.domain}/watch?$2";
}
{
description = "youtu.be to Invidious";
exampleUrl = "https://youtu.be/dQw4w9WgXcQ";
exampleResult = "https://tube.${host.domain}/watch?v=dQw4w9WgXcQ&";
includePattern = "^https?://youtu\\.be/([^?&]+)\\??(.*)$";
redirectUrl = "https://tube.${host.domain}/watch?v=$1&$2";
}
];
homeManager = { host, pkgs, ... }: let
mkExtension = src: vars: extra: rec {
id = (builtins.fromJSON (builtins.readFile "${src}/manifest.json")).browser_specific_settings.gecko.id;
xpi = pkgs.runCommand "${lib.head (lib.splitString "@" id)}.xpi" { nativeBuildInputs = [ pkgs.zip ]; } ''
cp -r ${src} src && chmod -R u+w src && cd src
for f in $(find . -type f); do
substituteInPlace "$f" ${lib.concatStringsSep " " (lib.mapAttrsToList (k: v: "--replace-quiet @${k}@ ${lib.escapeShellArg v}") vars)}
done
${lib.optionalString (extra != null) "cp -r ${extra}/. ."}
zip -r -X $out .
'';
};
bugpass = import "${inputs.bugpass}/build" { inherit pkgs; };
localExtensions = [
(mkExtension ./_extensions/redirect { domain = "tube.${host.domain}"; } null)
(mkExtension "${inputs.bugpass}/extension" { } bugpass.lib)
];
in {
programs.librewolf = {
enable = true;
nativeMessagingHosts = [ bugpass.host ];
settings = {
"browser.startup.homepage" = "https://search.${host.domain}";
"browser.startup.page" = 3;
@@ -63,7 +59,7 @@
"browser.crashReports.unsubmittedCheck.enabled" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"privacy.resistFingerprinting.letterboxing" = true;
"privacy.resistFingerprinting.letterboxing" = false; # true adds a border around every page (window-size fingerprinting protection)
"privacy.donottrackheader.enabled" = true;
"privacy.globalprivacycontrol.enabled" = true;
"privacy.resistFingerprinting" = false;
@@ -97,6 +93,8 @@
"browser.theme.content-theme" = 0;
"layout.css.prefers-color-scheme.content-override" = 0;
"xpinstall.signatures.required" = false;
};
profiles.default = {
@@ -179,13 +177,13 @@
settings = {
"{7a7a4a92-a2a0-41d1-9fd7-1e92480d612d}" = {
force = true;
/*settings = inputs.catppuccin-userstyles-nix.stylusSettings.${pkgs.stdenv.hostPlatform.system} {
settings = inputs.catppuccin-userstyles-nix.stylusSettings.${pkgs.stdenv.hostPlatform.system} {
global = {
lightFlavor = "mocha";
darkFlavor = "mocha";
accentColor = "mauve";
};
};*/
};
};
};
};
@@ -234,14 +232,13 @@
"uBlock0@raymondhill.net" # ublock-origin
"contact@lesspass.com" # lesspass
"{a6c4a591-f1b2-4f03-b3ff-767e5bedf4e7}" # user-agent-string-switcher
"{762f9885-5a13-4abd-9c77-433dcd38b8fd}" # return-youtube-dislikes
"redirector@einaregilsson.com" # redirector
]);
]) // lib.listToAttrs (map (e: lib.nameValuePair e.id {
install_url = "file://${e.xpi}";
installation_mode = "force_installed";
}) localExtensions);
};
};
};