Code quality
This commit is contained in:
@@ -64,9 +64,10 @@ async function handleExtensionSetup() {
|
||||
* @returns boolean
|
||||
*/
|
||||
const isMessageAllowed = (url) => {
|
||||
console.log("Received message from " + url);
|
||||
const requestUrl = new URL(url);
|
||||
const apiUrl = new URL(SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.API_URL]);
|
||||
const apiUrl = new URL(
|
||||
SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.API_URL]
|
||||
);
|
||||
|
||||
let allowedSources = [
|
||||
new RegExp(apiUrl.hostname),
|
||||
@@ -75,7 +76,8 @@ const isMessageAllowed = (url) => {
|
||||
new RegExp("^.*\\.protonmail\\.com$"),
|
||||
];
|
||||
|
||||
const extraAllowedDomains = SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS];
|
||||
const extraAllowedDomains =
|
||||
SLStorage.DEFAULT_SETTINGS[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS];
|
||||
for (const extra of extraAllowedDomains) {
|
||||
allowedSources.push(new RegExp(extra));
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ import browser from "webextension-polyfill";
|
||||
import SLStorage from "../popup/SLStorage";
|
||||
|
||||
function initService() {
|
||||
|
||||
browser.runtime.onInstalled.addListener(async function ({ reason }) {
|
||||
if (reason === "install") {
|
||||
await SLStorage.clear();
|
||||
|
||||
@@ -90,7 +90,8 @@ if (!window._hasExecutedSlExtension) {
|
||||
addSLButtonToInput(inputElem) {
|
||||
// create wrapper for SL button
|
||||
const btnWrapper = InputTools.newDiv("sl-button-wrapper");
|
||||
const inputSumHeight = inputElem.getBoundingClientRect().height + "px";
|
||||
const inputSumHeight =
|
||||
inputElem.getBoundingClientRect().height + "px";
|
||||
btnWrapper.style.height = inputSumHeight;
|
||||
btnWrapper.style.width = inputSumHeight;
|
||||
document.body.appendChild(btnWrapper);
|
||||
@@ -145,7 +146,8 @@ if (!window._hasExecutedSlExtension) {
|
||||
-inputStyle.paddingRight,
|
||||
]) + "px";
|
||||
|
||||
const top = InputTools.sumPixel([inputCoords.top, pageYOffset]) + "px";
|
||||
const top =
|
||||
InputTools.sumPixel([inputCoords.top, pageYOffset]) + "px";
|
||||
|
||||
if (btnWrapper.style.left !== left) {
|
||||
btnWrapper.style.left = left;
|
||||
|
||||
@@ -23,7 +23,7 @@ class SLStorage {
|
||||
[SLStorage.SETTINGS.SL_BUTTON_POSITION]: "right-inside",
|
||||
[SLStorage.SETTINGS.EXTRA_ALLOWED_DOMAINS]: devConfig
|
||||
? devConfig.EXTRA_ALLOWED_DOMAINS
|
||||
: []
|
||||
: [],
|
||||
};
|
||||
|
||||
static set(key, value) {
|
||||
|
||||
Reference in New Issue
Block a user