diff --git a/functions/headers.js b/functions/headers.js index 9fbc2938e..ffc6b5d5f 100644 --- a/functions/headers.js +++ b/functions/headers.js @@ -121,4 +121,4 @@ export const commonHeaders = [ "X-Requested-With", "X-Robots-Tag", "X-UA-Compatible" -] +]; diff --git a/functions/strategies/ChromeStrategy.js b/functions/strategies/ChromeStrategy.js index 03c05ea0c..1c525e3ed 100644 --- a/functions/strategies/ChromeStrategy.js +++ b/functions/strategies/ChromeStrategy.js @@ -5,45 +5,53 @@ const EXTENSION_ID = "amknoiejhlmhancpahfcfcfhllgkpbld"; // Also check for the presence of window.chrome object to confirm smooth operations export const hasChromeExtensionInstalled = () => { return document.getElementById("chromePWExtensionDetect") !== null; -} +}; -const chromeWithoutProxy = (req, _store) => new Promise((resolve, reject) => { - chrome.runtime.sendMessage( - EXTENSION_ID, { - messageType: "send-req", - data: { - config: req - } - }, (message) => { - if (message.data.error) { - reject(message.data.error); - } else { - resolve(message.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.apollotv.xyz/", - data: req +const chromeWithoutProxy = (req, _store) => + new Promise((resolve, reject) => { + chrome.runtime.sendMessage( + EXTENSION_ID, + { + messageType: "send-req", + data: { + config: req + } + }, + message => { + if (message.data.error) { + reject(message.data.error); + } else { + resolve(message.data.response); } } - }, (message) => { - if (message.data.error) { - reject(error); - } else { - resolve(message.data.response.data); + ); + }); + +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.apollotv.xyz/", + data: req + } + } + }, + message => { + if (message.data.error) { + reject(error); + } else { + resolve(message.data.response.data); + } } - } - ) -}); + ); + }); const chromeStrategy = (req, store) => { if (store.state.postwoman.settings.PROXY_ENABLED) { @@ -51,6 +59,6 @@ const chromeStrategy = (req, store) => { } else { return chromeWithoutProxy(req, store); } -} +}; export default chromeStrategy; diff --git a/layouts/default.vue b/layouts/default.vue index 4302a71f8..cbe410f17 100644 --- a/layouts/default.vue +++ b/layouts/default.vue @@ -715,7 +715,7 @@ export default { .then(() => {}) .catch(console.error); } else { - // fallback + // fallback } } }, diff --git a/store/postwoman.js b/store/postwoman.js index ab79729ef..a0e93faaf 100644 --- a/store/postwoman.js +++ b/store/postwoman.js @@ -57,11 +57,11 @@ export const SETTINGS_KEYS = [ * e.g. 'auth' */ "URL_EXCLUDES", - + /** * A boolean value indicating whether to use the browser extensions * to run the requests - */ + */ "EXTENSIONS_ENABLED" ]; @@ -118,7 +118,9 @@ export const mutations = { addNewCollection({ collections }, collection) { const { name } = collection; - const duplicateCollection = collections.some(item => item.name.toLowerCase() === name.toLowerCase()); + const duplicateCollection = collections.some( + item => item.name.toLowerCase() === name.toLowerCase() + ); if (duplicateCollection) { this.$toast.info("Duplicate collection"); return; @@ -139,7 +141,9 @@ export const mutations = { editCollection({ collections }, payload) { const { collection, collectionIndex } = payload; const { name } = collection; - const duplicateCollection = collections.some(item => item.name.toLowerCase() === name.toLowerCase()); + const duplicateCollection = collections.some( + item => item.name.toLowerCase() === name.toLowerCase() + ); if (duplicateCollection) { this.$toast.info("Duplicate collection"); return;