diff --git a/extension/src/background.js b/extension/src/background.js index b6987fa..c243d52 100644 --- a/extension/src/background.js +++ b/extension/src/background.js @@ -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)); }); } \ No newline at end of file diff --git a/extension/src/manifest.json b/extension/src/manifest.json index ccba66f..1e3e3b9 100644 --- a/extension/src/manifest.json +++ b/extension/src/manifest.json @@ -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" ] }