Started work on services.js

This commit is contained in:
Hygna 2022-09-07 18:05:18 +01:00
parent c533023546
commit da446a981b
3 changed files with 547 additions and 437 deletions

View File

@ -0,0 +1,105 @@
window.browser = window.browser || window.chrome
import utils from "./utils.js"
let config
function getConfig() {
return new Promise(async resolve => {
fetch("/config/config.json")
.then(response => response.text())
.then(data => {
config = JSON.parse(data)
})
resolve()
})
}
let redirects = {}
let disabled, curNetwork, networkFallback, redirectType
function init() {
return new Promise(async resolve => {
browser.storage.local.get(["network", "networkFallback"], r => {
curNetwork = r.network
networkFallback = r.networkFallback
})
//cur = current
getConfig()
for (service in config.services) {
redirects = {}
browser.storage.local.get([`disable${camelCase(service)}`, `${service}Redirects`, `${service}RedirectType,`, `${service}Frontend`], r => {
disabled = r["disable" + camelCase(service)]
redirects = r[service + "Redirects"]
frontend = r[service + "Frontend"]
})
for (frontend in config[service].frontends) {
redirects[frontend] = {}
for (network in config.networks) {
browser.storage.local.get([`${frontend}${camelCase(network)}RedirectsChecks`, `${frontend}${camelCase(network)}CustomRedirects`], r => {
redirects[frontend][network] = [...r[frontend + camelCase(network) + "RedirectsChecks"], ...r[frontend + camelCase(network) + "CustomRedirects"]]
})
}
}
}
resolve()
})
}
init()
browser.storage.onChanged.addListener(init)
function redirect(url, type, initiator) {
if (url.pathname == "/") return
for (curService in config.services) {
if (disabled && !disableOverride) continue
if (initiator && (all().includes(initiator.origin) || targets.includes(initiator.host))) continue
//if (!targets.some(rx => rx.test(url.href))) continue
if (!target.test(url)) continue
if (type != redirectType && type != "both") continue
let instanceList = redirects[frontend][curNetwork]
if (instanceList.length === 0 && networkFallback) instanceList = redirects[frontend].clearnet
if (instanceList.length === 0) return
const randomInstance = utils.getRandomInstance(instanceList)
return `${randomInstance}${url.pathname}${url.search}`
}
}
function initDefaults() {
return new Promise(resolve => {
fetch("/instances/data.json")
.then(response => response.text())
.then(data => {
let dataJson = JSON.parse(data)
redirects = dataJson
browser.storage.local.get(["cloudflareBlackList", "authenticateBlackList", "offlineBlackList"], async r => {
for (service in config.services) {
for (frontend in service.frontends) {
for (const instance of [...r.cloudflareBlackList, ...r.authenticateBlackList, ...r.offlineBlackList]) {
let i = redirects[frontend]["clearnet"].indexOf(instance)
if (i > -1) redirects[frontend]["clearnet"].splice(i, 1)
}
browser.storage.local.set({
["disable" + camelCase(service)]: false,
[service + "Redirects"]: redirects,
[service + "RedirectType"]: "both",
})
for (frontend in service.frontends) {
for (protocol in config.protocols) {
browser.storage.local.set({
[frontend + camelCase(protocol) + "RedirectsChecks"]: [...redirects[frontend][protocol]],
[frontend + camelCase(protocol) + "CustomRedirects"]: [],
})
}
}
;() => resolve()
}
}
})
})
})
}
export default {
redirect,
}

View File

