From 92e8a5d7fed56aa296588ab03bb561f4e905fad0 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Wed, 7 Feb 2024 17:51:37 -0500 Subject: [PATCH 1/4] Adds url whitelist regex to ext options --- build/UserALEWebExtension/background.js | 90 ++++++++++++++++------ build/UserALEWebExtension/options.js | 15 +++- build/UserALEWebExtension/optionsPage.html | 4 + src/UserALEWebExtension/background.js | 63 +++++++++++---- src/UserALEWebExtension/options.js | 12 ++- src/UserALEWebExtension/optionsPage.html | 4 + 6 files changed, 145 insertions(+), 43 deletions(-) diff --git a/build/UserALEWebExtension/background.js b/build/UserALEWebExtension/background.js index 82a41c07..42a35502 100644 --- a/build/UserALEWebExtension/background.js +++ b/build/UserALEWebExtension/background.js @@ -428,6 +428,30 @@ var intervalCounter; var intervalLog; var cbHandlers = {}; +/** + * Adds named callbacks to be executed when logging. + * @param {Object } newCallbacks An object containing named callback functions. + */ +function addCallbacks() { + for (var _len = arguments.length, newCallbacks = new Array(_len), _key = 0; _key < _len; _key++) { + newCallbacks[_key] = arguments[_key]; + } + newCallbacks.forEach(function (source) { + var descriptors = Object.keys(source).reduce(function (descriptors, key) { + descriptors[key] = Object.getOwnPropertyDescriptor(source, key); + return descriptors; + }, {}); + Object.getOwnPropertySymbols(source).forEach(function (sym) { + var descriptor = Object.getOwnPropertyDescriptor(source, sym); + if (descriptor.enumerable) { + descriptors[sym] = descriptor; + } + }); + Object.defineProperties(cbHandlers, descriptors); + }); + return cbHandlers; +} + /** * Assigns the config and log container to be used by the logging functions. * @param {Array} newLogs Log container. @@ -1082,21 +1106,21 @@ function log(customLog) { } } -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. */ @@ -1131,11 +1155,18 @@ var defaultConfig = { authHeader: null, toolName: 'useralePlugin', version: version + }, + pluginConfig: { + // Default to a regex that will match no string + urlWhitelist: '(?!x)x' } }; -browser.storage.local.get(defaultConfig, function (res) { - options(res.useraleConfig); -}); +var urlWhitelist; +function updateConfig(config) { + urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist); + options(config.useraleConfig); + dispatchTabMessage(config.useraleConfig); +} function dispatchTabMessage(message) { browser.tabs.query({}, function (tabs) { tabs.forEach(function (tab) { @@ -1143,20 +1174,33 @@ function dispatchTabMessage(message) { }); }); } -browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { +function filterUrl(log) { + if (urlWhitelist.test(log.pageUrl)) { + return log; + } + return false; +} +browser.storage.local.get(defaultConfig, function (res) { + addCallbacks({ + filterUrl: filterUrl + }); + updateConfig(res); +}); +browser.runtime.onMessage.addListener(function (message) { switch (message.type) { // Handles logs rerouted from content and option scripts case ADD_LOG: - var log$1 = message.payload; + var var log$1 = filterUrl$1 = message.payload; if ("tab" in sender && "id" in sender.tab) { log$1["tabId"] = sender.tab.id; } log(log$1); + if (log$1) { + log(log$1); + } break; case CONFIG_CHANGE: - console.log(message); - options(message.payload); - dispatchTabMessage(message); + updateConfig(message.payload); break; default: console.log('got unknown message type ', message); diff --git a/build/UserALEWebExtension/options.js b/build/UserALEWebExtension/options.js index 8528ad8c..628b79e1 100644 --- a/build/UserALEWebExtension/options.js +++ b/build/UserALEWebExtension/options.js @@ -1142,13 +1142,17 @@ function setConfig() { if (config.userId && password) { config.authHeader = "Basic " + btoa("".concat(config.userId, ":").concat(password)); } - browser.storage.local.set({ - useraleConfig: config - }, function () { + var payload = { + useraleConfig: config, + pluginConfig: { + urlWhitelist: document.getElementById("filter").value + } + }; + browser.storage.local.set(payload, function () { options(config); browser.runtime.sendMessage({ type: CONFIG_CHANGE, - payload: config + payload: payload }); }); } @@ -1161,6 +1165,9 @@ function getConfig() { document.getElementById("tool").value = config.toolName; document.getElementById("version").value = config.version; }); + browser.storage.local.get("pluginConfig", function (res) { + document.getElementById("filter").value = res.pluginConfig.urlWhitelist; + }); } document.addEventListener("DOMContentLoaded", getConfig); document.addEventListener("submit", setConfig); diff --git a/build/UserALEWebExtension/optionsPage.html b/build/UserALEWebExtension/optionsPage.html index ff92cf09..9a3f363b 100644 --- a/build/UserALEWebExtension/optionsPage.html +++ b/build/UserALEWebExtension/optionsPage.html @@ -45,6 +45,10 @@

Options


+ + +
+
diff --git a/src/UserALEWebExtension/background.js b/src/UserALEWebExtension/background.js index 9e70d06c..8c33b3f2 100644 --- a/src/UserALEWebExtension/background.js +++ b/src/UserALEWebExtension/background.js @@ -24,17 +24,27 @@ import * as userale from '../main.js'; import { browser } from './globals.js'; // Initalize userale plugin options -const defaultConfig = {useraleConfig: { - url: 'http://localhost:8000', - userId: 'pluginUser', - authHeader: null, - toolName: 'useralePlugin', - version: userale.version, -}}; +const defaultConfig = { + useraleConfig: { + url: 'http://localhost:8000', + userId: 'pluginUser', + authHeader: null, + toolName: 'useralePlugin', + version: userale.version, + }, + pluginConfig: { + // Default to a regex that will match no string + urlWhitelist: '(?!x)x' + } +}; -browser.storage.local.get(defaultConfig, (res) => { - userale.options(res.useraleConfig); -}); +var urlWhitelist; + +function updateConfig(config) { + urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist); + userale.options(config.useraleConfig); + dispatchTabMessage(config.useraleConfig); +} function dispatchTabMessage(message) { browser.tabs.query({}, function (tabs) { @@ -44,6 +54,30 @@ function dispatchTabMessage(message) { }); } +function filterUrl(log) { + if(urlWhitelist.test(log.pageUrl)) { + return log + } + return false; +} + +browser.storage.local.get(defaultConfig, (res) => { + userale.addCallbacks({filterUrl:filterUrl}); + updateConfig(res); +}); + +function filterUrl(log) { + if(urlWhitelist.test(log.pageUrl)) { + return log + } + return false; +} + +browser.storage.local.get(defaultConfig, (res) => { + userale.addCallbacks({filterUrl:filterUrl}); + updateConfig(res); +}); + browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { switch (message.type) { // Handles logs rerouted from content and option scripts @@ -52,13 +86,14 @@ browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { if("tab" in sender && "id" in sender.tab) { log["tabId"] = sender.tab.id; } - userale.log(log); + log = filterUrl(log); + if(log) { + userale.log(log); + } break; case MessageTypes.CONFIG_CHANGE: - console.log(message); - userale.options(message.payload); - dispatchTabMessage(message); + updateConfig(message.payload); break; default: diff --git a/src/UserALEWebExtension/options.js b/src/UserALEWebExtension/options.js index b2ecbdb9..53b57659 100644 --- a/src/UserALEWebExtension/options.js +++ b/src/UserALEWebExtension/options.js @@ -39,9 +39,14 @@ function setConfig() { config.authHeader = "Basic " + btoa(`${config.userId}:${password}`); } - browser.storage.local.set({useraleConfig: config}, () => { + let payload = { + useraleConfig: config, + pluginConfig: {urlWhitelist: document.getElementById("filter").value} + }; + + browser.storage.local.set(payload, () => { userale.options(config); - browser.runtime.sendMessage({ type: MessageTypes.CONFIG_CHANGE, payload: config }); + browser.runtime.sendMessage({ type: MessageTypes.CONFIG_CHANGE, payload: payload }); }); } @@ -55,6 +60,9 @@ function getConfig() { document.getElementById("tool").value = config.toolName; document.getElementById("version").value = config.version; }); + browser.storage.local.get("pluginConfig", (res) => { + document.getElementById("filter").value = res.pluginConfig.urlWhitelist; + }); } document.addEventListener("DOMContentLoaded", getConfig); diff --git a/src/UserALEWebExtension/optionsPage.html b/src/UserALEWebExtension/optionsPage.html index ff92cf09..9a3f363b 100644 --- a/src/UserALEWebExtension/optionsPage.html +++ b/src/UserALEWebExtension/optionsPage.html @@ -45,6 +45,10 @@

Options


+ + +
+
From e9a99af28aab0a29fb48eceb3b713ae47fc4b9c8 Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 8 Feb 2024 10:46:20 -0500 Subject: [PATCH 2/4] Updates from feedback --- build/UserALEWebExtension/background.js | 16 +++++++--------- build/UserALEWebExtension/content.js | 4 +--- build/UserALEWebExtension/options.js | 4 +--- src/UserALEWebExtension/background.js | 11 +++++++++-- src/UserALEWebExtension/content.js | 2 +- src/UserALEWebExtension/options.js | 4 ++-- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/build/UserALEWebExtension/background.js b/build/UserALEWebExtension/background.js index 42a35502..7628b4c3 100644 --- a/build/UserALEWebExtension/background.js +++ b/build/UserALEWebExtension/background.js @@ -1174,6 +1174,8 @@ function dispatchTabMessage(message) { }); }); } + +// Filter out logs with urls that do not match the regex defined in extension options. function filterUrl(log) { if (urlWhitelist.test(log.pageUrl)) { return log; @@ -1181,20 +1183,16 @@ function filterUrl(log) { return false; } browser.storage.local.get(defaultConfig, function (res) { - addCallbacks({ - filterUrl: filterUrl - }); + // Apply url filter to logs generated by the background page. + addCallbacks(filterUrl); updateConfig(res); }); browser.runtime.onMessage.addListener(function (message) { switch (message.type) { - // Handles logs rerouted from content and option scripts + // Handles logs rerouted from content and option scripts. case ADD_LOG: - var var log$1 = filterUrl$1 = message.payload; - if ("tab" in sender && "id" in sender.tab) { - log$1["tabId"] = sender.tab.id; - } - log(log$1); + // Apply url filter to logs generated outside the background page. + var log$1 = filterUrl(message.payload); if (log$1) { log(log$1); } diff --git a/build/UserALEWebExtension/content.js b/build/UserALEWebExtension/content.js index 2c158e64..fd9c5e1f 100644 --- a/build/UserALEWebExtension/content.js +++ b/build/UserALEWebExtension/content.js @@ -1128,9 +1128,7 @@ function rerouteLog(log) { browser.storage.local.get("useraleConfig", function (res) { options(res.useraleConfig); - addCallbacks({ - reroute: rerouteLog - }); + addCallbacks(rerouteLog); }); browser.runtime.onMessage.addListener(function (message) { if (message.type === CONFIG_CHANGE) { diff --git a/build/UserALEWebExtension/options.js b/build/UserALEWebExtension/options.js index 628b79e1..330c8313 100644 --- a/build/UserALEWebExtension/options.js +++ b/build/UserALEWebExtension/options.js @@ -1126,9 +1126,7 @@ function rerouteLog(log) { * limitations under the License. */ -addCallbacks({ - reroute: rerouteLog -}); +addCallbacks(rerouteLog); function setConfig() { var config = { url: document.getElementById("url").value, diff --git a/src/UserALEWebExtension/background.js b/src/UserALEWebExtension/background.js index 8c33b3f2..b095127e 100644 --- a/src/UserALEWebExtension/background.js +++ b/src/UserALEWebExtension/background.js @@ -43,6 +43,7 @@ var urlWhitelist; function updateConfig(config) { urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist); userale.options(config.useraleConfig); + // TODO: tabs need a page load to apply this config change. dispatchTabMessage(config.useraleConfig); } @@ -54,6 +55,7 @@ function dispatchTabMessage(message) { }); } +// Filter out logs with urls that do not match the regex defined in extension options. function filterUrl(log) { if(urlWhitelist.test(log.pageUrl)) { return log @@ -62,7 +64,8 @@ function filterUrl(log) { } browser.storage.local.get(defaultConfig, (res) => { - userale.addCallbacks({filterUrl:filterUrl}); + // Apply url filter to logs generated by the background page. + userale.addCallbacks(filterUrl); updateConfig(res); }); @@ -80,13 +83,17 @@ browser.storage.local.get(defaultConfig, (res) => { browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { switch (message.type) { - // Handles logs rerouted from content and option scripts + // Handles logs rerouted from content and option scripts. case MessageTypes.ADD_LOG: +<<<<<<< HEAD let log = message.payload; if("tab" in sender && "id" in sender.tab) { log["tabId"] = sender.tab.id; } + // Apply url filter to logs generated outside the background page. log = filterUrl(log); +======= +>>>>>>> 9f626ab (Updates from feedback) if(log) { userale.log(log); } diff --git a/src/UserALEWebExtension/content.js b/src/UserALEWebExtension/content.js index 101882b4..135a97d0 100644 --- a/src/UserALEWebExtension/content.js +++ b/src/UserALEWebExtension/content.js @@ -23,7 +23,7 @@ import { rerouteLog, browser } from './globals.js'; browser.storage.local.get("useraleConfig", (res) => { userale.options(res.useraleConfig); - userale.addCallbacks({reroute: rerouteLog}); + userale.addCallbacks(rerouteLog); }); browser.runtime.onMessage.addListener(function (message) { diff --git a/src/UserALEWebExtension/options.js b/src/UserALEWebExtension/options.js index 53b57659..8dc593ef 100644 --- a/src/UserALEWebExtension/options.js +++ b/src/UserALEWebExtension/options.js @@ -20,7 +20,7 @@ import * as MessageTypes from './messageTypes.js'; import * as userale from '../main.js' import { rerouteLog, browser } from './globals.js'; -userale.addCallbacks({reroute: rerouteLog}); +userale.addCallbacks(rerouteLog); // TODO: Warn users when setting credentials with unsecured connection. const mitmWarning = "Setting credentials with http will expose you to a MITM attack. Are you sure you want to continue?"; @@ -46,7 +46,7 @@ function setConfig() { browser.storage.local.set(payload, () => { userale.options(config); - browser.runtime.sendMessage({ type: MessageTypes.CONFIG_CHANGE, payload: payload }); + browser.runtime.sendMessage({ type: MessageTypes.CONFIG_CHANGE, payload }); }); } From a761d672a7f51e5994c8bbda4a058778dc45682b Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 8 Feb 2024 11:21:51 -0500 Subject: [PATCH 3/4] Fix rebase issues --- build/UserALEWebExtension/background.js | 39 ++++++++++++++----------- src/UserALEWebExtension/background.js | 15 ---------- 2 files changed, 22 insertions(+), 32 deletions(-) diff --git a/build/UserALEWebExtension/background.js b/build/UserALEWebExtension/background.js index 7628b4c3..15301ba7 100644 --- a/build/UserALEWebExtension/background.js +++ b/build/UserALEWebExtension/background.js @@ -1106,21 +1106,21 @@ function log(customLog) { } } -/* -* Licensed to the Apache Software Foundation (ASF) under one or more -* contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. -* The ASF licenses this file to You under the Apache License, Version 2.0 -* (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. */ @@ -1165,6 +1165,7 @@ var urlWhitelist; function updateConfig(config) { urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist); options(config.useraleConfig); + // TODO: tabs need a page load to apply this config change. dispatchTabMessage(config.useraleConfig); } function dispatchTabMessage(message) { @@ -1187,12 +1188,16 @@ browser.storage.local.get(defaultConfig, function (res) { addCallbacks(filterUrl); updateConfig(res); }); -browser.runtime.onMessage.addListener(function (message) { +browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { switch (message.type) { // Handles logs rerouted from content and option scripts. case ADD_LOG: + var log$1 = message.payload; + if ("tab" in sender && "id" in sender.tab) { + log$1["tabId"] = sender.tab.id; + } // Apply url filter to logs generated outside the background page. - var log$1 = filterUrl(message.payload); + log$1 = filterUrl(log$1); if (log$1) { log(log$1); } diff --git a/src/UserALEWebExtension/background.js b/src/UserALEWebExtension/background.js index b095127e..25652b53 100644 --- a/src/UserALEWebExtension/background.js +++ b/src/UserALEWebExtension/background.js @@ -69,31 +69,16 @@ browser.storage.local.get(defaultConfig, (res) => { updateConfig(res); }); -function filterUrl(log) { - if(urlWhitelist.test(log.pageUrl)) { - return log - } - return false; -} - -browser.storage.local.get(defaultConfig, (res) => { - userale.addCallbacks({filterUrl:filterUrl}); - updateConfig(res); -}); - browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { switch (message.type) { // Handles logs rerouted from content and option scripts. case MessageTypes.ADD_LOG: -<<<<<<< HEAD let log = message.payload; if("tab" in sender && "id" in sender.tab) { log["tabId"] = sender.tab.id; } // Apply url filter to logs generated outside the background page. log = filterUrl(log); -======= ->>>>>>> 9f626ab (Updates from feedback) if(log) { userale.log(log); } From 08a63380b80954e5aec1bf1e47aad072da7f264f Mon Sep 17 00:00:00 2001 From: Jason Young Date: Thu, 8 Feb 2024 11:42:55 -0500 Subject: [PATCH 4/4] Fix syntax --- build/UserALEWebExtension/background.js | 6 +++++- build/UserALEWebExtension/content.js | 5 ++++- build/UserALEWebExtension/options.js | 5 ++++- src/UserALEWebExtension/background.js | 2 +- src/UserALEWebExtension/content.js | 2 +- src/UserALEWebExtension/options.js | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/build/UserALEWebExtension/background.js b/build/UserALEWebExtension/background.js index 15301ba7..5b7123b1 100644 --- a/build/UserALEWebExtension/background.js +++ b/build/UserALEWebExtension/background.js @@ -1163,6 +1163,7 @@ var defaultConfig = { }; var urlWhitelist; function updateConfig(config) { + console.log(config); urlWhitelist = new RegExp(config.pluginConfig.urlWhitelist); options(config.useraleConfig); // TODO: tabs need a page load to apply this config change. @@ -1185,7 +1186,9 @@ function filterUrl(log) { } browser.storage.local.get(defaultConfig, function (res) { // Apply url filter to logs generated by the background page. - addCallbacks(filterUrl); + addCallbacks({ + filterUrl: filterUrl + }); updateConfig(res); }); browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { @@ -1199,6 +1202,7 @@ browser.runtime.onMessage.addListener(function (message, sender, sendResponse) { // Apply url filter to logs generated outside the background page. log$1 = filterUrl(log$1); if (log$1) { + console.log("match"); log(log$1); } break; diff --git a/build/UserALEWebExtension/content.js b/build/UserALEWebExtension/content.js index fd9c5e1f..8dcf1de1 100644 --- a/build/UserALEWebExtension/content.js +++ b/build/UserALEWebExtension/content.js @@ -1100,6 +1100,7 @@ function options(newConfig) { // browser is defined in firefox, but chrome uses the 'chrome' global. var browser = browser || chrome; function rerouteLog(log) { + console.log("reroute"); browser.runtime.sendMessage({ type: ADD_LOG, payload: log @@ -1128,7 +1129,9 @@ function rerouteLog(log) { browser.storage.local.get("useraleConfig", function (res) { options(res.useraleConfig); - addCallbacks(rerouteLog); + addCallbacks({ + rerouteLog: rerouteLog + }); }); browser.runtime.onMessage.addListener(function (message) { if (message.type === CONFIG_CHANGE) { diff --git a/build/UserALEWebExtension/options.js b/build/UserALEWebExtension/options.js index 330c8313..ba979862 100644 --- a/build/UserALEWebExtension/options.js +++ b/build/UserALEWebExtension/options.js @@ -1100,6 +1100,7 @@ function options(newConfig) { // browser is defined in firefox, but chrome uses the 'chrome' global. var browser = browser || chrome; function rerouteLog(log) { + console.log("reroute"); browser.runtime.sendMessage({ type: ADD_LOG, payload: log @@ -1126,7 +1127,9 @@ function rerouteLog(log) { * limitations under the License. */ -addCallbacks(rerouteLog); +addCallbacks({ + rerouteLog: rerouteLog +}); function setConfig() { var config = { url: document.getElementById("url").value, diff --git a/src/UserALEWebExtension/background.js b/src/UserALEWebExtension/background.js index 25652b53..90160ad7 100644 --- a/src/UserALEWebExtension/background.js +++ b/src/UserALEWebExtension/background.js @@ -65,7 +65,7 @@ function filterUrl(log) { browser.storage.local.get(defaultConfig, (res) => { // Apply url filter to logs generated by the background page. - userale.addCallbacks(filterUrl); + userale.addCallbacks({filterUrl}); updateConfig(res); }); diff --git a/src/UserALEWebExtension/content.js b/src/UserALEWebExtension/content.js index 135a97d0..2e7bbf93 100644 --- a/src/UserALEWebExtension/content.js +++ b/src/UserALEWebExtension/content.js @@ -23,7 +23,7 @@ import { rerouteLog, browser } from './globals.js'; browser.storage.local.get("useraleConfig", (res) => { userale.options(res.useraleConfig); - userale.addCallbacks(rerouteLog); + userale.addCallbacks({rerouteLog}); }); browser.runtime.onMessage.addListener(function (message) { diff --git a/src/UserALEWebExtension/options.js b/src/UserALEWebExtension/options.js index 8dc593ef..caa442a6 100644 --- a/src/UserALEWebExtension/options.js +++ b/src/UserALEWebExtension/options.js @@ -20,7 +20,7 @@ import * as MessageTypes from './messageTypes.js'; import * as userale from '../main.js' import { rerouteLog, browser } from './globals.js'; -userale.addCallbacks(rerouteLog); +userale.addCallbacks({rerouteLog}); // TODO: Warn users when setting credentials with unsecured connection. const mitmWarning = "Setting credentials with http will expose you to a MITM attack. Are you sure you want to continue?";