🚨 Lint
This commit is contained in:
@@ -121,4 +121,4 @@ export const commonHeaders = [
|
|||||||
"X-Requested-With",
|
"X-Requested-With",
|
||||||
"X-Robots-Tag",
|
"X-Robots-Tag",
|
||||||
"X-UA-Compatible"
|
"X-UA-Compatible"
|
||||||
]
|
];
|
||||||
|
|||||||
@@ -5,45 +5,53 @@ const EXTENSION_ID = "amknoiejhlmhancpahfcfcfhllgkpbld";
|
|||||||
// Also check for the presence of window.chrome object to confirm smooth operations
|
// Also check for the presence of window.chrome object to confirm smooth operations
|
||||||
export const hasChromeExtensionInstalled = () => {
|
export const hasChromeExtensionInstalled = () => {
|
||||||
return document.getElementById("chromePWExtensionDetect") !== null;
|
return document.getElementById("chromePWExtensionDetect") !== null;
|
||||||
}
|
};
|
||||||
|
|
||||||
const chromeWithoutProxy = (req, _store) => new Promise((resolve, reject) => {
|
const chromeWithoutProxy = (req, _store) =>
|
||||||
chrome.runtime.sendMessage(
|
new Promise((resolve, reject) => {
|
||||||
EXTENSION_ID, {
|
chrome.runtime.sendMessage(
|
||||||
messageType: "send-req",
|
EXTENSION_ID,
|
||||||
data: {
|
{
|
||||||
config: req
|
messageType: "send-req",
|
||||||
}
|
data: {
|
||||||
}, (message) => {
|
config: req
|
||||||
if (message.data.error) {
|
}
|
||||||
reject(message.data.error);
|
},
|
||||||
} else {
|
message => {
|
||||||
resolve(message.data.response);
|
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, (message) => {
|
);
|
||||||
if (message.data.error) {
|
});
|
||||||
reject(error);
|
|
||||||
} else {
|
const chromeWithProxy = (req, { state }) =>
|
||||||
resolve(message.data.response.data);
|
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) => {
|
const chromeStrategy = (req, store) => {
|
||||||
if (store.state.postwoman.settings.PROXY_ENABLED) {
|
if (store.state.postwoman.settings.PROXY_ENABLED) {
|
||||||
@@ -51,6 +59,6 @@ const chromeStrategy = (req, store) => {
|
|||||||
} else {
|
} else {
|
||||||
return chromeWithoutProxy(req, store);
|
return chromeWithoutProxy(req, store);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
export default chromeStrategy;
|
export default chromeStrategy;
|
||||||
|
|||||||
@@ -715,7 +715,7 @@ export default {
|
|||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
} else {
|
} else {
|
||||||
// fallback
|
// fallback
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const SETTINGS_KEYS = [
|
|||||||
/**
|
/**
|
||||||
* A boolean value indicating whether to use the browser extensions
|
* A boolean value indicating whether to use the browser extensions
|
||||||
* to run the requests
|
* to run the requests
|
||||||
*/
|
*/
|
||||||
"EXTENSIONS_ENABLED"
|
"EXTENSIONS_ENABLED"
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -118,7 +118,9 @@ export const mutations = {
|
|||||||
|
|
||||||
addNewCollection({ collections }, collection) {
|
addNewCollection({ collections }, collection) {
|
||||||
const { name } = 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) {
|
if (duplicateCollection) {
|
||||||
this.$toast.info("Duplicate collection");
|
this.$toast.info("Duplicate collection");
|
||||||
return;
|
return;
|
||||||
@@ -139,7 +141,9 @@ export const mutations = {
|
|||||||
editCollection({ collections }, payload) {
|
editCollection({ collections }, payload) {
|
||||||
const { collection, collectionIndex } = payload;
|
const { collection, collectionIndex } = payload;
|
||||||
const { name } = 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) {
|
if (duplicateCollection) {
|
||||||
this.$toast.info("Duplicate collection");
|
this.$toast.info("Duplicate collection");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user