@ -1,437 +1,437 @@
{ {
"networks": { "networks": {
"clearnet": { "clearnet": {
"url": "org", "url": "org",
"name": "Clearnet" "name": "Clearnet"
}, },
"tor": { "tor": {
"url": "onion", "url": "onion",
"name": "Tor" "name": "Tor"
}, },
"i2p": { "i2p": {
"url": "i2p", "url": "i2p",
"name": "I2P" "name": "I2P"
}, },
"loki": { "loki": {
"url": "loki", "url": "loki",
"name": "Lokinet" "name": "Lokinet"
} }
}, },
"services": { "services": {
"youtube": { "youtube": {
"frontends": { "frontends": {
"invidious": { "invidious": {
"preferences": { "preferences": {
"cookies": ["PREFS"] "cookies": ["PREFS"]
} }
}, },
"piped": { "piped": {
"preferences": { "preferences": {
"localstorage": [ "localstorage": [
"bufferGoal", "bufferGoal",
"comments", "comments",
"disableLBRY", "disableLBRY",
"enabledCodecs", "enabledCodecs",
"hl", "hl",
"homepage", "homepage",
"instance", "instance",
"listen", "listen",
"minimizeDescription", "minimizeDescription",
"playerAutoPlay", "playerAutoPlay",
"proxyLBRY", "proxyLBRY",
"quality", "quality",
"region", "region",
"selectedSkip", "selectedSkip",
"sponsorblock", "sponsorblock",
"theme", "theme",
"volume", "volume",
"watchHistory" "watchHistory"
] ]
} }
}, },
"pipedMaterial": { "pipedMaterial": {
"preferences": { "preferences": {
"localstorage": ["PREFERENCES"] "localstorage": ["PREFERENCES"]
} }
}, },
"cloudtube": { "cloudtube": {
"preferences": { "preferences": {
"token": "token", "token": "token",
"fetchEndpoint": "/api/settings", "fetchEndpoint": "/api/settings",
"setEndpoint": "/settings" "setEndpoint": "/settings"
} }
} }
}, },
"singleInstanceFrontends": ["freetube", "yatte"], "singleInstanceFrontends": ["freetube", "yatte"],
"targets": [ "targets": [
"^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\/.*|$)", "^https?:\\/{2}(www\\.|music\\.|m\\.|)youtube.com(\\/.*|$)",
"^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*", "^https?:\\/{2}img\\.youtube.com\\/vi\\/.*\\/..*",
"^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*", "^https?:\\/{2}(i|s)\\.ytimg.com\\/vi\\/.*\\/..*",
"^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*", "^https?:\\/{2}(www\\.|music\\.|)youtube.com\\/watch?v=..*",
"^https?:\\/{2}youtu\\.be\\/..*", "^https?:\\/{2}youtu\\.be\\/..*",
"^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*" "^https?:\\/{2}(www\\.|)(youtube|youtube-nocookie)\\.com\\/embed\\/..*"
], ],
"name": "Youtube", "name": "Youtube",
"defaults": { "defaults": {
"disableYoutube": false, "disableYoutube": false,
"enableYoutubeCustomSettings": false, "enableYoutubeCustomSettings": false,
"onlyEmbeddedVideo": "both", "onlyEmbeddedVideo": "both",
"youtubeFrontend": "invidious", "youtubeFrontend": "invidious",
"youtubeEmbedFrontend": "invidious" "youtubeEmbedFrontend": "invidious"
}, },
"imageType": "png" "imageType": "png"
}, },
"youtubeMusic": { "youtubeMusic": {
"frontends": { "frontends": {
"beatbump": {}, "beatbump": {},
"hyperpipe": {} "hyperpipe": {}
}, },
"targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"], "targets": ["^https?:\\/{2}music\\.youtube\\.com(\\/.*|$)"],
"name": "YT Music", "name": "YT Music",
"defaults": { "defaults": {
"disableYoutubeMusic": false, "disableYoutubeMusic": false,
"youtubeMusicFrontend": "beatbump" "youtubeMusicFrontend": "beatbump"
}, },
"imageType": "png" "imageType": "png"
}, },
"twitter": { "twitter": {
"frontends": { "frontends": {
"nitter": { "nitter": {
"preferences": { "preferences": {
"cookies": [ "cookies": [
"theme", "theme",
"infiniteScroll", "infiniteScroll",
"stickyProfile", "stickyProfile",
"bidiSupport", "bidiSupport",
"hideTweetStats", "hideTweetStats",
"hideBanner", "hideBanner",
"hidePins", "hidePins",
"hideReplies", "hideReplies",
"squareAvatars", "squareAvatars",
"mp4Playback", "mp4Playback",
"hlsPlayback", "hlsPlayback",
"proxyVideos", "proxyVideos",
"muteVideos", "muteVideos",
"autoplayGifs", "autoplayGifs",
"replaceInstagram", "replaceInstagram",
"replaceReddit", "replaceReddit",
"replaceTwitter", "replaceTwitter",
"replaceYouTube" "replaceYouTube"
] ]
} }
} }
}, },
"targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"], "targets": ["^https?:\\/{2}(www\\.|mobile\\.|)twitter\\.com", "^https?:\\/{2}(pbs\\.|video\\.|)twimg\\.com", "^https?:\\/{2}platform\\.twitter\\.com/embed", "^https?:\\/{2}t\\.co"],
"name": "Twitter", "name": "Twitter",
"defaults": { "defaults": {
"disableTwitter": false, "disableTwitter": false,
"twitterRedirectType": "both" "twitterRedirectType": "both"
}, },
"imageType": "png" "imageType": "png"
}, },
"instagram": { "instagram": {
"frontends": { "frontends": {
"bibliogram": { "bibliogram": {
"preferences": { "preferences": {
"token": "token", "token": "token",
"fetchEndpoint": "/settings.json", "fetchEndpoint": "/settings.json",
"setEndpoint": "/applysettings" "setEndpoint": "/applysettings"
} }
} }
}, },
"targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"], "targets": ["^https?:\\/{2}(www\\.)?instagram\\.com"],
"name": "Instagram", "name": "Instagram",
"defaults": { "defaults": {
"disableInstagram": false "disableInstagram": false
}, },
"imageType": "png" "imageType": "png"
}, },
"tiktok": { "tiktok": {
"frontends": { "frontends": {
"proxiTok": {} "proxiTok": {}
}, },
"targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"], "targets": ["^https?:\\/{2}(www\\.|)tiktok\\.com.*"],
"name": "TikTok", "name": "TikTok",
"defaults": { "defaults": {
"disableTiktok": false "disableTiktok": false
}, },
"imageType": "png" "imageType": "png"
}, },
"reddit": { "reddit": {
"frontends": { "frontends": {
"libreddit": { "libreddit": {
"preferences": { "preferences": {
"cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"] "cookies": ["theme", "front_page", "layout", "wide", "post_sort", "comment_sort", "show_nsfw", "autoplay_videos", "use_hls", "hide_hls_notification", "subscriptions", "filters"]
} }
}, },
"teddit": { "teddit": {
"preferences": { "preferences": {
"cookies": [ "cookies": [
"collapse_child_comments", "collapse_child_comments",
"domain_instagram", "domain_instagram",
"domain_twitter", "domain_twitter",
"domain_youtube", "domain_youtube",
"flairs", "flairs",
"highlight_controversial", "highlight_controversial",
"nsfw_enabled", "nsfw_enabled",
"post_media_max_height", "post_media_max_height",
"show_upvoted_percentage", "show_upvoted_percentage",
"show_upvotes", "show_upvotes",
"theme", "theme",
"videos_muted" "videos_muted"
] ]
} }
} }
}, },
"targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"], "targets": ["^https?:\\/{2}(www\\.|old\\.|np\\.|new\\.|amp\\.|)reddit\\.com", "^https?:\\/{2}(i\\.|preview\\.)redd\\.it"],
"name": "Reddit", "name": "Reddit",
"defaults": { "defaults": {
"disableReddit": false, "disableReddit": false,
"redditFrontend": "libreddit" "redditFrontend": "libreddit"
}, },
"imageType": "png" "imageType": "png"
}, },
"imgur": { "imgur": {
"frontends": { "frontends": {
"rimgo": { "rimgo": {
"preferences": {} "preferences": {}
} }
}, },
"targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"], "targets": ["^https?:\\/{2}([im]\\.)?imgur\\.(com|io)(\\/|$)"],
"name": "Imgur", "name": "Imgur",
"defaults": { "disableImgur": false }, "defaults": { "disableImgur": false },
"imageType": "png" "imageType": "png"
}, },
"wikipedia": { "wikipedia": {
"frontends": { "frontends": {
"wikiless": { "wikiless": {
"preferences": { "preferences": {
"cookies": ["theme", "default_lang"] "cookies": ["theme", "default_lang"]
} }
} }
}, },
"targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"], "targets": ["^https?:\\/{2}([a-z]+\\.)*wikipedia\\.org"],
"name": "Wikipedia", "name": "Wikipedia",
"defaults": { "disableWikipedia": true }, "defaults": { "disableWikipedia": true },
"imageType": "svg" "imageType": "svg"
}, },
"medium": { "medium": {
"frontends": { "frontends": {
"scribe": { "scribe": {
"preferences": {} "preferences": {}
} }
}, },
"targets": [ "targets": [
"(?:.*\\.)*(?<!(link\\.|cdn\\-images\\-\\d+\\.))medium\\.com(\\/.*)?$", "(?:.*\\.)*(?<!(link\\.|cdn\\-images\\-\\d+\\.))medium\\.com(\\/.*)?$",
"^towardsdatascience\\.com", "^towardsdatascience\\.com",
"^uxdesign\\.cc", "^uxdesign\\.cc",
"^uxplanet\\.org", "^uxplanet\\.org",
"^betterprogramming\\.pub", "^betterprogramming\\.pub",
"^aninjusticemag\\.com", "^aninjusticemag\\.com",
"^betterhumans\\.pub", "^betterhumans\\.pub",
"^psiloveyou\\.xyz", "^psiloveyou\\.xyz",
"^entrepreneurshandbook\\.co", "^entrepreneurshandbook\\.co",
"^blog\\.coinbase\\.com", "^blog\\.coinbase\\.com",
"^levelup\\.gitconnected\\.com ", "^levelup\\.gitconnected\\.com ",
"^javascript\\.plainenglish\\.io ", "^javascript\\.plainenglish\\.io ",
"^blog\\.bitsrc\\.io ", "^blog\\.bitsrc\\.io ",
"^itnext\\.io ", "^itnext\\.io ",
"^codeburst\\.io ", "^codeburst\\.io ",
"^infosecwriteups\\.com ", "^infosecwriteups\\.com ",
"^blog\\.devgenius\\.io ", "^blog\\.devgenius\\.io ",
"^writingcooperative\\.com " "^writingcooperative\\.com "
], ],
"name": "Medium", "name": "Medium",
"defaults": { "disableMedium": false }, "defaults": { "disableMedium": false },
"imageType": "svg" "imageType": "svg"
}, },
"quora": { "quora": {
"frontends": { "frontends": {
"quetre": { "quetre": {
"preferences": {} "preferences": {}
} }
}, },
"targets": ["^https?:\\/{2}(www\\.|)quora\\.com.*"], "targets": ["^https?:\\/{2}([a-z]+\\.)*quora\\.com.*"],
"name": "Quora", "name": "Quora",
"defaults": { "defaults": {
"disableQuora": false "disableQuora": false
}, },
"imageType": "png" "imageType": "png"
}, },
"imdb": { "imdb": {
"frontends": { "frontends": {
"libremdb": { "libremdb": {
"preferences": {} "preferences": {}
} }
}, },
"targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com.*"], "targets": ["^https?:\\/{2}(?:www\\.|)imdb\\.com.*"],
"name": "IMDb", "name": "IMDb",
"defaults": { "defaults": {
"disableImdb": true "disableImdb": true
}, },
"imageType": "svg" "imageType": "svg"
}, },
"reuters": { "reuters": {
"frontends": { "frontends": {
"neuters": { "neuters": {
"preferences": {} "preferences": {}
} }
}, },
"targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"], "targets": ["^https?:\\/{2}(www\\.|)reuters\\.com.*"],
"name": "Reuters", "name": "Reuters",
"defaults": { "defaults": {
"disableReuters": true "disableReuters": true
}, },
"imageType": "svg" "imageType": "svg"
}, },
"peertube": { "peertube": {
"frontends": { "frontends": {
"simpleertube": { "simpleertube": {
"preferences": {} "preferences": {}
} }
}, },
"targets": "datajson", "targets": "datajson",
"name": "PeerTube", "name": "PeerTube",
"defaults": { "defaults": {
"disablePeertubeTargets": true "disablePeertubeTargets": true
}, },
"imageType": "svg" "imageType": "svg"
}, },
"lbry": { "lbry": {
"frontends": { "frontends": {
"librarian": { "librarian": {
"preferences": { "preferences": {
"cookies": ["nsfw", "theme"], "cookies": ["nsfw", "theme"],
"localstorage": ["autoplay", "autoplayNextVid", "collapseComments", "plyr", "sb_categories", "showRelated"] "localstorage": ["autoplay", "autoplayNextVid", "collapseComments", "plyr", "sb_categories", "showRelated"]
} }
} }
}, },
"singleInstanceFrontends": ["lbryDesktop"], "singleInstanceFrontends": ["lbryDesktop"],
"targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"], "targets": ["^https?:\\/{2}odysee\\.com", "^https?:\\/{2}lbry\\.tv"],
"name": "LBRY", "name": "LBRY",
"defaults": { "defaults": {
"disableLbryTargets": true, "disableLbryTargets": true,
"lbryFrontend": "librarian", "lbryFrontend": "librarian",
"lbryRedirectType": "both" "lbryRedirectType": "both"
}, },
"imageType": "png" "imageType": "png"
}, },
"search": { "search": {
"frontends": { "frontends": {
"searx": { "searx": {
"preferences": { "preferences": {
"cookies": [ "cookies": [
"advanced_search", "advanced_search",
"autocomplete", "autocomplete",
"categories", "categories",
"disabled_engines", "disabled_engines",
"disabled_plugins", "disabled_plugins",
"doi_resolver", "doi_resolver",
"enabled_engines", "enabled_engines",
"enabled_plugins", "enabled_plugins",
"image_proxy", "image_proxy",
"language", "language",
"locale", "locale",
"method", "method",
"oscar-style", "oscar-style",
"results_on_new_tab", "results_on_new_tab",
"safesearch", "safesearch",
"theme", "theme",
"tokens" "tokens"
] ]
} }
}, },
"searxng": { "searxng": {
"preferences": { "preferences": {
"cookies": [ "cookies": [
"autocomplete", "autocomplete",
"categories", "categories",
"disabled_engines", "disabled_engines",
"disabled_plugins", "disabled_plugins",
"doi_resolver", "doi_resolver",
"enabled_plugins", "enabled_plugins",
"enabled_engines", "enabled_engines",
"image_proxy", "image_proxy",
"infinite_scroll", "infinite_scroll",
"language", "language",
"locale", "locale",
"maintab", "maintab",
"method", "method",
"query_in_title", "query_in_title",
"results_on_new_tab", "results_on_new_tab",
"safesearch", "safesearch",
"simple_style", "simple_style",
"theme", "theme",
"tokens" "tokens"
] ]
} }
}, },
"whoogle": { "whoogle": {
"preferences": {} "preferences": {}
}, },
"librex": { "librex": {
"preferences": { "preferences": {
"cookies": ["bibliogram", "disable_special", "invidious", "libreddit", "nitter", "proxitok", "theme", "wikiless"] "cookies": ["bibliogram", "disable_special", "invidious", "libreddit", "nitter", "proxitok", "theme", "wikiless"]
} }
} }
}, },
"targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"], "targets": ["^https?:\\/{2}search\\.libredirect\\.invalid"],
"name": "Search", "name": "Search",
"defaults": { "defaults": {
"disableSearch": false, "disableSearch": false,
"searchFrontend": "searxng", "searchFrontend": "searxng",
"searxngCustomSettings": false "searxngCustomSettings": false
}, },
"imageType": "svg" "imageType": "svg"
}, },
"translate": { "translate": {
"frontends": { "frontends": {
"simplyTranslate": { "simplyTranslate": {
"preferences": { "preferences": {
"cookies": ["from_lang", "to_lang", "tts_enabled", "use_text_fields"] "cookies": ["from_lang", "to_lang", "tts_enabled", "use_text_fields"]
} }
}, },
"lingva": { "lingva": {
"preferences": { "preferences": {
"localstorage": ["isauto", "source", "target"] "localstorage": ["isauto", "source", "target"]
} }
} }
}, },
"targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"], "targets": ["^https?:\\/{2}translate\\.google(\\.[a-z]{2,3}){1,2}\\/"],
"name": "Translate", "name": "Translate",
"defaults": { "defaults": {
"translateDisable": false, "translateDisable": false,
"translateFrontend": "simplyTranslate" "translateFrontend": "simplyTranslate"
}, },
"imageType": "svg" "imageType": "svg"
}, },
"maps": { "maps": {
"frontends": { "frontends": {
"facil": { "facil": {
"preferences": {} "preferences": {}
} }
}, },
"singleInstanceFrontends": ["osm"], "singleInstanceFrontends": ["osm"],
"targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"], "targets": ["^https?:\\/{2}(((www|maps)\\.)?(google\\.).*(\\/maps)|maps\\.(google\\.).*)"],
"name": "Maps", "name": "Maps",
"defaults": { "defaults": {
"disableMaps": false, "disableMaps": false,
"mapsFrontend": "osm" "mapsFrontend": "osm"
}, },
"imageType": "svg" "imageType": "svg"
}, },
"sendTargets": { "sendTargets": {
"frontends": { "frontends": {
"send": { "send": {
"preferences": {} "preferences": {}
} }
}, },
"targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"], "targets": ["^https?:\\/{2}send\\.libredirect\\.invalid\\/$", "^https?:\\/{2}send\\.firefox\\.com\\/$", "^https?:\\/{2}sendfiles\\.online\\/$"],
"name": "Send Files", "name": "Send Files",
"defaults": { "defaults": {
"disableSendTarget": false "disableSendTarget": false
}, },
"imageType": "svg" "imageType": "svg"
} }
} }
} }

