Changing code for Firefox submission

This commit is contained in:
SolninjaA 2025-01-13 17:24:14 +10:00
parent 18ed0dcaab
commit cfbce6eed1
4 changed files with 4 additions and 11 deletions

View File

@ -77,7 +77,6 @@ function validateURL(url) {
return browser.storage.local.get("allowedProtocols").then(({ allowedProtocols }) => {
// Initialize a list of protocols that are allowed if unset.
// This needs to be synced with the initialization code in options.js.
console.log(allowedProtocols);
if (allowedProtocols === undefined) {
allowedProtocols = new Set();
allowedProtocols.add("http:");
@ -112,12 +111,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. See https://git.solomon.tech/solomon/Chhoto-URL-Extension for more information."
"Missing API Key. Please configure the Chhoto URL extension. See https://git.solomon.tech/solomon/Chhoto-URL-Extension#installation 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. See https://git.solomon.tech/solomon/Chhoto-URL-Extension for more information."));
return Promise.reject(new Error("Please configure the Chhoto URL extension. See https://git.solomon.tech/solomon/Chhoto-URL-Extension#installation for more information."));
}
data.longUrl = url.href;

View File

@ -16,8 +16,7 @@
"notifications",
"clipboardWrite",
"storage",
"https://*/*",
"http://*/*"
"https://*/*"
],
"options_ui": {
"page": "options.html"

View File

@ -102,7 +102,7 @@
<p>Don't have one? See <a target="_blank" href="https://github.com/sintan1729/chhoto-url#building-and-running-with-docker">here</a> for more information.</p>
</label>
</div>
<p id="message" class="note">A non-HTTPS connection is insecure! Only use this if you are testing.</p>
<p id="message" class="note">A non-HTTPS connection is insecure! This is disallowed as per Firefox's <a target="_blank" href="https://extensionworkshop.com/documentation/publish/add-on-policies/#development-practices"">development practices</a>.</p>
<div class="settings">
<h2>API Key</h2>

View File

@ -68,13 +68,8 @@ hostKeyEle.oninput = (event) => {
// Remove the "warning" class
messageEle.classList.remove("warning");
} catch (err) {
// If the URL is NOT invalid because of a TypeError
if (err.name !== "TypeError") {
messageEle.classList.add("warning");
// Save the host
browserStorage.set({ chhotoHost });
// Else, remove warning
} else {
messageEle.classList.remove("warning");