diff --git a/functions/network.js b/functions/network.js index f56c52676..63d04db5d 100644 --- a/functions/network.js +++ b/functions/network.js @@ -2,22 +2,29 @@ import AxiosStrategy from "./strategies/AxiosStrategy"; import FirefoxStrategy from "./strategies/FirefoxStrategy"; import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy"; +const isExtensionsAllowed = ({ state }) => { + return typeof(state.postwoman.settings.EXTENSIONS_ENABLED) === 'undefined' + || state.postwoman.settings.EXTENSIONS_ENABLED; +} + const runAppropriateStrategy = (req, store) => { - // Chrome Provides a chrome object for scripts to access - // Check its availability to say whether you are in Google Chrome - if (window.chrome && hasChromeExtensionInstalled()) { - return ChromeStrategy(req, store); - } - // The firefox plugin injects a function to send requests through it - // If that is available, then we can use the FirefoxStrategy - if (window.firefoxExtSendRequest) { - return FirefoxStrategy(req, store); + if (isExtensionsAllowed(store)) { + // Chrome Provides a chrome object for scripts to access + // Check its availability to say whether you are in Google Chrome + if (window.chrome && hasChromeExtensionInstalled()) { + return ChromeStrategy(req, store); + } + // The firefox plugin injects a function to send requests through it + // If that is available, then we can use the FirefoxStrategy + if (window.firefoxExtSendRequest) { + return FirefoxStrategy(req, store); + } } return AxiosStrategy(req, store); } -const sendNetworkRequest = (req, store) => +const sendNetworkRequest = (req, store) => runAppropriateStrategy(req, store) .finally(() => window.$nuxt.$loading.finish()); diff --git a/lang/en-US.js b/lang/en-US.js index 4d5aa13f9..2b92253f9 100644 --- a/lang/en-US.js +++ b/lang/en-US.js @@ -246,6 +246,7 @@ export default { enter_curl: "Enter cURL", empty: "Empty", extensions: "Extensions", + extensions_use_toggle: "Use the browser extension to send requests (if present)", extensions_info1: "Browser extension that simplifies access to Postwoman", extensions_info2: "Get Postwoman browser extension!", installed: "Installed", diff --git a/pages/settings.vue b/pages/settings.vue index f09131f8a..8300bb54c 100644 --- a/pages/settings.vue +++ b/pages/settings.vue @@ -141,6 +141,20 @@ + + +