ungoogled-chromium icon indicating copy to clipboard operation
ungoogled-chromium copied to clipboard

Automatic chrome extension installation

Open the-argus opened this issue 3 years ago • 1 comments

Description

Allow for the installation of extensions with bash scripting.

Who's implementing?

  • [ ] I'm willing to implement this feature myself

The problem

I use NixOS, and because extension installation seems to only be able to be done through the UI (either the dropdown option in NeverDecaf/chromium-web-store or "load unpacked" developer option) its not possible to declaratively set up an entire ungoogled chromium profile.

Possible solutions

1.) Have a folder in config which can contain .crx files which will be used by ungoogled chromium.

2.) Add a CLI flag which takes a path to a crx to install as an argument

3.) Add a build option that allows for enabling certain google dependencies, in this case the chrome web store.

Alternatives

Add a CLI equivalent to "load unpacked". However this would shrink the number of automatically install-able extensions to a small set of open source options such as ublock origin and FastForwardTeam/FastForward.

Additional context

As I understand it, installing extensions in CRX form does not require the chrome web store dependency. Correct me if I'm wrong.

the-argus avatar Jul 21 '22 14:07 the-argus

Chromium will load extensions from /usr/share/chromium/extensions, but not raw CRX files. You need to create a json file where the file name is the 32 first characters of the SHA256 checksum of the public key that was used to sign the CRX file. Additionally the file name must be a Chromium-style base16 using the letters a-p instead of 0-f.

This 32-character hash of the signing key is also known as the "extension ID", which you should use for extensions downloaded from the Google store. So if you download uBlock Origin, and create a /usr/share/chromium/extensions/cjpalhdlnbpafiamejdnhcphjbkeiagm.json with the following contents:

{
  "external_crx": "/home/you/ublock-origin.crx",
  "external_version": "1.43.0"
}

...it should get loaded by ungoogled-chromium.

Since you are on NixOS, perhaps you'll find Guix's tools to compute deterministic signing keys and extension IDs useful, some example packages, and finally a patch to make Chromium load extensions from $CHROMIUM_EXTENSION_DIRECTORY instead of /usr/share/chromium/extensions.

mbakke avatar Jul 22 '22 01:07 mbakke

I've opened an issue on nixpkgs to apply the patch you've given me to our build of chromium and ungoogled chromium. Thanks for your help.

the-argus avatar Aug 22 '22 16:08 the-argus