mirror of
https://github.com/SolninjaA/Chhoto-URL-Extension.git
synced 2025-02-27 10:19:33 +10:00
Changing code for Firefox submission
This commit is contained in:
parent
18ed0dcaab
commit
cfbce6eed1
@ -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;
|
||||
|
||||
|
@ -16,8 +16,7 @@
|
||||
"notifications",
|
||||
"clipboardWrite",
|
||||
"storage",
|
||||
"https://*/*",
|
||||
"http://*/*"
|
||||
"https://*/*"
|
||||
],
|
||||
"options_ui": {
|
||||
"page": "options.html"
|
||||
|
@ -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>
|
||||
|
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user