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
Fix indicator if extension is installed
Levin Rickert3679eecfc216
diff --git a/components/layout/header.vue b/components/layout/header.vueindex 09cc5a8db..7eb1360b1 100644--- a/components/layout/header.vue+++ b/components/layout/header.vue@@ -165,7 +165,7 @@/></svg><span>Firefox</span>- <span class="icon" v-if="firefoxExtInstalled" v-tooltip="$t('installed')">+ <span class="icon" v-if="hasFirefoxExtInstalled" v-tooltip="$t('installed')"><i class="material-icons">done</i></span></button>@@ -190,7 +190,7 @@/></svg><span>Chrome</span>- <span class="icon" v-if="chromeExtInstalled" v-tooltip="$t('installed')">+ <span class="icon" v-if="hasChromeExtInstalled" v-tooltip="$t('installed')"><i class="material-icons">done</i></span></button>@@ -286,7 +286,11 @@<script>import intializePwa from "../../assets/js/pwa"-import { hasExtensionInstalled } from "../../functions/strategies/ExtensionStrategy"+import {+ hasExtensionInstalled,+ hasChromeExtensionInstalled,+ hasFirefoxExtensionInstalled,+} from "../../functions/strategies/ExtensionStrategy"import { getPlatformSpecialKey } from "../../functions/platformutils"import firebase from "firebase/app"import { fb } from "../../functions/fb"@@ -306,6 +310,8 @@ export default {// prompt.showInstallPrompt: null,showExtensions: false,+ hasChromeExtInstalled: hasChromeExtensionInstalled(),+ hasFirefoxExtInstalled: hasFirefoxExtensionInstalled(),showShortcuts: false,showSupport: false,fb,diff --git a/functions/strategies/ExtensionStrategy.js b/functions/strategies/ExtensionStrategy.jsindex b6fa7b56b..bfea02235 100644--- a/functions/strategies/ExtensionStrategy.js+++ b/functions/strategies/ExtensionStrategy.js@@ -1,15 +1,20 @@export const hasExtensionInstalled = () =>typeof window.__POSTWOMAN_EXTENSION_HOOK__ !== "undefined"+export const hasChromeExtensionInstalled = () =>+ hasExtensionInstalled() && /Chrome/i.test(navigator.userAgent) && /Google/i.test(navigator.vendor)++export const hasFirefoxExtensionInstalled = () =>+ hasExtensionInstalled() && /Firefox/i.test(navigator.userAgent)+const extensionWithProxy = async (req, { state }) => {const { data } = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest({method: "post",- url:- state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",- data: req- });- return data;-};+ url: state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",+ data: req,+ })+ return data+}const extensionWithoutProxy = async (req, _store) => {const res = await window.__POSTWOMAN_EXTENSION_HOOK__.sendRequest(req)