unshortener copies to clipboard

This commit is contained in:
agatha 2024-04-13 21:46:51 -04:00
parent ca2c990002
commit a655b3b02e
2 changed files with 7 additions and 5 deletions

View File

@ -28,8 +28,6 @@ function getDomainFromUrl(linkUrl) {
}
function unshortenUrl(linkUrl) {
console.log(linkUrl);
fetch("http://localhost:8000/?url=" + linkUrl)
.then(res => {
if (!res.ok) {
@ -37,7 +35,9 @@ function unshortenUrl(linkUrl) {
}
return res.json();
})
.then(data => {
console.log(data);
.then(unshortenedUrl => {
console.log("unshortened: " + unshortenedUrl)
navigator.clipboard.writeText(unshortenedUrl)
.catch(err => console.error("couldn't copy to clipboard", err));
});
}

View File

@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Unshortener",
"version": "0.2",
"version": "0.3",
"description": "Unshorten links from Twitter.",
@ -17,6 +17,8 @@
},
"permissions": [
"activeTab",
"clipboardWrite",
"contextMenus"
]
}