NeverDecaf / chromium-web-store

Allows adding extensions from chrome web store on ungoogled-chromium. Also adds semi-automatic extension updating.
MIT License
2.35k stars 78 forks source link

Add (or document?) a mechanism for a system wide install #153

Open berolinux opened 4 months ago

berolinux commented 4 months ago

Hi, we're using Ungoogled Chromium as the main browser in our Linux distro (OpenMandriva), and would like to make extensions "just work" for the users. This project seems to be the right way to go about it - and works perfectly when installed as described in README.md. But there doesn't seem to be a way to automatically install it with ungoogled chromium for all users on the system -- every user seems to have to install the CRX through chromium's UI.

It would be nice to have a way to just have an unattended system wide installation of the plugin.

NeverDecaf commented 4 months ago

I believe you can achieve this with the ExtensionInstallForcelist policy. #28 may also be of interest to you.

berolinux commented 4 months ago

Thanks, but it doesn't seem to work...

I've put this in /etc/chromium/policies/managed/extensions.json:

{
  "ExtensionInstallForceList": [
    "ocaahdebbfolfmndjeplogmgcagdmblk;https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates.xml"
  ]
}

I've also tried some variants that are even closer to what I'd like to see, e.g.

{
  "ExtensionInstallForceList": [
    "ocaahdebbfolfmndjeplogmgcagdmblk;file:///usr/share/chromium/extensions/webstore/updates.xml"
  ]
}

and the one that should really come closest to what I'm trying to achieve:

{
  "ExtensionSettings": {
    "*": {
      "installation_mode": "allowed"
    },
    "ocaahdebbfolfmndjeplogmgcagdmblk": {
      "installation_mode": "normal_installed",
      "update_url":
        "file:///usr/share/chromium/extensions/webstore/updates.xml"
    }
  }
}

where /usr/share/chromium/extensions/webstore/updates.xml says

<?xml version='1.0' encoding='UTF-8'?>
<gupdate xmlns='http://www.google.com/update2/response' protocol='2.0'>
  <app appid='ocaahdebbfolfmndjeplogmgcagdmblk'>
    <updatecheck codebase='file:///usr/share/chromium/extensions/webstore/Chromium.Web.Store.crx' version='1.5.4.3' status='ok' />
  </app>
</gupdate>

and /usr/share/chromium/extensions/webstore/Chromium.Web.Store.crx is an already downloaded copy of Chromium.Web.Store.crx.

None of those seem to have any effect whatsover - the "My Extensions" list in chrome://extensions/ remains empty.

However, as soon as /etc/chromium/policies/managed/extensions.json exists, it says "Your browser is managed by your organization" (and that message goes away again when deleting the json file), so it looks like the file is in the right place.

Am I missing something?

NeverDecaf commented 4 months ago

I wish I had a better answer for you but after working with several google APIs my assumption would be that it simply doesn't work because this feature wasn't maintained. I was able to find several mentions of master_preferences which may be an alternative (see: https://www.chromium.org/administrators/pre-installed-extensions/) but beyond this I don't know of any non-hacky way to pre-install extensions. I assume it is possible by editing the user data directory but have never done it. You may have more luck opening an issue at the ungoogled chromium repo.