How to add an update link for an extension?

I’ve been working on my first Firefox extension but I don’t know how to set up automatic updates for the extension (so the user doesn’t have to re-install the add-on). If it helps here is my source code.

This code is under the MIT liscence

manifest.json

{
  "manifest_version": 2,
  "name": "Gold Nitrotype",
  "version": "1.42",
  "description": "Modifies the Nitrotype page to give it a the NitroGold look.",
  "permissions": [
    "activeTab"
  ],
  "content_scripts": [
    {
      "matches": ["https://www.nitrotype.com/*"],
      "js": ["content.js"]
    }
  ],
  "browser_action": {
    "default_icon": {
      "16": "icon-16.png",
      "48": "icon-48.png",
      "128": "icon-128.png"
    },
    "default_title": "Modifies the Nitrotype page to give it a the NitroGold look. Made by TeamNITE",
    "default_popup": "popup.html"
  },
  "browser_specific_settings": {
    "gecko": {
      "id": "mistral.enactment366@aleeas.com",
      "strict_min_version": "58.0"
    }
  }
}

content.js

// content.js

// Function to modify the specific section and add the gold logo
function addGoldClassAndLogo() {
    if (window.location.href === "https://www.nitrotype.com/garage") {   
        const section = document.querySelector('section.card.is-garage.with-ad');
        if (section) {
            section.classList.add('is-gold');
            const goldLogoDiv = document.createElement('div');
            goldLogoDiv.className = 'profile-goldLogo';
            goldLogoDiv.innerHTML = '<img src="/dist/site/images/themes/profiles/gold/deco-ntGoldLogo2.png">';
            section.insertBefore(goldLogoDiv, section.firstChild);
        }
    }
    // Select the <a> element using a query selector
const elementToRemove = document.querySelector('a[href="/store/gold"].goldTeaser.link.link--bare.goldTeaser--profile-banner');
const elementToRemove2 = document.querySelector('a[href="/store/gold"].goldTeaser.link.link--bare');
const elementToRemove3 = document.querySelector('div.ad.ad--side'); // Corrected selector

// Check if the element exists before trying to remove it
if (elementToRemove) {
    elementToRemove.remove(); // Remove the element and all its children
}
if (elementToRemove2) {
    elementToRemove2.remove(); // Remove the element and all its children
}
if (elementToRemove3) {
    elementToRemove3.remove(); // Remove the element and all its children
}
}


addGoldClassAndLogo();

popup.html

<!DOCTYPE html>
<html>
<head>
    <title>Gold Nitrotype</title>
    <style>
        body {
            width: 260px;
            text-align: center;
        }
    </style>
</head>
<body>
    <h1 {text-align: center;}><img src="icon-48.png" width="30" height="30">Gold Nitrotype</h1>
    <p {text-align: center;}>Made By TeamNITE </p>
    <p {text-align: center;}>Visit us on <a href="httpsa://teamnite.au">teamnite.au</a></p>
    <p {text-align: center;}>Version 1.42</p>
</body>
</html>

If the addon is published in the Firefox Addons Store, it will auto-update once you release new version. Each Firefox checks for addons updates every ~24h.

Only if you are self-hosting addon, you’ll need to do it manually, more info:

Oh in that case I am all good.