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