aboutsummaryrefslogtreecommitdiffstats
path: root/src/pages/background
diff options
context:
space:
mode:
authorBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-26 22:28:50 +0100
committerBobIsMyManager <bimmgitsignature.nly8m@simplelogin.co>2022-07-26 22:28:50 +0100
commit2a0596f08fb54e2faef4bcb4548a28f5837fc067 (patch)
treecf5851f95c37da269a561623cee0d3967ca321ec /src/pages/background
parentI should really inspect diffs before commiting (diff)
downloadlibredirect-2a0596f08fb54e2faef4bcb4548a28f5837fc067.zip
Many things
Made all instances updateable Added hyperpipe Closes https://github.com/libredirect/libredirect/issues/398 Added cloudtube Closes https://github.com/libredirect/libredirect/issues/397 Start using prettier
Diffstat (limited to 'src/pages/background')
-rw-r--r--src/pages/background/background.html12
-rw-r--r--src/pages/background/background.js433
-rw-r--r--src/pages/background/incognito.html64
-rw-r--r--src/pages/background/incognito.js36
-rw-r--r--src/pages/background/reset_warning.html109
-rw-r--r--src/pages/background/reset_warning.js14
6 files changed, 321 insertions, 347 deletions
diff --git a/src/pages/background/background.html b/src/pages/background/background.html
index c9ae2a81..542df18b 100644
--- a/src/pages/background/background.html
+++ b/src/pages/background/background.html
@@ -1,9 +1,7 @@
<!DOCTYPE html>
<html>
-
-<head>
- <meta charset="utf-8" />
- <script type="module" src="background.js"></script>
-</head>
-
-</html> \ No newline at end of file
+ <head>
+ <meta charset="utf-8" />
+ <script type="module" src="background.js"></script>
+ </head>
+</html>
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 293a2c84..359a912d 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -1,263 +1,252 @@
-"use strict";
+"use strict"
-import generalHelper from "../../assets/javascripts/general.js";
-import utils from "../../assets/javascripts/utils.js";
+import generalHelper from "../../assets/javascripts/general.js"
+import utils from "../../assets/javascripts/utils.js"
-import youtubeHelper from "../../assets/javascripts/youtube/youtube.js";
-import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js";
-import twitterHelper from "../../assets/javascripts/twitter.js";
-import instagramHelper from "../../assets/javascripts/instagram.js";
-import redditHelper from "../../assets/javascripts/reddit.js";
-import searchHelper from "../../assets/javascripts/search.js";
-import translateHelper from "../../assets/javascripts/translate/translate.js";
-import mapsHelper from "../../assets/javascripts/maps.js";
-import wikipediaHelper from "../../assets/javascripts/wikipedia.js";
-import mediumHelper from "../../assets/javascripts/medium.js";
-import quoraHelper from "../../assets/javascripts/quora.js";
-import libremdbHelper from "../../assets/javascripts/imdb.js";
-import reutersHelper from "../../assets/javascripts/reuters.js";
-import imgurHelper from "../../assets/javascripts/imgur.js";
-import tiktokHelper from "../../assets/javascripts/tiktok.js";
-import sendTargetsHelper from "../../assets/javascripts/sendTargets.js";
-import peertubeHelper from "../../assets/javascripts/peertube.js";
-import lbryHelper from "../../assets/javascripts/lbry.js";
+import youtubeHelper from "../../assets/javascripts/youtube/youtube.js"
+import youtubeMusicHelper from "../../assets/javascripts/youtubeMusic.js"
+import twitterHelper from "../../assets/javascripts/twitter.js"
+import instagramHelper from "../../assets/javascripts/instagram.js"
+import redditHelper from "../../assets/javascripts/reddit.js"
+import searchHelper from "../../assets/javascripts/search.js"
+import translateHelper from "../../assets/javascripts/translate/translate.js"
+import mapsHelper from "../../assets/javascripts/maps.js"
+import wikipediaHelper from "../../assets/javascripts/wikipedia.js"
+import mediumHelper from "../../assets/javascripts/medium.js"
+import quoraHelper from "../../assets/javascripts/quora.js"
+import libremdbHelper from "../../assets/javascripts/imdb.js"
+import reutersHelper from "../../assets/javascripts/reuters.js"
+import imgurHelper from "../../assets/javascripts/imgur.js"
+import tiktokHelper from "../../assets/javascripts/tiktok.js"
+import sendTargetsHelper from "../../assets/javascripts/sendTargets.js"
+import peertubeHelper from "../../assets/javascripts/peertube.js"
+import lbryHelper from "../../assets/javascripts/lbry.js"
+window.browser = window.browser || window.chrome
-window.browser = window.browser || window.chrome;
+browser.runtime.onInstalled.addListener(details => {
+ function initDefaults() {
+ fetch("/instances/blacklist.json")
+ .then(response => response.text())
+ .then(async data => {
+ browser.storage.local.clear(() => {
+ browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare }, () => {
+ browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate }, () => {
+ generalHelper.initDefaults()
+ youtubeHelper.initDefaults()
+ youtubeMusicHelper.initDefaults()
+ twitterHelper.initDefaults()
+ instagramHelper.initDefaults()
+ mapsHelper.initDefaults()
+ searchHelper.initDefaults()
+ translateHelper.initDefaults()
+ mediumHelper.initDefaults()
+ quoraHelper.initDefaults()
+ libremdbHelper.initDefaults()
+ reutersHelper.initDefaults()
+ redditHelper.initDefaults()
+ wikipediaHelper.initDefaults()
+ imgurHelper.initDefaults()
+ tiktokHelper.initDefaults()
+ sendTargetsHelper.initDefaults()
+ peertubeHelper.initDefaults()
+ lbryHelper.initDefaults()
+ })
+ })
+ })
+ })
+ }
+ if (details.reason == "install") initDefaults()
-browser.runtime.onInstalled.addListener(
- details => {
- function initDefaults() {
- fetch('/instances/blacklist.json').then(response => response.text()).then(async data => {
- browser.storage.local.clear(
- () => {
- browser.storage.local.set({ cloudflareBlackList: JSON.parse(data).cloudflare },
- () => {
- browser.storage.local.set({ authenticateBlackList: JSON.parse(data).authenticate },
- () => {
- generalHelper.initDefaults();
- youtubeHelper.initDefaults();
- youtubeMusicHelper.initDefaults();
- twitterHelper.initDefaults();
- instagramHelper.initDefaults();
- mapsHelper.initDefaults();
- searchHelper.initDefaults();
- translateHelper.initDefaults();
- mediumHelper.initDefaults();
- quoraHelper.initDefaults();
- libremdbHelper.initDefaults();
- reutersHelper.initDefaults();
- redditHelper.initDefaults();
- wikipediaHelper.initDefaults();
- imgurHelper.initDefaults();
- tiktokHelper.initDefaults();
- sendTargetsHelper.initDefaults();
- peertubeHelper.initDefaults();
- lbryHelper.initDefaults();
- })
- })
- });
- })
- };
- if (details.reason == 'install') initDefaults();
+ // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) {
+ // if (details.reason == "update")
+ // browser.storage.local.get(null, r => {
+ // if (r.theme) {
+ // const old = encodeURIComponent(JSON.stringify(r))
+ // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) });
+ // }
+ // initDefaults();
+ // })
+ // else initDefaults();
+ // }
+})
- // if (details.reason == 'install' || (details.reason == "update" && details.previousVersion != browser.runtime.getManifest().version)) {
- // if (details.reason == "update")
- // browser.storage.local.get(null, r => {
- // if (r.theme) {
- // const old = encodeURIComponent(JSON.stringify(r))
- // browser.tabs.create({ url: browser.runtime.getURL(`/pages/background/reset_warning.html?data=${old}`) });
- // }
- // initDefaults();
- // })
- // else initDefaults();
- // }
- }
-)
-
-youtubeHelper.pasteInvidiousCookies();
-translateHelper.pasteSimplyTranslateCookies();
-twitterHelper.pasteNitterCookies();
-wikipediaHelper.pasteWikilessCookies();
-searchHelper.pasteSearxCookies();
-searchHelper.pasteSearxngCookies();
-searchHelper.pasteLibrexCookies();
-redditHelper.pasteLibredditCookies();
-redditHelper.pasteTedditCookies();
-tiktokHelper.pasteProxiTokCookies();
+youtubeHelper.pasteInvidiousCookies()
+translateHelper.pasteSimplyTranslateCookies()
+twitterHelper.pasteNitterCookies()
+wikipediaHelper.pasteWikilessCookies()
+searchHelper.pasteSearxCookies()
+searchHelper.pasteSearxngCookies()
+searchHelper.pasteLibrexCookies()
+redditHelper.pasteLibredditCookies()
+redditHelper.pasteTedditCookies()
+tiktokHelper.pasteProxiTokCookies()
-
-let BYPASSTABs = [];
+let BYPASSTABs = []
browser.webRequest.onBeforeRequest.addListener(
- details => {
- const url = new URL(details.url);
- if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == 'xmlhttprequest') return;
- let initiator;
- try {
- if (details.originUrl) initiator = new URL(details.originUrl);
- else if (details.initiator) initiator = new URL(details.initiator);
- }
- catch { return null; }
+ details => {
+ const url = new URL(details.url)
+ if (new RegExp(/^chrome-extension:\/{2}.*\/instances\/.*.json$/).test(url.href) && details.type == "xmlhttprequest") return
+ let initiator
+ try {
+ if (details.originUrl) initiator = new URL(details.originUrl)
+ else if (details.initiator) initiator = new URL(details.initiator)
+ } catch {
+ return null
+ }
- let newUrl = youtubeMusicHelper.redirect(url, details.type)
- if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator)
- if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = instagramHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = mapsHelper.redirect(url, initiator);
- if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = sendTargetsHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator);
- if (!newUrl) newUrl = translateHelper.redirect(url);
- if (!newUrl) newUrl = searchHelper.redirect(url)
- if (!newUrl) newUrl = wikipediaHelper.redirect(url);
+ let newUrl = youtubeMusicHelper.redirect(url, details.type)
+ if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = instagramHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = mapsHelper.redirect(url, initiator)
+ if (!newUrl) newUrl = redditHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = mediumHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = quoraHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = libremdbHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = reutersHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = imgurHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = tiktokHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = sendTargetsHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = peertubeHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = lbryHelper.redirect(url, details.type, initiator)
+ if (!newUrl) newUrl = translateHelper.redirect(url)
+ if (!newUrl) newUrl = searchHelper.redirect(url)
+ if (!newUrl) newUrl = wikipediaHelper.redirect(url)
- if (
- details.frameAncestors && details.frameAncestors.length > 0 &&
- generalHelper.isException(new URL(details.frameAncestors[0].url))
- ) newUrl = null;
+ if (details.frameAncestors && details.frameAncestors.length > 0 && generalHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null
- if (generalHelper.isException(url)) newUrl = 'BYPASSTAB';
- if (BYPASSTABs.includes(details.tabId)) newUrl = null;
+ if (generalHelper.isException(url)) newUrl = "BYPASSTAB"
+ if (BYPASSTABs.includes(details.tabId)) newUrl = null
- if (newUrl) {
- if (newUrl === 'CANCEL') {
- console.log(`Canceled ${url}`);
- return { cancel: true };
- }
- if (newUrl === 'BYPASSTAB') {
- console.log(`Bypassed ${details.tabId} ${url}`);
- if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId);
- return null;
- }
- console.info("Redirecting", url.href, "=>", newUrl);
- return { redirectUrl: newUrl };
- }
- return null;
- },
- { urls: ["<all_urls>"], },
- ["blocking"]
-);
+ if (newUrl) {
+ if (newUrl === "CANCEL") {
+ console.log(`Canceled ${url}`)
+ return { cancel: true }
+ }
+ if (newUrl === "BYPASSTAB") {
+ console.log(`Bypassed ${details.tabId} ${url}`)
+ if (!BYPASSTABs.includes(details.tabId)) BYPASSTABs.push(details.tabId)
+ return null
+ }
+ console.info("Redirecting", url.href, "=>", newUrl)
+ return { redirectUrl: newUrl }
+ }
+ return null
+ },
+ { urls: ["<all_urls>"] },
+ ["blocking"]
+)
-browser.tabs.onRemoved.addListener(
- tabId => {
- const i = BYPASSTABs.indexOf(tabId);
- if (i > -1) {
- BYPASSTABs.splice(i, 1);
- console.log("Removed BYPASSTABs", tabId);
- }
- }
-);
+browser.tabs.onRemoved.addListener(tabId => {
+ const i = BYPASSTABs.indexOf(tabId)
+ if (i > -1) {
+ BYPASSTABs.splice(i, 1)
+ console.log("Removed BYPASSTABs", tabId)
+ }
+})
browser.webRequest.onHeadersReceived.addListener(
- e => {
- let response = youtubeHelper.removeXFrameOptions(e);
- if (!response) response = twitterHelper.removeXFrameOptions(e);
- return response;
- },
- { urls: ["<all_urls>"] },
- ["blocking", "responseHeaders"]
-);
+ e => {
+ let response = youtubeHelper.removeXFrameOptions(e)
+ if (!response) response = twitterHelper.removeXFrameOptions(e)
+ return response
+ },
+ { urls: ["<all_urls>"] },
+ ["blocking", "responseHeaders"]
+)
async function redirectOfflineInstance(url, tabId) {
- let newUrl = await youtubeHelper.switchInstance(url);
- if (!newUrl) newUrl = await twitterHelper.switchInstance(url);
- if (!newUrl) newUrl = await instagramHelper.switchInstance(url);
- if (!newUrl) newUrl = await redditHelper.switchInstance(url);
- if (!newUrl) newUrl = await searchHelper.switchInstance(url);
- if (!newUrl) newUrl = await translateHelper.switchInstance(url);
- if (!newUrl) newUrl = await mediumHelper.switchInstance(url);
- if (!newUrl) newUrl = await quoraHelper.switchInstance(url);
- if (!newUrl) newUrl = await libremdbHelper.switchInstance(url);
- if (!newUrl) newUrl = await tiktokHelper.switchInstance(url);
- if (!newUrl) newUrl = await imgurHelper.switchInstance(url);
- if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url);
- if (!newUrl) newUrl = await peertubeHelper.switchInstance(url);
- if (!newUrl) newUrl = await lbryHelper.switchInstance(url);
+ let newUrl = await youtubeHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await twitterHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await instagramHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await redditHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await searchHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await translateHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await mediumHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await quoraHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await libremdbHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await tiktokHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await imgurHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await wikipediaHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await peertubeHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await lbryHelper.switchInstance(url, true)
+ if (!newUrl) newUrl = await youtubeMusicHelper.switchInstance(url, true)
- if (newUrl) {
- if (counter >= 5) {
- browser.tabs.update(tabId, { url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}` });
- counter = 0;
- } else {
- browser.tabs.update(tabId, { url: newUrl });
- counter++;
- }
- }
+ if (newUrl) {
+ if (counter >= 5) {
+ browser.tabs.update(tabId, {
+ url: `/pages/errors/instance_offline.html?url=${encodeURIComponent(newUrl)}`,
+ })
+ counter = 0
+ } else {
+ browser.tabs.update(tabId, { url: newUrl })
+ counter++
+ }
+ }
}
-let counter = 0;
+let counter = 0
function isAutoRedirect() {
- return new Promise(resolve => browser.storage.local.get('autoRedirect', r => resolve(r.autoRedirect == true)))
+ return new Promise(resolve => browser.storage.local.get("autoRedirect", r => resolve(r.autoRedirect == true)))
}
browser.webRequest.onResponseStarted.addListener(
- async details => {
- if (!await isAutoRedirect()) return null;
- if (details.type == 'main_frame' && details.statusCode >= 500) redirectOfflineInstance(new URL(details.url), details.tabId);
- },
- { urls: ["<all_urls>"] }
+ async details => {
+ if (!(await isAutoRedirect())) return null
+ if (details.type == "main_frame" && details.statusCode >= 500) redirectOfflineInstance(new URL(details.url), details.tabId)
+ },
+ { urls: ["<all_urls>"] }
)
browser.webRequest.onErrorOccurred.addListener(
- async details => {
- if (!await isAutoRedirect()) return;
- if (details.type == 'main_frame') redirectOfflineInstance(new URL(details.url), details.tabId);
- },
- { urls: ["<all_urls>"] }
+ async details => {
+ if (!(await isAutoRedirect())) return
+ if (details.type == "main_frame") redirectOfflineInstance(new URL(details.url), details.tabId)
+ },
+ { urls: ["<all_urls>"] }
)
-browser.commands.onCommand.addListener(
- command => {
- if (command === 'switchInstance') utils.switchInstance();
- else if (command == 'copyRaw') utils.copyRaw();
- else if (command == 'unify') utils.unify();
- }
-)
+browser.commands.onCommand.addListener(command => {
+ if (command === "switchInstance") utils.switchInstance()
+ else if (command == "copyRaw") utils.copyRaw()
+ else if (command == "unify") utils.unify()
+})
browser.contextMenus.create({
- id: "settings",
- title: browser.i18n.getMessage("Settings"),
- contexts: ["browser_action"]
-});
+ id: "settings",
+ title: browser.i18n.getMessage("Settings"),
+ contexts: ["browser_action"],
+})
browser.contextMenus.create({
- id: "switchInstance",
- title: browser.i18n.getMessage("switchInstance"),
- contexts: ["browser_action"]
-});
+ id: "switchInstance",
+ title: browser.i18n.getMessage("switchInstance"),
+ contexts: ["browser_action"],
+})
browser.contextMenus.create({
- id: "copyRaw",
- title: browser.i18n.getMessage("copyRaw"),
- contexts: ["browser_action"]
-});
+ id: "copyRaw",
+ title: browser.i18n.getMessage("copyRaw"),
+ contexts: ["browser_action"],
+})
browser.contextMenus.create({
- id: "unify",
- title: browser.i18n.getMessage("unifySettings"),
- contexts: ["browser_action"]
-});
-
+ id: "unify",
+ title: browser.i18n.getMessage("unifySettings"),
+ contexts: ["browser_action"],
+})
-browser.contextMenus.onClicked.addListener(
- (info) => {
- if (info.menuItemId == 'switchInstance') utils.switchInstance();
- else if (info.menuItemId == 'settings') browser.runtime.openOptionsPage()
- else if (info.menuItemId == 'copyRaw') utils.copyRaw();
- else if (info.menuItemId == 'unify') utils.unify();
- }
-);
+browser.contextMenus.onClicked.addListener(info => {
+ if (info.menuItemId == "switchInstance") utils.switchInstance()
+ else if (info.menuItemId == "settings") browser.runtime.openOptionsPage()
+ else if (info.menuItemId == "copyRaw") utils.copyRaw()
+ else if (info.menuItemId == "unify") utils.unify()
+})
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
- if (message.function === 'unify') utils.unify(false).then(r => sendResponse({ response: r }))
- return true;
-});
+ if (message.function === "unify") utils.unify(false).then(r => sendResponse({ response: r }))
+ return true
+})
-browser.storage.local.set({"version": browser.runtime.getManifest().version})
+browser.storage.local.set({ version: browser.runtime.getManifest().version })
diff --git a/src/pages/background/incognito.html b/src/pages/background/incognito.html
index 7b1c0ee1..227d99e4 100644
--- a/src/pages/background/incognito.html
+++ b/src/pages/background/incognito.html
@@ -1,37 +1,35 @@
<!DOCTYPE html>
<html>
+ <head>
+ <meta charset="utf-8" />
+ <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__">Initializing Cookies</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;
+ }
-<head>
- <meta charset="utf-8" />
- <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__">Initializing Cookies</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 {
+ text-align: center;
+ }
+ </style>
+ </head>
- div {
- text-align: center;
- }
- </style>
-</head>
-
-<body>
- <div>
- <p>Initializing Cookies...</p>
- </div>
- <script type="module" src="incognito.js"></script>
-</body>
-
-</html> \ No newline at end of file
+ <body>
+ <div>
+ <p>Initializing Cookies...</p>
+ </div>
+ <script type="module" src="incognito.js"></script>
+ </body>
+</html>
diff --git a/src/pages/background/incognito.js b/src/pages/background/incognito.js
index f42eadcf..c7ed2b7d 100644
--- a/src/pages/background/incognito.js
+++ b/src/pages/background/incognito.js
@@ -1,22 +1,22 @@
-import youtubeHelper from "../../assets/javascripts/youtube/youtube.js";
-import twitterHelper from "../../assets/javascripts/twitter.js";
-import redditHelper from "../../assets/javascripts/reddit.js";
-import searchHelper from "../../assets/javascripts/search.js";
-import translateHelper from "../../assets/javascripts/translate/translate.js";
-import wikipediaHelper from "../../assets/javascripts/wikipedia.js";
-import tiktokHelper from "../../assets/javascripts/tiktok.js";
+import youtubeHelper from "../../assets/javascripts/youtube/youtube.js"
+import twitterHelper from "../../assets/javascripts/twitter.js"
+import redditHelper from "../../assets/javascripts/reddit.js"
+import searchHelper from "../../assets/javascripts/search.js"
+import translateHelper from "../../assets/javascripts/translate/translate.js"
+import wikipediaHelper from "../../assets/javascripts/wikipedia.js"
+import tiktokHelper from "../../assets/javascripts/tiktok.js"
-window.browser = window.browser || window.chrome;
+window.browser = window.browser || window.chrome
-await youtubeHelper.pasteInvidiousCookies();
-await translateHelper.pasteSimplyTranslateCookies();
-await twitterHelper.pasteNitterCookies();
-await wikipediaHelper.pasteWikilessCookies();
-await searchHelper.pasteSearxCookies();
-await searchHelper.pasteSearxngCookies();
-await searchHelper.pasteLibrexCookies();
-await redditHelper.pasteLibredditCookies();
-await redditHelper.pasteTedditCookies();
-await tiktokHelper.pasteProxiTokCookies();
+await youtubeHelper.pasteInvidiousCookies()
+await translateHelper.pasteSimplyTranslateCookies()
+await twitterHelper.pasteNitterCookies()
+await wikipediaHelper.pasteWikilessCookies()
+await searchHelper.pasteSearxCookies()
+await searchHelper.pasteSearxngCookies()
+await searchHelper.pasteLibrexCookies()
+await redditHelper.pasteLibredditCookies()
+await redditHelper.pasteTedditCookies()
+await tiktokHelper.pasteProxiTokCookies()
window.close()
diff --git a/src/pages/background/reset_warning.html b/src/pages/background/reset_warning.html
index d2d493e0..f1881ed8 100644
--- a/src/pages/background/reset_warning.html
+++ b/src/pages/background/reset_warning.html
@@ -1,66 +1,59 @@
<!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__">Reset Warning</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;
+ }
-<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__">Reset Warning</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 {
- width: 80%;
- }
+ div.logo {
+ display: flex;
+ }
- div.logo {
- display: flex;
- }
+ img {
+ width: 90px;
+ height: auto;
+ }
+ </style>
+ </head>
- img {
- width: 90px;
- height: auto;
- }
- </style>
+ <body>
+ <div>
+ <div class="logo">
+ <img src="/assets/images/libredirect.svg" alt="LibRedirect icon" />
+ <h1>LibRedirect</h1>
+ </div>
-</head>
+ <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 a stable plateau though.</p>
-<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 a stable plateau though.</p>
-
-
- <a id="export-settings" class="button button-inline">
- <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px"
- fill="currentColor">
- <path
- d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z">
- </path>
- </svg>
- &nbsp;
- <x data-localise="__MSG_exportSettings__">Export Settings</x>
- </a>
- </div>
-</body>
-<script src="reset_warning.js"></script>
-
-</html> \ No newline at end of file
+ <a id="export-settings" class="button button-inline">
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="currentColor">
+ <path
+ d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"
+ ></path>
+ </svg>
+ &nbsp;
+ <x data-localise="__MSG_exportSettings__">Export Settings</x>
+ </a>
+ </div>
+ </body>
+ <script src="reset_warning.js"></script>
+</html>
diff --git a/src/pages/background/reset_warning.js b/src/pages/background/reset_warning.js
index 15e3a594..9ce49c9a 100644
--- a/src/pages/background/reset_warning.js
+++ b/src/pages/background/reset_warning.js
@@ -1,11 +1,7 @@
-let params = new URLSearchParams(location.search);
+let params = new URLSearchParams(location.search)
-const resultString = JSON.stringify(
- JSON.parse(params.get('data')),
- null,
- ' '
-);
+const resultString = JSON.stringify(JSON.parse(params.get("data")), null, " ")
-let exportSettingsElement = document.getElementById("export-settings");
-exportSettingsElement.href = 'data:application/json;base64,' + btoa(resultString);
-exportSettingsElement.download = 'libredirect-settings.json';
+let exportSettingsElement = document.getElementById("export-settings")
+exportSettingsElement.href = "data:application/json;base64," + btoa(resultString)
+exportSettingsElement.download = "libredirect-settings.json"