This commit is contained in:
ManeraKai 2023-05-14 14:42:23 +03:00
parent 8f8c2a24e4
commit cf45e7b8c7
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
3 changed files with 54 additions and 12 deletions

View File

@ -161,7 +161,8 @@
"proxiTok": { "proxiTok": {
"name": "ProxiTok", "name": "ProxiTok",
"instanceList": true, "instanceList": true,
"url": "https://github.com/pablouser1/ProxiTok" "url": "https://github.com/pablouser1/ProxiTok",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -187,7 +188,8 @@
"teddit": { "teddit": {
"name": "Teddit", "name": "Teddit",
"instanceList": true, "instanceList": true,
"url": "https://codeberg.org/teddit/teddit" "url": "https://codeberg.org/teddit/teddit",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -277,7 +279,8 @@
"quetre": { "quetre": {
"name": "Quetre", "name": "Quetre",
"instanceList": true, "instanceList": true,
"url": "https://github.com/zyachel/quetre" "url": "https://github.com/zyachel/quetre",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -297,7 +300,8 @@
"libremdb": { "libremdb": {
"name": "libremdb", "name": "libremdb",
"instanceList": true, "instanceList": true,
"url": "https://github.com/zyachel/libremdb" "url": "https://github.com/zyachel/libremdb",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -317,8 +321,7 @@
"breezeWiki": { "breezeWiki": {
"name": "BreezeWiki", "name": "BreezeWiki",
"instanceList": true, "instanceList": true,
"url": "https://breezewiki.com", "url": "https://breezewiki.com"
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -362,7 +365,8 @@
"searxng": { "searxng": {
"name": "SearXNG", "name": "SearXNG",
"instanceList": true, "instanceList": true,
"url": "https://github.com/searxng/searxng" "url": "https://github.com/searxng/searxng",
"localhost": true
}, },
"searx": { "searx": {
"name": "SearX", "name": "SearX",
@ -404,7 +408,8 @@
"lingva": { "lingva": {
"name": "Lingva Translate", "name": "Lingva Translate",
"instanceList": true, "instanceList": true,
"url": "https://github.com/TheDavidDelta/lingva-translate" "url": "https://github.com/TheDavidDelta/lingva-translate",
"localhost": true
}, },
"libreTranslate": { "libreTranslate": {
"name": "LibreTranslate", "name": "LibreTranslate",
@ -521,7 +526,8 @@
"dumb": { "dumb": {
"name": "Dumb", "name": "Dumb",
"instanceList": true, "instanceList": true,
"url": "https://github.com/rramiachraf/dumb" "url": "https://github.com/rramiachraf/dumb",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -561,7 +567,8 @@
"anonymousOverflow": { "anonymousOverflow": {
"name": "AnonymousOverflow", "name": "AnonymousOverflow",
"instanceList": true, "instanceList": true,
"url": "https://github.com/httpjamesm/AnonymousOverflow" "url": "https://github.com/httpjamesm/AnonymousOverflow",
"localhost": true
} }
}, },
"targets": [ "targets": [
@ -582,7 +589,8 @@
"biblioReads": { "biblioReads": {
"name": "BiblioReads", "name": "BiblioReads",
"instanceList": true, "instanceList": true,
"url": "https://github.com/nesaku/BiblioReads" "url": "https://github.com/nesaku/BiblioReads",
"localhost": true
} }
}, },
"targets": [ "targets": [

View File

@ -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 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 (servicesHelper.isException(url)) {
if (details.type == "main_frame") if (details.type == "main_frame")
newUrl = "BYPASSTAB" newUrl = "BYPASSTAB"
@ -53,6 +52,15 @@ browser.webRequest.onBeforeRequest.addListener(
return null 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) {
if (newUrl === "CANCEL") { if (newUrl === "CANCEL") {
console.log(`Canceled ${url}`) console.log(`Canceled ${url}`)

View File

@ -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>