aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManeraKai <manerakai@protonmail.com>2022-05-31 01:49:09 +0300
committerManeraKai <manerakai@protonmail.com>2022-05-31 01:49:09 +0300
commit2b048f6af1dfa8122183c41debcd882e3c20c7a1 (patch)
tree71a082d9be634097292af6f05937099c5f8aa29a
parentMerged branches (diff)
downloadlibredirect-2b048f6af1dfa8122183c41debcd882e3c20c7a1.zip
Auto reset settings & warning page for incompatible versions #292
Diffstat (limited to '')
-rw-r--r--src/pages/background/background.js5
-rw-r--r--src/pages/background/reset_warning.html56
2 files changed, 60 insertions, 1 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 0f594161..814c1af6 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 00000000..bee174e8
--- /dev/null
+++ b/src/pages/background/reset_warning.html
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+ <meta charset="UTF-8">
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
+ <title data-localise="__MSG_instanceIsOff__">Instance is offline</title>
+ <link href="../stylesheets/styles.css" rel="stylesheet" />
+ <style>
+ body {
+ margin: 0;
+ padding: 0;
+ height: 100vh;
+ width: 100vw;
+ flex-wrap: wrap;
+ justify-content: center;
+ align-items: center;
+ font-size: 30px;
+ display: flex;
+ }
+
+ div {
+ width: 80%;
+ }
+
+ div.logo{
+ display: flex;
+ }
+
+ img {
+ width: 90px;
+ height: auto;
+ }
+ </style>
+
+</head>
+
+<body>
+ <div>
+ <div class="logo">
+ <img src="/assets/images/libredirect.svg" alt="LibRedirect icon">
+ <h1>LibRedirect</h1>
+ </div>
+
+ <p data-localise="__MSG_instanceOffline__">All settings have been reset as they're incompatible with the
+ previous version.</p>
+ <p>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.</p>
+ </div>
+
+ <script src="instance_offline.js"></script>
+ <script src="../../assets/javascripts/localise.js"></script>
+</body>
+
+</html> \ No newline at end of file