diff --git a/src/background/index.js b/src/background/index.js index 923f6c6..d776fb7 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -43,7 +43,6 @@ async function finalizeExtensionSetup(apiKey) { }); } - async function handleExtensionSetup() { 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") { // 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 - 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") { return handleExtensionInstalledQuery(); } else if (request.tag === "SAFARI_FINALIZE_EXTENSION_SETUP") { diff --git a/src/content_script/input_tools.js b/src/content_script/input_tools.js index a3a4286..6febff7 100644 --- a/src/content_script/input_tools.js +++ b/src/content_script/input_tools.js @@ -266,7 +266,7 @@ if (!window._hasExecutedSlExtension) { return; } // 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, { method: "POST", headers: { @@ -281,7 +281,10 @@ if (!window._hasExecutedSlExtension) { if (res.ok) { const apiRes = await res.json(); 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") {