View File

@ -22,6 +22,8 @@ import sendTargetsHelper from "../../assets/javascripts/sendTargets.js"
import peertubeHelper from "../../assets/javascripts/peertube.js" import peertubeHelper from "../../assets/javascripts/peertube.js"
import lbryHelper from "../../assets/javascripts/lbry.js" import lbryHelper from "../../assets/javascripts/lbry.js"
import servicesHelper from "../../assets/javascripts/services.js"
window.browser = window.browser || window.chrome window.browser = window.browser || window.chrome
browser.runtime.onInstalled.addListener(details => { browser.runtime.onInstalled.addListener(details => {
@ -86,6 +88,7 @@ browser.webRequest.onBeforeRequest.addListener(
return null return null
} }
/*
let newUrl = youtubeMusicHelper.redirect(url, details.type) let newUrl = youtubeMusicHelper.redirect(url, details.type)
if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator) if (!newUrl) newUrl = youtubeHelper.redirect(url, details.type, initiator)
if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator) if (!newUrl) newUrl = twitterHelper.redirect(url, details.type, initiator)
@ -104,6 +107,8 @@ browser.webRequest.onBeforeRequest.addListener(
if (!newUrl) newUrl = translateHelper.redirect(url) if (!newUrl) newUrl = translateHelper.redirect(url)
if (!newUrl) newUrl = searchHelper.redirect(url) if (!newUrl) newUrl = searchHelper.redirect(url)
if (!newUrl) newUrl = wikipediaHelper.redirect(url) if (!newUrl) newUrl = wikipediaHelper.redirect(url)
*/
let newUrl = servicesHelper.redirect(url, details.type, initiator)
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