diff --git a/config/webpack.config.js b/config/webpack.config.js index 5099d22d2..f32145d27 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -16,22 +16,10 @@ function modifyManifest(browser, mode, buffer) { manifest.options_ui = { page: "pages/options.html" }; + manifest.content_security_policy = "script-src 'self'; object-src 'self'"; manifest.permissions.push("cookies", "contextualIdentities"); - } else if (browser === "safari") { - manifest.incognito = "split"; - manifest.options_page = "pages/options.html"; } else { - manifest.chrome_settings_overrides = { - "search_provider": { - "name": "Smart", - "keyword": "Smart", - "search_url": "https://smartwebfinders.com/?n=1&q={searchTerms}", - "favicon_url": "https://smartwebfinders.com/favicon.ico", - "encoding": "UTF-8", - "is_default": false - } - }; manifest.permissions.push("proxy"); manifest.permissions.push("tts"); manifest.permissions.push("downloads.shelf"); diff --git a/package.json b/package.json index ee97be6b1..e1613d565 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Surfingkeys", - "version": "1.0.7", + "version": "1.0.6", "description": "Map your keys for web surfing, expand your browser with javascript and keyboard.", "main": "background.js", "directories": { diff --git a/src/background/chrome.js b/src/background/chrome.js index 882ff89bd..1b361f218 100644 --- a/src/background/chrome.js +++ b/src/background/chrome.js @@ -1,5 +1,4 @@ import { - LOG, filterByTitleOrUrl, } from '../content_scripts/common/utils.js'; import { @@ -151,7 +150,7 @@ function startNative() { if (nativeConnected) { nvimServer.instance = startNative(); } else { - LOG("error", "Failed to connect neovim, please make sure your neovim version 0.5 or above."); + reject("Failed to connect neovim, please make sure your neovim version 0.5 or above."); } }); nm.onMessage.addListener(async (resp) => { @@ -162,7 +161,7 @@ function startNative() { resolve({url, nm}); } } else if (resp.err) { - LOG("error", resp.err); + console.log(resp.err); } }); nm.postMessage({ diff --git a/src/content_scripts/common/api.js b/src/content_scripts/common/api.js index 9f44b8cae..b2c7951b7 100644 --- a/src/content_scripts/common/api.js +++ b/src/content_scripts/common/api.js @@ -3,7 +3,6 @@ import Trie from './trie'; import Mode from './mode'; import KeyboardUtils from './keyboardUtils'; import { - LOG, actionWithSelectionPreserved, constructSearchURL, getBrowserName, @@ -58,13 +57,13 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) { return `${meta.word} for [${meta.annotation}] is overridden by [${annotation}].`; }); } - LOG("warn", warning); + console.warn(warning); } else if (keys.length > 1) { var p = keys.substr(0, keys.length - 1); while (p.length > 0) { old = mode.mappings.find(p); if (old && old.meta) { - LOG("warn", `${old.meta.word} for [${old.meta.annotation}] precedes ${keys}.`); + console.warn(`${old.meta.word} for [${old.meta.annotation}] precedes ${keys}.`); return; } p = p.substr(0, p.length - 1); @@ -145,7 +144,7 @@ function createAPI(clipboard, insert, normal, hints, visual, front, browser) { Mode.specialKeys[old_keystroke].push(new_keystroke); dispatchSKEvent('addMapkey', ["Mode", new_keystroke, old_keystroke]); } else { - LOG("warn", `${old_keystroke} not found in normal mode.`); + console.warn(`${old_keystroke} not found in normal mode.`); } } } diff --git a/src/content_scripts/common/default.js b/src/content_scripts/common/default.js index 222f1ad80..669290e29 100644 --- a/src/content_scripts/common/default.js +++ b/src/content_scripts/common/default.js @@ -370,7 +370,7 @@ module.exports = function(api) { addSearchAlias('e', 'wikipedia', 'https://en.wikipedia.org/wiki/', 's', 'https://en.wikipedia.org/w/api.php?action=opensearch&format=json&formatversion=2&namespace=0&limit=40&search=', function(response) { return JSON.parse(response.text)[1]; }); - addSearchAlias('w', 'bing', 'https://smartwebfinders.com/?n=1&q=', 's', 'https://api.bing.com/osjson.aspx?query=', function(response) { + addSearchAlias('w', 'bing', 'https://www.bing.com/search?setmkt=en-us&setlang=en-us&q=', 's', 'https://api.bing.com/osjson.aspx?query=', function(response) { var res = JSON.parse(response.text); return res[1]; }); diff --git a/src/content_scripts/common/utils.js b/src/content_scripts/common/utils.js index 3db5c327f..331c0f1d5 100644 --- a/src/content_scripts/common/utils.js +++ b/src/content_scripts/common/utils.js @@ -150,16 +150,6 @@ function toggleQuote() { } } -function LOG(level, msg) { - // To turn on all levels: chrome.storage.local.set({"logLevels": ["log", "warn", "error"]}) - chrome.storage.local.get(["logLevels"], (r) => { - const logLevels = r.logLevels || ["error"]; - if (["log", "warn", "error"].indexOf(level) !== -1 && r.logLevels.indexOf(level) !== -1) { - console[level](msg); - } - }); -} - function isEditable(element) { return element && !element.disabled && (element.localName === 'textarea' @@ -814,7 +804,6 @@ function filterByTitleOrUrl(urls, query) { } export { - LOG, actionWithSelectionPreserved, constructSearchURL, createElementWithContent, diff --git a/src/manifest.json b/src/manifest.json index 31e91a6f9..a229e62dd 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -78,5 +78,5 @@ "pages/shadow.css", "pages/default.css" ], - "content_security_policy": "script-src 'self'; object-src 'self'" + "content_security_policy": "script-src 'self' chrome-extension://aajlcoiaogpknhgninhopncaldipjdnp; object-src 'self'" }