diff --git a/background.js b/background.js index a6e3021..eeff54d 100644 --- a/background.js +++ b/background.js @@ -84,7 +84,9 @@ function validateURL(url) { allowedProtocols.add("https:"); allowedProtocols.add("ftp:"); allowedProtocols.add("file:"); - browser.storage.local.set({ allowedProtocols }); + browser.storage.local.set({ allowedProtocols: Array(...allowedProtocols) }); + } else { + allowedProtocols = new Set(allowedProtocols); } // If no protocols are set, allow every protocol @@ -110,12 +112,12 @@ function generateChhotoRequest(url) { // If the user didn't specify an API key if (!data.chhotoKey) { return Promise.reject(new Error( - "Missing API Key. Please configure the Chhoto URL extension by navigating to Settings > Extensions & Themes > Chhoto URL > Preferences." + "Missing API Key. Please configure the Chhoto URL extension. See https://git.solomon.tech/solomon/Chhoto-URL-Extension for more information." )); } // If the user didn't specify an API key or a host if (!data.chhotoKey || !data.chhotoHost) { - return Promise.reject(new Error("Please configure the Chhoto URL extension by navigating to Settings > Extensions & Themes > Chhoto URL > Preferences.")); + return Promise.reject(new Error("Please configure the Chhoto URL extension. See https://git.solomon.tech/solomon/Chhoto-URL-Extension for more information.")); } data.longUrl = url.href; @@ -136,7 +138,7 @@ function requestChhoto(chhotoRequest) { headers.append("accept", "application/json"); headers.append("Content-Type", "application/json"); // This has been pushed to the main branch of Chhoto URL! - headers.append("Chhoto-Api-Key", chhotoRequest.chhotoKey); + headers.append("X-API-Key", chhotoRequest.chhotoKey); // Return output of fetch return fetch(new Request( diff --git a/options.html b/options.html index 543594a..7c706f0 100644 --- a/options.html +++ b/options.html @@ -43,6 +43,15 @@ margin-top: 0px; } + p, + label { + font-size: 15px; + } + + code { + font-weight: bold; + } + main { display: flex; flex-direction: column; @@ -72,7 +81,7 @@ min-width: 110px; } - .protocol { + .checkbox { flex-wrap: wrap; } @@ -90,7 +99,7 @@

A non-HTTPS connection is insecure! Only use this if you are testing.

@@ -99,14 +108,14 @@

API Key

-

Important: Chhoto URL will output in the console whether or not your key is secure. If it isn't, it will generate a suggested key and output it. Always follow its advice.

+

Important: The Chhoto URL server (not the extension) will output in the console whether or not your key is secure. If it isn't, it will generate a suggested key and output it. Always follow its advice.

-
-

Protocol filters

+
+

Protocol Filters