summaryrefslogtreecommitdiffstats
path: root/background.js
blob: 6efb8f75ac28b1697f0def90fe4b3d1c64cd34b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function isCompatible(version) {
  let [ major, minor , patch ] = version.split(".").map(e => parseInt(e,10));
  return (
    major > 102 || 
    (major == 102 && minor > 3) ||
    (major == 102 && minor == 3 && patch > 2)
  );
}

async function main() {
  let { version } = await browser.runtime.getBrowserInfo();
  if (isCompatible(version)) {
    await messenger.BootstrapLoader.registerChromeUrl([ ["content", "eas4tbsync", "content/"] ]);
    await messenger.BootstrapLoader.registerBootstrapScript("chrome://eas4tbsync/content/bootstrap.js");  
  } else {
    let manifest = browser.runtime.getManifest();
    browser.notifications.create({
      type: "basic",
      iconUrl: browser.runtime.getURL("content/skin/eas32.png"),
      title: `${manifest.name}`,
      message: "Please update Thunderbird to at least 102.3.3 to be able to use this provider.",
    });
  }
}

main();