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]>
29 lines
1004 B
TypeScript
29 lines
1004 B
TypeScript
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`;
|
|
}
|