Cleaned code
This commit is contained in:
parent
1f8e0d00e1
commit
ab7a702acc
|
@ -67,15 +67,16 @@ async function redirectAsync(url, type, initiator, forceRedirection) {
|
|||
* @param randomInstance
|
||||
* @returns {undefined|string}
|
||||
*/
|
||||
function rewrite(url, frontend, randomInstance){
|
||||
function rewrite(url, frontend, randomInstance) {
|
||||
if (!frontend || !randomInstance) return
|
||||
switch (frontend) {
|
||||
case "hyperpipe": {
|
||||
return `${randomInstance}${url.pathname}${url.search}`.replace(/\/search\?q=.*/, searchQuery => searchQuery.replace("?q=", "/"))
|
||||
}
|
||||
case "searx":
|
||||
case "searxng":
|
||||
case "searxng": {
|
||||
return `${randomInstance}/${url.search}`
|
||||
}
|
||||
case "whoogle": {
|
||||
return `${randomInstance}/search${url.search}`
|
||||
}
|
||||
|
@ -101,7 +102,6 @@ function rewrite(url, frontend, randomInstance){
|
|||
case "freetubePwa": {
|
||||
return 'freetube://' + url.href
|
||||
}
|
||||
|
||||
case "poketube": {
|
||||
if (url.pathname.startsWith('/channel')) {
|
||||
const reg = /\/channel\/(.*)\/?$/.exec(url.pathname)
|
||||
|
@ -526,18 +526,17 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
|
|||
|
||||
frontend = options[service].frontend
|
||||
|
||||
|
||||
if (config.services[service].frontends[frontend].desktopApp && type != "main_frame" && options[service].redirectType != "main_frame")
|
||||
frontend = options[service].embedFrontend
|
||||
|
||||
|
||||
if (!regexArray(service, url, config, frontend)) {
|
||||
frontend = null
|
||||
continue
|
||||
}
|
||||
|
||||
if (
|
||||
config.services[service].embeddable &&
|
||||
config.services[service].embeddable
|
||||
&&
|
||||
type != options[service].redirectType && options[service].redirectType != "both"
|
||||
) {
|
||||
if (options[service].unsupportedUrls == 'block') return 'CANCEL'
|
||||
|
@ -548,11 +547,7 @@ function redirect(url, type, initiator, forceRedirection, incognito) {
|
|||
if (instanceList === undefined) break
|
||||
if (instanceList.length === 0) return null
|
||||
|
||||
if (
|
||||
initiator
|
||||
&&
|
||||
instanceList.includes(initiator.origin)
|
||||
) {
|
||||
if (initiator && instanceList.includes(initiator.origin)) {
|
||||
if (type != "main_frame") return null
|
||||
else return "BYPASSTAB"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue