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 }) => {
|
return browser.storage.local.get("allowedProtocols").then(({ allowedProtocols }) => {
|
||||||
// Initialize a list of protocols that are allowed if unset.
|
// Initialize a list of protocols that are allowed if unset.
|
||||||
// This needs to be synced with the initialization code in options.js.
|
// This needs to be synced with the initialization code in options.js.
|
||||||
console.log(allowedProtocols);
|
|
||||||
if (allowedProtocols === undefined) {
|
if (allowedProtocols === undefined) {
|
||||||
allowedProtocols = new Set();
|
allowedProtocols = new Set();
|
||||||
allowedProtocols.add("http:");
|
allowedProtocols.add("http:");
|
||||||
@ -112,12 +111,12 @@ function generateChhotoRequest(url) {
|
|||||||
// If the user didn't specify an API key
|
// If the user didn't specify an API key
|
||||||
if (!data.chhotoKey) {
|
if (!data.chhotoKey) {
|
||||||
return Promise.reject(new Error(
|
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 the user didn't specify an API key or a host
|
||||||
if (!data.chhotoKey || !data.chhotoHost) {
|
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;
|
data.longUrl = url.href;
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
"notifications",
|
"notifications",
|
||||||
"clipboardWrite",
|
"clipboardWrite",
|
||||||
"storage",
|
"storage",
|
||||||
"https://*/*",
|
"https://*/*"
|
||||||
"http://*/*"
|
|
||||||
],
|
],
|
||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options.html"
|
"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>
|
<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>
|
</label>
|
||||||
</div>
|
</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">
|
<div class="settings">
|
||||||
<h2>API Key</h2>
|
<h2>API Key</h2>
|
||||||
|
@ -68,13 +68,8 @@ hostKeyEle.oninput = (event) => {
|
|||||||
// Remove the "warning" class
|
// Remove the "warning" class
|
||||||
messageEle.classList.remove("warning");
|
messageEle.classList.remove("warning");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// If the URL is NOT invalid because of a TypeError
|
|
||||||
if (err.name !== "TypeError") {
|
if (err.name !== "TypeError") {
|
||||||
messageEle.classList.add("warning");
|
messageEle.classList.add("warning");
|
||||||
|
|
||||||
// Save the host
|
|
||||||
browserStorage.set({ chhotoHost });
|
|
||||||
|
|
||||||
// Else, remove warning
|
// Else, remove warning
|
||||||
} else {
|
} else {
|
||||||
messageEle.classList.remove("warning");
|
messageEle.classList.remove("warning");
|
||||||
|
Loading…
Reference in New Issue
Block a user