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 @@
+
+
+ -
+
+
+ {{ $t("extensions_use_toggle") }}
+
+
+
+
+
-
@@ -323,7 +337,11 @@ export default {
PROXY_URL:
this.$store.state.postwoman.settings.PROXY_URL ||
"https://postwoman.apollotv.xyz/",
- PROXY_KEY: this.$store.state.postwoman.settings.PROXY_KEY || ""
+ PROXY_KEY: this.$store.state.postwoman.settings.PROXY_KEY || "",
+ EXTENSIONS_ENABLED:
+ (typeof(this.$store.state.postwoman.settings.EXTENSIONS_ENABLED) !== 'undefined') ?
+ this.$store.state.postwoman.settings.EXTENSIONS_ENABLED
+ : true
},
doneButton: 'done',
diff --git a/store/postwoman.js b/store/postwoman.js
index 870958d96..ab79729ef 100644
--- a/store/postwoman.js
+++ b/store/postwoman.js
@@ -56,7 +56,13 @@ export const SETTINGS_KEYS = [
* An array of properties to exclude from the URL.
* e.g. 'auth'
*/
- "URL_EXCLUDES"
+ "URL_EXCLUDES",
+
+ /**
+ * A boolean value indicating whether to use the browser extensions
+ * to run the requests
+ */
+ "EXTENSIONS_ENABLED"
];
export const state = () => ({