Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Adapt extension check to new extensions
Levin Rickertf636e7dbd4c8
diff --git a/functions/network.js b/functions/network.jsindex 22ff13364..57cc634b8 100644--- a/functions/network.js+++ b/functions/network.js@@ -1,5 +1,7 @@import AxiosStrategy from "./strategies/AxiosStrategy";-import ExtensionStrategy from "./strategies/ExtensionStrategy";+import ExtensionStrategy, {+ hasExtensionInstalled+} from "./strategies/ExtensionStrategy";import FirefoxStrategy from "./strategies/FirefoxStrategy";import ChromeStrategy, {hasChromeExtensionInstalled@@ -11,7 +13,7 @@ const isExtensionsAllowed = ({ state }) =>const runAppropriateStrategy = (req, store) => {if (isExtensionsAllowed(store)) {- if (typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined") {+ if (hasExtensionInstalled()) {return ExtensionStrategy(req, store);}diff --git a/functions/strategies/ExtensionStrategy.js b/functions/strategies/ExtensionStrategy.jsindex 837498a1d..e12e167e8 100644--- a/functions/strategies/ExtensionStrategy.js+++ b/functions/strategies/ExtensionStrategy.js@@ -1,3 +1,6 @@+export const hasExtensionInstalled = () =>+ typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined";+const extensionWithProxy = async (req, { state }) => {const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({method: "post",diff --git a/layouts/default.vue b/layouts/default.vueindex 2308fe971..7c0ec7f17 100644--- a/layouts/default.vue+++ b/layouts/default.vue@@ -668,7 +668,7 @@<script>import intializePwa from "../assets/js/pwa";import * as version from "../.postwoman/version.json";-import { hasChromeExtensionInstalled } from "../functions/strategies/ChromeStrategy";+import { hasExtensionInstalled } from "../functions/strategies/ExtensionStrategy";import firebase from "firebase/app";import { fb } from "../functions/fb";@@ -730,8 +730,7 @@ export default {showExtensions: false,showShortcuts: false,showSupport: false,- firefoxExtInstalled: window.firefoxExtSendRequest,- chromeExtInstalled: window.chrome && hasChromeExtensionInstalled(),+ extensionInstalled: hasExtensionInstalled(),fb,navigatorShare: navigator.share};@@ -794,8 +793,7 @@ export default {let showExtensionsToast =localStorage.getItem("showExtensionsToast") === "yes";if (- !this.firefoxExtInstalled &&- !this.chromeExtInstalled &&+ !this.extensionInstalled &&!showExtensionsToast) {setTimeout(() => {