summaryrefslogtreecommitdiffstats
path: root/background.js
blob: 5c793e142ec8dbc47f83da580e4fa7991c6ac099 (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", "dav4tbsync", "content/"] ]);
    await messenger.BootstrapLoader.registerBootstrapScript("chrome://dav4tbsync/content/bootstrap.js");  
  } else {
    let manifest = browser.runtime.getManifest();
    browser.notifications.create({
      type: "basic",
      iconUrl: browser.runtime.getURL("content/skin/sabredav32.png"),
      title: `${manifest.name}`,
      message: "Please update Thunderbird to at least 102.3.3 to be able to use this provider.",
    });
  }
}

main();