run prettier
This commit is contained in:
@@ -43,7 +43,6 @@ async function finalizeExtensionSetup(apiKey) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
async function handleExtensionSetup() {
|
async function handleExtensionSetup() {
|
||||||
const apiUrl = await SLStorage.get(SLStorage.SETTINGS.API_URL);
|
const apiUrl = await SLStorage.get(SLStorage.SETTINGS.API_URL);
|
||||||
|
|
||||||
@@ -129,7 +128,9 @@ browser.runtime.onMessage.addListener(async function (request, sender) {
|
|||||||
if (request.tag === "EXTENSION_SETUP") {
|
if (request.tag === "EXTENSION_SETUP") {
|
||||||
// On Safari the background script won't set cookies properly in API calls (see https://bugs.webkit.org/show_bug.cgi?id=260676),
|
// On Safari the background script won't set cookies properly in API calls (see https://bugs.webkit.org/show_bug.cgi?id=260676),
|
||||||
// so we will return the API URL to the content script which will make the API call with cookies properly set
|
// so we will return the API URL to the content script which will make the API call with cookies properly set
|
||||||
return process.env.MAC ? await SLStorage.get(SLStorage.SETTINGS.API_URL) : await handleExtensionSetup();
|
return process.env.MAC
|
||||||
|
? await SLStorage.get(SLStorage.SETTINGS.API_URL)
|
||||||
|
: await handleExtensionSetup();
|
||||||
} else if (request.tag === "EXTENSION_INSTALLED_QUERY") {
|
} else if (request.tag === "EXTENSION_INSTALLED_QUERY") {
|
||||||
return handleExtensionInstalledQuery();
|
return handleExtensionInstalledQuery();
|
||||||
} else if (request.tag === "SAFARI_FINALIZE_EXTENSION_SETUP") {
|
} else if (request.tag === "SAFARI_FINALIZE_EXTENSION_SETUP") {
|
||||||
|
|||||||
@@ -266,7 +266,7 @@ if (!window._hasExecutedSlExtension) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// else if apiUrl is defined, we are in Safari and need to setup the Safari extension
|
// else if apiUrl is defined, we are in Safari and need to setup the Safari extension
|
||||||
const url = apiUrl + '/api/api_key';
|
const url = apiUrl + "/api/api_key";
|
||||||
const res = await fetch(url, {
|
const res = await fetch(url, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
@@ -281,7 +281,10 @@ if (!window._hasExecutedSlExtension) {
|
|||||||
if (res.ok) {
|
if (res.ok) {
|
||||||
const apiRes = await res.json();
|
const apiRes = await res.json();
|
||||||
const apiKey = apiRes.api_key;
|
const apiKey = apiRes.api_key;
|
||||||
await sendMessageToBackground("SAFARI_FINALIZE_EXTENSION_SETUP", apiKey);
|
await sendMessageToBackground(
|
||||||
|
"SAFARI_FINALIZE_EXTENSION_SETUP",
|
||||||
|
apiKey
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (event.data.tag === "EXTENSION_INSTALLED_QUERY") {
|
} else if (event.data.tag === "EXTENSION_INSTALLED_QUERY") {
|
||||||
|
|||||||
Reference in New Issue
Block a user