Transfer local storage to sync storage on new installs.

This commit is contained in:
Bauke 2022-12-05 14:47:42 +01:00
parent fe06822b24
commit ed29853516
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 10 additions and 0 deletions

View File

@ -16,6 +16,16 @@ browser.runtime.onInstalled.addListener(async () => {
if (import.meta.env.DEV) { if (import.meta.env.DEV) {
await browser.runtime.openOptionsPage(); await browser.runtime.openOptionsPage();
} }
const {dataVersion} = await browser.storage.sync.get({
dataVersion: '0',
});
if (dataVersion === '0') {
const local = await browser.storage.local.get();
local.dataVersion = '1';
await browser.storage.sync.set(local);
}
}); });
browser.webNavigation.onBeforeNavigate.addListener(async (details) => { browser.webNavigation.onBeforeNavigate.addListener(async (details) => {