less annoyance on bug fix releases

This commit is contained in:
iw0 2024-05-03 23:23:33 +02:00
parent 9811207019
commit c65170e254

9
bg.js
View File

@ -1,7 +1,10 @@
browser.runtime.onInstalled.addListener((ev) => { browser.runtime.onInstalled.addListener((ev) => {
if (ev.reason == "update") { if (ev.reason == "update") {
launchInfoPage(); updateIsSignificant(ev.previousVersion).then(
// TODO determine how to launch the page only when there are important changes v => {
if (v) launchInfoPage();
}
)
} else if (ev.reason == "install") { } else if (ev.reason == "install") {
browser.runtime.openOptionsPage() browser.runtime.openOptionsPage()
} }
@ -10,7 +13,7 @@ browser.runtime.onInstalled.addListener((ev) => {
async function updateIsSignificant(previousVersion) { async function updateIsSignificant(previousVersion) {
const significantUpdates = ["0.1.0", "0.2.0", "0.3.0"]; const significantUpdates = ["0.1.0", "0.2.0", "0.3.0"];
let currentVersion = (await browser.management.getSelf()).version; let currentVersion = (await browser.management.getSelf()).version;
return currentVersion in significantUpdates; return (currentVersion in significantUpdates) || currentVersion.endsWith('0');
} }
function launchInfoPage(){ function launchInfoPage(){
browser.tabs.create({url: "/changelog.htm", active: false}) browser.tabs.create({url: "/changelog.htm", active: false})