From 2b048f6af1dfa8122183c41debcd882e3c20c7a1 Mon Sep 17 00:00:00 2001 From: ManeraKai Date: Tue, 31 May 2022 01:49:09 +0300 Subject: [PATCH] Auto reset settings & warning page for incompatible versions #292 --- src/pages/background/background.js | 5 ++- src/pages/background/reset_warning.html | 56 +++++++++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 src/pages/background/reset_warning.html diff --git a/src/pages/background/background.js b/src/pages/background/background.js index 0f59416..814c1af 100644 --- a/src/pages/background/background.js +++ b/src/pages/background/background.js @@ -23,8 +23,11 @@ window.browser = window.browser || window.chrome; browser.runtime.onInstalled.addListener( async details => { - if (details.reason == 'install') { + // if (details.reason == 'install') { + if (details.reason == 'install' || details.reason == "update") { + browser.tabs.create({ url: browser.extension.getURL("/pages/background/reset_warning.html") }); fetch('/instances/blocklist.json').then(response => response.text()).then(async data => { + await browser.storage.local.clear(); await browser.storage.local.set({ cloudflareList: JSON.parse(data) }) generalHelper.initDefaults(); youtubeHelper.initDefaults(); diff --git a/src/pages/background/reset_warning.html b/src/pages/background/reset_warning.html new file mode 100644 index 0000000..bee174e --- /dev/null +++ b/src/pages/background/reset_warning.html @@ -0,0 +1,56 @@ + + + + + + + + Instance is offline + + + + + + +
+ + +

All settings have been reset as they're incompatible with the + previous version.

+

Sorry for the inconvenience, but we're going in a fast development process and can't + support nor convert older settings. It will reach at the end a stable plateau though.

+
+ + + + + + \ No newline at end of file