MCPcopy Create free account
hub / github.com/Exafunction/codeium-chrome / computeAllowlist

Function computeAllowlist

src/storage.ts:22–47  ·  view source on GitHub ↗
(
  allowlist:
    | {
        defaults: string[];
        current: string[];
      }
    | undefined
)

Source from the content-addressed store, hash-verified

20// In case the defaults change over time, reconcile the saved setting with the
21// new default allowlist.
22export function computeAllowlist(
23 allowlist:
24 | {
25 defaults: string[];
26 current: string[];
27 }
28 | undefined
29): string[] {
30 if (allowlist === undefined) {
31 allowlist = {
32 defaults: [],
33 current: [],
34 };
35 }
36 for (const newDefault of defaultAllowlist) {
37 if (!allowlist.defaults.includes(newDefault) && !allowlist.current.includes(newDefault)) {
38 allowlist.current.push(newDefault);
39 }
40 }
41 for (const oldDefault of allowlist.defaults) {
42 if (!defaultAllowlist.includes(oldDefault) && allowlist.current.includes(oldDefault)) {
43 allowlist.current.splice(allowlist.current.indexOf(oldDefault), 1);
44 }
45 }
46 return allowlist.current;
47}
48
49export function getStorageData(): Promise<Storage> {
50 return new Promise((resolve, reject) => {

Callers 2

script.tsFile · 0.90
EditableListFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected