From 2e9ae83daaaf631443e0888143caaaec3d4e359f Mon Sep 17 00:00:00 2001 From: idk Date: Sat, 4 Jan 2020 10:29:41 -0500 Subject: [PATCH] Down to the last of the linter errors, most of the remainder are false-positives --- Makefile | 2 +- background.js | 8 +++----- context.js | 5 ++++- info.js | 2 ++ privacy.js | 10 ++++++++-- proxy.js | 34 +++++++++++++++++----------------- scrub.js | 7 +++++-- 7 files changed, 40 insertions(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 8ed8e9f..ca9f0f0 100644 --- a/Makefile +++ b/Makefile @@ -232,7 +232,7 @@ fmt: find . -path ./node_modules -prune -o -name '*.json' -exec prettier --write {} \; lint: - eslint --color *.js + eslint --fix --color *.js deborig: fmt version rm -rf ../i2psetproxy.js-$(VERSION) diff --git a/background.js b/background.js index 60af48d..42366c4 100644 --- a/background.js +++ b/background.js @@ -265,12 +265,10 @@ function themeWindow(window) { browser.contextualIdentities .get(tabInfo[0].cookieStoreId) .then(onContextGotTheme, onThemeError); + } else if (isEmpty(oldtheme)) { + browser.theme.reset(); } else { - if (isEmpty(oldtheme)) { - browser.theme.reset(); - } else { - browser.theme.update(window.id, oldtheme); - } + browser.theme.update(window.id, oldtheme); } } diff --git a/context.js b/context.js index 2fd7a15..d5a70e6 100644 --- a/context.js +++ b/context.js @@ -33,7 +33,10 @@ function eventHandler(event) { } function createOptions(node, identity) { - for (let option of ["Create", "Close All"]) { + for (let option of [ +"Create", +"Close All" +]) { let alink = document.createElement("a"); alink.href = "#"; alink.innerText = option; diff --git a/info.js b/info.js index eb7ed32..551d082 100644 --- a/info.js +++ b/info.js @@ -55,6 +55,8 @@ document.addEventListener("click", clickEvent => { } refreshIdentity(); } else if (clickEvent.target.id === "window-preface-title") { + console.log("attempting to create homepage tab"); + goHome(); } else if (clickEvent.target.id === "window-visit-homepage") { console.log("attempting to create homepage tab"); goHome(); diff --git a/privacy.js b/privacy.js index 15d2bc0..c7f6ca8 100644 --- a/privacy.js +++ b/privacy.js @@ -167,7 +167,7 @@ function AssurePeerConnection() { value: "proxy_only" }); } - rtc = browser.privacy.network.peerConnectionEnabled.get({}); + let rtc = browser.privacy.network.peerConnectionEnabled.get({}); rtc.then(assure); } @@ -199,7 +199,13 @@ function EnableSavePasswords() { var defaultSettings = { since: "forever", - dataTypes: ["downloads", "passwords", "formData", "localStorage", "history"] + dataTypes: [ +"downloads", +"passwords", +"formData", +"localStorage", +"history" +] }; function onError(therror) { diff --git a/proxy.js b/proxy.js index 6007ca5..19121b8 100644 --- a/proxy.js +++ b/proxy.js @@ -181,11 +181,11 @@ function SetupSettings() { // function checkHostStoredSettings(storedSettings) { - if (storedSettings.proxy_host != undefined) { - proxy_host = storedSettings.proxy_host; - } else { + if (storedSettings.proxy_host == undefined) { proxy_host = "127.0.0.1"; storedSettings.proxy_host = proxy_host; + } else { + proxy_host = storedSettings.proxy_host; } console.log("Initialising Host", storedSettings.proxy_host); setupProxy(); @@ -195,11 +195,11 @@ function SetupSettings() { // function checkPortStoredSettings(storedSettings) { - if (storedSettings.proxy_port != undefined) { - proxy_port = storedSettings.proxy_port; - } else { + if (storedSettings.proxy_port == undefined) { proxy_port = "4444"; storedSettings.proxy_port = proxy_port; + } else { + proxy_port = storedSettings.proxy_port; } console.log("Initialising Port", storedSettings.proxy_port); setupProxy(); @@ -209,11 +209,11 @@ function SetupSettings() { // function checkControlHostStoredSettings(storedSettings) { - if (storedSettings.control_host != undefined) { - control_host = storedSettings.control_host; - } else { + if (storedSettings.control_host == undefined) { control_host = "127.0.0.1"; storedSettings.control_host = control_host; + } else { + control_host = storedSettings.control_host; } console.log("Initialising Control Host", storedSettings.control_host); setupProxy(); @@ -228,11 +228,11 @@ function SetupSettings() { // function checkControlPortStoredSettings(storedSettings) { - if (storedSettings.control_port != undefined) { - let control_port = storedSettings.control_port; - } else { + if (storedSettings.control_port == undefined) { let new_control_port = "7657"; storedSettings.control_port = new_control_port; + } else { + let control_port = storedSettings.control_port; } console.log("Initialising Control Port", storedSettings.control_port); setupProxy(); @@ -247,11 +247,11 @@ function SetupSettings() { // function checkHistoryStoredSettings(storedSettings) { - if (storedSettings.disable_history != undefined) { - disable_history = storedSettings.disable_history; - } else { + if (storedSettings.disable_history == undefined) { disable_history = false; storedSettings.disable_history = disable_history; + } else { + disable_history = storedSettings.disable_history; } console.log( "Initialising Disabled History", @@ -337,14 +337,14 @@ function updateFromStorage() { console.log("updating settings from storage"); var gettingInfo = browser.runtime.getPlatformInfo(); gettingInfo.then(got => { - if (got.os != "android") { - browser.windows.getAll().then(wins => wins.forEach(themeWindow)); + if (got.os == "android") { chrome.storage.local.get(function() { SetupSettings(); update(); setupProxy(); }); } else { + browser.windows.getAll().then(wins => wins.forEach(themeWindow)); chrome.storage.local.get(function() { SetupSettings(); update(); diff --git a/scrub.js b/scrub.js index 8945a94..33f6282 100644 --- a/scrub.js +++ b/scrub.js @@ -87,7 +87,7 @@ var contextScrub = async function(requestDetails) { } }; -var contextSetup = async function(requestDetails) { +var contextSetup = function(requestDetails) { function onContextError() { console.log("Context launcher error"); } @@ -421,5 +421,8 @@ browser.webRequest.onBeforeRequest.addListener( browser.webRequest.onBeforeSendHeaders.addListener( contextScrub, { urls: [""] }, - ["blocking", "requestHeaders"] + [ +"blocking", +"requestHeaders" +] );