summaryrefslogtreecommitdiff
path: root/roles/jibri-install/templates/chrome-extension-background.js.j2
diff options
context:
space:
mode:
Diffstat (limited to 'roles/jibri-install/templates/chrome-extension-background.js.j2')
-rw-r--r--roles/jibri-install/templates/chrome-extension-background.js.j241
1 files changed, 41 insertions, 0 deletions
diff --git a/roles/jibri-install/templates/chrome-extension-background.js.j2 b/roles/jibri-install/templates/chrome-extension-background.js.j2
new file mode 100644
index 0000000..10eb1ed
--- /dev/null
+++ b/roles/jibri-install/templates/chrome-extension-background.js.j2
@@ -0,0 +1,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
+ });
+ }
+
+});