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
Remove support for legacy extensions
Levin Rickert83b708368f84
diff --git a/components/layout/header.vue b/components/layout/header.vueindex 83e6ee94e..09cc5a8db 100644--- a/components/layout/header.vue+++ b/components/layout/header.vue@@ -48,8 +48,8 @@class="icon"v-tooltip="(fb.currentUser.displayName || '<label><i>Name not found</i></label>') +- '<br>' +- (fb.currentUser.email || '<label><i>Email not found</i></label>')+ '<br>' ++ (fb.currentUser.email || '<label><i>Email not found</i></label>')"aria-label="Account">@@ -287,7 +287,6 @@<script>import intializePwa from "../../assets/js/pwa"import { hasExtensionInstalled } from "../../functions/strategies/ExtensionStrategy"-import { hasChromeExtensionInstalled } from "../../functions/strategies/ChromeStrategy"import { getPlatformSpecialKey } from "../../functions/platformutils"import firebase from "firebase/app"import { fb } from "../../functions/fb"@@ -343,7 +342,7 @@ export default {if (!showExtensionsToast) returnsetTimeout(() => {- if (!(hasExtensionInstalled() || hasChromeExtensionInstalled())) {+ if (!hasExtensionInstalled()) {this.$toast.show(this.$t("extensions_info2"), {icon: "extension",duration: 5000,@@ -373,7 +372,7 @@ export default {}}, 15000)- this._keyListener = function(e) {+ this._keyListener = function (e) {if (e.key === "Escape") {e.preventDefault()this.showExtensions = this.showShortcuts = this.showSupport = false@@ -404,7 +403,7 @@ export default {computed: {availableLocales() {- return this.$i18n.locales.filter(i => i.code !== this.$i18n.locale)+ return this.$i18n.locales.filter((i) => i.code !== this.$i18n.locale)},},}diff --git a/functions/network.js b/functions/network.jsindex 7e53cfa85..c58cc7fd1 100644--- a/functions/network.js+++ b/functions/network.js@@ -1,30 +1,13 @@import AxiosStrategy from "./strategies/AxiosStrategy"import ExtensionStrategy, { hasExtensionInstalled } from "./strategies/ExtensionStrategy"-import FirefoxStrategy from "./strategies/FirefoxStrategy"-import ChromeStrategy, { hasChromeExtensionInstalled } from "./strategies/ChromeStrategy"const isExtensionsAllowed = ({ state }) =>typeof state.postwoman.settings.EXTENSIONS_ENABLED === "undefined" ||state.postwoman.settings.EXTENSIONS_ENABLEDconst runAppropriateStrategy = (req, store) => {- if (isExtensionsAllowed(store)) {- if (hasExtensionInstalled()) {- return ExtensionStrategy(req, store)- }-- // The following strategies are deprecated and kept to support older version of the extensions-- // 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) && hasExtensionInstalled()) {+ return ExtensionStrategy(req, store)}return AxiosStrategy(req, store)diff --git a/functions/strategies/ChromeStrategy.js b/functions/strategies/ChromeStrategy.jsdeleted file mode 100644index 9ad3ddab5..000000000--- a/functions/strategies/ChromeStrategy.js+++ /dev/null@@ -1,63 +0,0 @@-const EXTENSION_ID = "amknoiejhlmhancpahfcfcfhllgkpbld"--// Check if the Chrome Extension is present-// The Chrome extension injects an empty span to help detection.-// Also check for the presence of window.chrome object to confirm smooth operations-export const hasChromeExtensionInstalled = () =>- document.getElementById("chromePWExtensionDetect") !== null--const chromeWithoutProxy = (req, _store) =>- new Promise((resolve, reject) => {- chrome.runtime.sendMessage(- EXTENSION_ID,- {- messageType: "send-req",- data: {- config: req,- },- },- ({ data }) => {- if (data.error) {- reject(data.error)- } else {- resolve(data.response)- }- }- )- })--const chromeWithProxy = (req, { state }) =>- new Promise((resolve, reject) => {- chrome.runtime.sendMessage(- EXTENSION_ID,- {- messageType: "send-req",- data: {- config: {- method: "post",- url:- state.postwoman.settings.PROXY_URL ||- "https://postwoman.apollosoftware.xyz/",- data: req- }- }- },- ({ data }) => {- if (data.error) {- reject(error)- } else {- resolve(data.response.data)- }- }- )- })--const chromeStrategy = (req, store) => {- if (store.state.postwoman.settings.PROXY_ENABLED) {- return chromeWithProxy(req, store)- } else {- return chromeWithoutProxy(req, store)- }-}--export default chromeStrategydiff --git a/functions/strategies/FirefoxStrategy.js b/functions/strategies/FirefoxStrategy.jsdeleted file mode 100644index ea5f5f1d2..000000000--- a/functions/strategies/FirefoxStrategy.js+++ /dev/null@@ -1,47 +0,0 @@-const firefoxWithProxy = (req, { state }) =>- new Promise((resolve, reject) => {- const eventListener = event => {- window.removeEventListener("firefoxExtSendRequestComplete", event)-- if (event.detail.error) {- reject(JSON.parse(event.detail.error))- } else {- resolve(JSON.parse(event.detail.response).data)- }- }-- window.addEventListener("firefoxExtSendRequestComplete", eventListener)-- window.firefoxExtSendRequest({- method: "post",- url:- state.postwoman.settings.PROXY_URL || "https://postwoman.apollosoftware.xyz/",- data: req- });- });--const firefoxWithoutProxy = (req, _store) =>- new Promise((resolve, reject) => {- const eventListener = ({ detail }) => {- window.removeEventListener("firefoxExtSendRequestComplete", eventListener)-- if (detail.error) {- reject(JSON.parse(detail.error))- } else {- resolve(JSON.parse(detail.response))- }- }-- window.addEventListener("firefoxExtSendRequestComplete", eventListener)-- window.firefoxExtSendRequest(req)- })--const firefoxStrategy = (req, store) => {- if (store.state.postwoman.settings.PROXY_ENABLED) {- return firefoxWithProxy(req, store)- }- return firefoxWithoutProxy(req, store)-}--export default firefoxStrategy