Skip to content

Commit

Permalink
Add support for Thunderbird AMO
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaply committed Nov 16, 2020
1 parent 607b120 commit e675f19
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion extension/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Query AMO Addon ID",
"version": "0.1",
"version": "0.2",
"browser_action": {
"default_title": "Click here",
"default_popup": "popup.html"
Expand Down
8 changes: 4 additions & 4 deletions extension/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ browser.tabs.query({
lastFocusedWindow: true
}).then(function(tabs) {
let url = new URL(tabs[0].url);
if (url.host != "addons.mozilla.org") {
showMessage("This extension only works on addons.mozilla.org.");
if ((url.host != "addons.mozilla.org") && (url.host != "addons.thunderbird.net")) {
showMessage("This extension only works on addons.mozilla.org or addons.thunderbird.net.");
return;
}
let splitPath = url.pathname.split("/");
Expand All @@ -13,13 +13,13 @@ if (splitPath[3] != "addon") {
return;
}
let slug = splitPath[4];
fetch(`https://addons.mozilla.org/api/v4/addons/addon/${slug}/`)
fetch(`https://${url.host}/api/v4/addons/addon/${slug}/`)
.then((response) => {
return response.json();
})
.then((data) => {
document.getElementById("guid").textContent = data.guid;
document.getElementById("url").textContent = `https://addons.mozilla.org/firefox/downloads/latest/${slug}/latest.xpi`;
document.getElementById("url").textContent = `https://${url.host}/firefox/downloads/latest/${slug}/latest.xpi`;
});})

document.getElementById("copy_guid").addEventListener("click", function() {
Expand Down

0 comments on commit e675f19

Please # to comment.