about summary refs log tree commit diff stats
path: root/src/pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/background/background.js10
-rw-r--r--src/pages/messages/no_instance.html26
2 files changed, 35 insertions, 1 deletions
diff --git a/src/pages/background/background.js b/src/pages/background/background.js
index 80713059..8e427763 100644
--- a/src/pages/background/background.js
+++ b/src/pages/background/background.js
@@ -45,7 +45,6 @@ browser.webRequest.onBeforeRequest.addListener(
 
 		if (details.frameAncestors && details.frameAncestors.length > 0 && servicesHelper.isException(new URL(details.frameAncestors[0].url))) newUrl = null
 
-		console.log(servicesHelper.isException(url))
 		if (servicesHelper.isException(url)) {
 			if (details.type == "main_frame")
 				newUrl = "BYPASSTAB"
@@ -53,6 +52,15 @@ browser.webRequest.onBeforeRequest.addListener(
 				return null
 		}
 
+		if (!newUrl) {
+			const match = url.href.match(/^https?:\/{2}(.*)\.libredirect\.invalid.*/)
+			if (match[1]) {
+				browser.tabs.update({
+					url: browser.runtime.getURL(`/pages/messages/no_instance.html`)
+				});
+			}
+		}
+
 		if (newUrl) {
 			if (newUrl === "CANCEL") {
 				console.log(`Canceled ${url}`)
diff --git a/src/pages/messages/no_instance.html b/src/pages/messages/no_instance.html
new file mode 100644
index 00000000..76ec19cf
--- /dev/null
+++ b/src/pages/messages/no_instance.html
@@ -0,0 +1,26 @@
+<!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.0">
+    <link href="../stylesheets/styles.css" rel="stylesheet">
+    <title>No instances found</title>
+    <style>
+        #body {
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            height: 100vh;
+        }
+    </style>
+</head>
+
+<body>
+    <div id="body">
+        <h1>You have no instance selected for this frontend</h1>
+    </div>
+</body>
+
+</html>
\ No newline at end of file