mirror of
https://github.com/thedevs-network/kutt-extension.git
synced 2026-02-03 05:43:24 +00:00
cleanups and fixes
This commit is contained in:
@@ -64,13 +64,3 @@ Further details of specific enforcement policies may be posted separately.
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||
faith may face temporary or permanent repercussions as determined by other
|
||||
members of the project's leadership.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see
|
||||
https://www.contributor-covenant.org/faq
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
- `npm install` to install dependencies.
|
||||
- `npm run dev` to to watch file changes in developement
|
||||
- (Reload Extension Manually in the browser)
|
||||
- Load extension via as unpacked from `extension/` directory.
|
||||
- Load extension as unpacked from `extension/` directory.
|
||||
- Generate an API Key from <a href="https://kutt.it">`https://kutt.it/`</a> (Settings page)
|
||||
- Paste and Save the `Key` in extension's `options page`.
|
||||
|
||||
@@ -21,9 +21,9 @@ Download latest `Pre-Release`
|
||||
alt="Direct download"
|
||||
height="50">](https://github.com/abhijithvijayan/kuttUrl-browser-extension/releases)
|
||||
|
||||
## ToDO
|
||||
## ToDo
|
||||
|
||||
- [ ] Switch to Promise return Method
|
||||
- [x] Switch to Promise return Method
|
||||
- [ ] Fix UI issues in Firefox
|
||||
- [ ] Using Node-Kutt package(feature request)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ async function getShortURL(API_key, URLtoShorten, password) {
|
||||
let shortLink;
|
||||
const api_url = 'https://kutt.it/api/url/submit';
|
||||
try {
|
||||
const rawData = await axios({
|
||||
const json = await axios({
|
||||
method: "POST",
|
||||
url: api_url,
|
||||
headers: {
|
||||
@@ -17,12 +17,11 @@ async function getShortURL(API_key, URLtoShorten, password) {
|
||||
password: password
|
||||
}
|
||||
});
|
||||
shortLink = rawData.data.shortUrl;
|
||||
|
||||
shortLink = json.data.shortUrl;
|
||||
// returns the promise
|
||||
return shortLink;
|
||||
} catch (error) {
|
||||
// https://gist.github.com/fgilio/230ccd514e9381fafa51608fcf137253
|
||||
}
|
||||
catch (error) {
|
||||
if (error.response) {
|
||||
console.log(error.response.data);
|
||||
console.log(error.response.status);
|
||||
|
||||
@@ -21,13 +21,12 @@ let saveData = () => {
|
||||
let API_KEY = document.getElementById('api__key--value').value;
|
||||
let password = document.getElementById('password--value').value;
|
||||
|
||||
if(!password) {
|
||||
// if(!password) {
|
||||
// console.log("No password Set");
|
||||
}
|
||||
// }
|
||||
|
||||
// store value locally
|
||||
browser.storage.local.set({key: API_KEY, pwd: password}).then(() => {
|
||||
// console.log('API Key set to ' + API_KEY);
|
||||
});
|
||||
browser.storage.local.set({key: API_KEY, pwd: password}).then(() => {});
|
||||
|
||||
// Saved Alert
|
||||
let element = document.querySelector('.saved__alert');
|
||||
@@ -52,7 +51,7 @@ document.addEventListener('keypress', (e) => {
|
||||
});
|
||||
|
||||
|
||||
// Show Password Function
|
||||
// Show Password
|
||||
document.getElementById('password__view--checkbox').addEventListener('click', () => {
|
||||
let element = document.getElementById('password--value');
|
||||
if (element.type === "password") {
|
||||
|
||||
@@ -26,8 +26,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
// store the shortened link
|
||||
shortUrl = response;
|
||||
|
||||
document.getElementById('url__content-inner').textContent = "Error!!";
|
||||
|
||||
// invalid response
|
||||
if (shortUrl === null) {
|
||||
document.getElementById('url__content-inner').textContent = "Invalid Response!";
|
||||
@@ -50,10 +48,10 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
}
|
||||
else if (API_key === '' || API_key === undefined) {
|
||||
// no api key set
|
||||
document.getElementById('url__content-inner').textContent = 'Set API Key in Settings!';
|
||||
document.getElementById('url__content-inner').textContent = 'Set API Key in Options!';
|
||||
}
|
||||
else {
|
||||
document.getElementById('url__content-inner').textContent = 'Error!!!';
|
||||
document.getElementById('url__content-inner').textContent = 'Unknown Error!!!';
|
||||
}
|
||||
|
||||
});
|
||||
@@ -92,7 +90,6 @@ document.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
// 4. QR Code
|
||||
document.getElementById('button__qrcode').addEventListener('click', () => {
|
||||
// document.getElementById('button__qrcode').style = "display: none;";
|
||||
toggleDisplay('.qrcode__content--holder');
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user