Install Cookie-Editor in every computer's browser

A managed Chrome policy, written as root into each running computer's
container on provision and every sync-computers run, installs the
default extensions (normal_installed: can be turned off, not removed).
Existing computers get it without being recreated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-27 14:18:36 +01:00
co-authored by Claude Opus 5.5
parent dd6b48fcf5
commit ac1048c8f3
9 changed files with 181 additions and 3 deletions
+24
View File
@@ -0,0 +1,24 @@
import { describe, expect, test } from "bun:test";
import { ComputerBrowserExtensions } from "@/src/data/computer-browser-extensions";
import computerBrowserPolicy from "./computer-browser-policy";
describe("computerBrowserPolicy", () => {
test("installs every default extension from the Web Store, turned off but not removed", () => {
const policy = JSON.parse(computerBrowserPolicy());
for (const { id } of ComputerBrowserExtensions) {
expect(policy.ExtensionSettings[id]).toEqual({
installation_mode: "normal_installed",
update_url: "https://clients2.google.com/service/update2/crx",
});
}
});
test("is the same text for the same list", () => {
expect(computerBrowserPolicy()).toBe(computerBrowserPolicy());
});
test("an empty list installs nothing", () => {
expect(JSON.parse(computerBrowserPolicy({ extensions: [] }))).toEqual({ ExtensionSettings: {} });
});
});
+28
View File
@@ -0,0 +1,28 @@
import { ComputerBrowserExtensions } from "@/src/data/computer-browser-extensions";
/**
* Where Chrome fetches Web Store extensions from.
*/
const WebStoreUpdateUrl = "https://clients2.google.com/service/update2/crx";
type Params = {
extensions?: ReadonlyArray<{ id: string }>;
};
/**
* The managed policy file (`AppData.ComputerBrowserPolicyFile`) a
* computer's Chrome reads: each extension (`ComputerBrowserExtensions` by
* default) installed from the Web Store, which the user may turn off but
* not remove. Always the same text for the same list, so a computer that
* already has it is left alone.
*/
export default function computerBrowserPolicy({ extensions = ComputerBrowserExtensions }: Params = {}) {
const settings = Object.fromEntries(
extensions.map(({ id }) => [
id,
{ installation_mode: "normal_installed", update_url: WebStoreUpdateUrl },
]),
);
return `${JSON.stringify({ ExtensionSettings: settings }, null, 4)}\n`;
}