summaryrefslogtreecommitdiff
path: root/roles/jibri-install/templates/chrome-extension-background.js.j2
blob: 10eb1ed1211faa8b65ee224d27ea345b4940b82f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

chrome.runtime.onInstalled.addListener(function() {
  chrome.storage.managed.get("forcedCookies", managedItems => {
    if (!managedItems.hasOwnProperty('forcedCookies')) {
      return;
    }
    for (const item of managedItems.forcedCookies) {
      chrome.cookies.set({
        url: `https://${item.domain}/`,
        domain: item.domain,
        name: item.name,
        value: item.value
      });
    }
  })

  // temp hack because loading config from managed policies seems too slow
  const forcedCookies = [
    {
      domain: "{{ jitsi_server_host }}",
      name: "rgpd",
      value: "nothing"
    },
    {% for host in cookies_dns|default([]) %}
    {
      domain: "{{ host }}",
      name: "rgpd",
      value: "nothing"
    },
    {% endfor %}
  ];
  for (const item of forcedCookies) {
    chrome.cookies.set({
      url: `https://${item.domain}/`,
      domain: item.domain,
      name: item.name,
      value: item.value
    });
  }

});