Skip to content

Commit

Permalink
Fix syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Jyyjy committed Feb 8, 2024
1 parent a761d67 commit 08a6338
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
6 changes: 5 additions & 1 deletion build/UserALEWebExtension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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) {
Expand All @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion build/UserALEWebExtension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
5 changes: 4 additions & 1 deletion build/UserALEWebExtension/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/UserALEWebExtension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

Expand Down
2 changes: 1 addition & 1 deletion src/UserALEWebExtension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/UserALEWebExtension/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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?";
Expand Down

0 comments on commit 08a6338

Please sign in to comment.