Fixing bugs. 2.9.1 => 3.0.0
This commit is contained in:
parent
ac5ac2eda9
commit
df61cdb265
|
@ -941,6 +941,7 @@ async function copyRaw(url) {
|
||||||
* @param {URL} url
|
* @param {URL} url
|
||||||
*/
|
*/
|
||||||
function isException(url) {
|
function isException(url) {
|
||||||
|
if (!options) return false
|
||||||
if (!options.exceptions) return false
|
if (!options.exceptions) return false
|
||||||
let exceptions = options.exceptions
|
let exceptions = options.exceptions
|
||||||
if (exceptions && url) {
|
if (exceptions && url) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "__MSG_extensionName__",
|
"name": "__MSG_extensionName__",
|
||||||
"description": "__MSG_extensionDescription__",
|
"description": "__MSG_extensionDescription__",
|
||||||
"version": "2.9.1",
|
"version": "3.0.0",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"browser_specific_settings": {
|
"browser_specific_settings": {
|
||||||
"gecko": {
|
"gecko": {
|
||||||
|
|
|
@ -71,6 +71,7 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
(newUrl && newUrl.startsWith("https://no-instance.libredirect.invalid")) ||
|
(newUrl && newUrl.startsWith("https://no-instance.libredirect.invalid")) ||
|
||||||
(!newUrl && url.href.startsWith("https://no-instance.libredirect.invalid"))
|
(!newUrl && url.href.startsWith("https://no-instance.libredirect.invalid"))
|
||||||
) {
|
) {
|
||||||
|
if (details.type != "main_frame") return null
|
||||||
newUrl = newUrl ? new URL(newUrl) : url
|
newUrl = newUrl ? new URL(newUrl) : url
|
||||||
const frontend = newUrl.searchParams.get("frontend")
|
const frontend = newUrl.searchParams.get("frontend")
|
||||||
const oldUrl = new URL(newUrl.searchParams.get("url"))
|
const oldUrl = new URL(newUrl.searchParams.get("url"))
|
||||||
|
@ -85,8 +86,8 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
return { cancel: true }
|
return { cancel: true }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!newUrl) {
|
if (!newUrl && url.href.match(/^https?:\/{2}(.*\.)?libredirect\.invalid.*/)) {
|
||||||
if (url.href.match(/^https?:\/{2}(.*\.)?libredirect\.invalid.*/)) {
|
if (details.type != "main_frame") return null
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
message: "disabled",
|
message: "disabled",
|
||||||
url: url.href,
|
url: url.href,
|
||||||
|
@ -96,7 +97,6 @@ browser.webRequest.onBeforeRequest.addListener(
|
||||||
})
|
})
|
||||||
return { cancel: true }
|
return { cancel: true }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (newUrl === "CANCEL") {
|
if (newUrl === "CANCEL") {
|
||||||
console.log(`Cancelling ${url}`)
|
console.log(`Cancelling ${url}`)
|
||||||
|
@ -121,8 +121,9 @@ browser.webRequest.onHeadersReceived.addListener(
|
||||||
details => {
|
details => {
|
||||||
if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
|
if (details.statusCode >= 501 || details.statusCode == 429 || details.statusCode == 403) {
|
||||||
const url = new URL(details.url)
|
const url = new URL(details.url)
|
||||||
const { service, frontend } = servicesHelper.computeFrontend(url)
|
const r = servicesHelper.computeFrontend(url)
|
||||||
if (!service) return
|
if (!r) return
|
||||||
|
const { service, frontend } = r
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
message: "server_error",
|
message: "server_error",
|
||||||
code: details.statusCode,
|
code: details.statusCode,
|
||||||
|
|
Loading…
Reference in New Issue