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