vanadium/firefox: simplify google search engine

The old customized config would trigger the bot detection all the time.
This commit is contained in:
Primrose 2025-08-26 10:36:47 +08:00
parent 570e0124f0
commit 2d2cd5f270
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -1,7 +1,6 @@
{ {
pkgs, pkgs,
config, config,
lib,
... ...
}: let }: let
inherit (pkgs) nur; inherit (pkgs) nur;
@ -11,116 +10,90 @@ in {
policies = { policies = {
SearchEngines = { SearchEngines = {
Default = "Google en@en"; Default = "Google";
Remove = ["Google"]; Add = [
Add = # Forges
# Google specialized for each language x display language {
# reference: https://developers.google.com/custom-search/docs/xml_results?hl=zh-tw#advanced-search-query-parameters Name = "GitHub";
lib.mapCartesianProduct ( Alias = "@ggh";
{ IconURL = "https://github.com/favicon.ico";
lr, Description = "Your code yum yum";
hl, URLTemplate = "https://github.com/search?q={searchTerms}&type=repositories";
}: let }
lr' = lib.substring 0 2 (lib.removePrefix "lang_" lr); {
hl' = lib.substring 0 2 hl; Name = "GitHub (Code Search)";
in { Alias = "@gghc";
Name = "Google ${lr'}@${hl'}"; IconURL = "https://github.com/favicon.ico";
Alias = Description = "Your code yum yum";
if lib.removePrefix "lang_" lr == hl URLTemplate = "https://github.com/search?q={searchTerms}&type=code";
then "@G" + lr' }
else "@G" + lr' + hl'; {
Description = "Your data yum yum (but ${lr'} in ${hl'})"; Name = "Codeberg";
IconURL = "https://google.com/favicon.ico"; Alias = "@gco";
SuggestURLTemplate = "https://suggestqueries.google.com/complete/search?q={searchTerms}&lr=${lr}&hl=${hl}"; IconURL = "https://codeberg.org/favicon.ico";
URLTemplate = "https://google.com/search?q={searchTerms}&lr=${lr}&hl=${hl}"; Description = "Software development, but free!";
} URLTemplate = "https://codeberg.org/explore/repos?q={searchTerms}";
) { }
lr = ["lang_fr" "lang_en" "lang_zh-TW"]; {
hl = ["fr" "en" "zh-TW"]; Name = "?C";
Alias = "@gcc";
IconURL = "https://git.confusedcompiler.org/favicon.ico";
URLTemplate = "https://git.confusedcompiler.org/explore/repos?q={searchTerms}";
} }
++ [
# Forges
{
Name = "GitHub";
Alias = "@ggh";
IconURL = "https://github.com/favicon.ico";
Description = "Your code yum yum";
URLTemplate = "https://github.com/search?q={searchTerms}&type=repositories";
}
{
Name = "GitHub (Code Search)";
Alias = "@gghc";
IconURL = "https://github.com/favicon.ico";
Description = "Your code yum yum";
URLTemplate = "https://github.com/search?q={searchTerms}&type=code";
}
{
Name = "Codeberg";
Alias = "@gco";
IconURL = "https://codeberg.org/favicon.ico";
Description = "Software development, but free!";
URLTemplate = "https://codeberg.org/explore/repos?q={searchTerms}";
}
{
Name = "?C";
Alias = "@gcc";
IconURL = "https://git.confusedcompiler.org/favicon.ico";
URLTemplate = "https://git.confusedcompiler.org/explore/repos?q={searchTerms}";
}
# Nix{,OS,pkgs} # Nix{,OS,pkgs}
{ {
Name = "NixOS Search (Package)"; Name = "NixOS Search (Package)";
Alias = "@np"; Alias = "@np";
IconURL = "https://nixos.org/favicon.ico"; IconURL = "https://nixos.org/favicon.ico";
Description = "Search in nixpkgs"; Description = "Search in nixpkgs";
URLTemplate = "https://search.nixos.org/packages?query={searchTerms}"; URLTemplate = "https://search.nixos.org/packages?query={searchTerms}";
} }
{ {
Name = "NixOS Search (Options)"; Name = "NixOS Search (Options)";
Alias = "@no"; Alias = "@no";
IconURL = "https://nixos.org/favicon.ico"; IconURL = "https://nixos.org/favicon.ico";
Description = "Search in NixOS options"; Description = "Search in NixOS options";
URLTemplate = "https://search.nixos.org/options?query={searchTerms}"; URLTemplate = "https://search.nixos.org/options?query={searchTerms}";
} }
# Haskell # Haskell
{ {
Name = "Flora"; Name = "Flora";
Alias = "@hs"; Alias = "@hs";
IconURL = "https://flora.pm/static/icons/favicon-32x32.png"; IconURL = "https://flora.pm/static/icons/favicon-32x32.png";
URLTemplate = "https://flora.pm/search?q={searchTerms}"; URLTemplate = "https://flora.pm/search?q={searchTerms}";
} }
# Discourse # Discourse
{ {
Name = "NixOS Discourse"; Name = "NixOS Discourse";
Alias = "@nd"; Alias = "@nd";
IconURL = "https://nixos.org/favicon.ico"; IconURL = "https://nixos.org/favicon.ico";
URLTemplate = "https://discourse.nixos.org/search?q={searchTerms}"; URLTemplate = "https://discourse.nixos.org/search?q={searchTerms}";
} }
{ {
Name = "Framework Discourse"; Name = "Framework Discourse";
Alias = "@fd"; Alias = "@fd";
IconURL = "https://frame.work/favicon.ico"; IconURL = "https://frame.work/favicon.ico";
URLTemplate = "https://community.frame.work/search?q={searchTerms}"; URLTemplate = "https://community.frame.work/search?q={searchTerms}";
} }
# Misc # Misc
{ {
Name = "YouTube"; Name = "YouTube";
Alias = "@yt"; Alias = "@yt";
IconURL = "https://youtube.com/favicon.ico"; IconURL = "https://youtube.com/favicon.ico";
SuggestURLTemplate = "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt"; SuggestURLTemplate = "http://suggestqueries.google.com/complete/search?q={searchTerms}&ds=yt";
URLTemplate = "https://www.youtube.com/results?search_query={searchTerms}"; URLTemplate = "https://www.youtube.com/results?search_query={searchTerms}";
} }
{ {
Name = "Genius"; Name = "Genius";
Alias = "@geni"; Alias = "@geni";
IconURL = "https://genius.com/favicon.ico"; IconURL = "https://genius.com/favicon.ico";
URLTemplate = "https://genius.com/search?q={searchTerms}"; URLTemplate = "https://genius.com/search?q={searchTerms}";
} }
]; ];
}; };
}; };