Added reverse for wikiless
This commit is contained in:
parent
ecdb4466ef
commit
57a664afe1
@ -461,13 +461,13 @@ function redirect(url, type, initiator, forceRedirection) {
|
|||||||
}
|
}
|
||||||
case "wikiless": {
|
case "wikiless": {
|
||||||
let hostSplit = url.host.split(".")
|
let hostSplit = url.host.split(".")
|
||||||
if (hostSplit[0] != "wikipedia" && hostSplit[0] != "www") {
|
|
||||||
// wikiless doesn't have mobile view support yet
|
// wikiless doesn't have mobile view support yet
|
||||||
|
if (hostSplit[0] != "wikipedia" && hostSplit[0] != "www") {
|
||||||
if (hostSplit[0] == "m") url.searchParams.append("mobileaction", "toggle_view_mobile")
|
if (hostSplit[0] == "m") url.searchParams.append("mobileaction", "toggle_view_mobile")
|
||||||
else url.searchParams.append("lang", hostSplit[0])
|
else url.searchParams.append("lang", hostSplit[0])
|
||||||
if (hostSplit[1] == "m") url.searchParams.append("mobileaction", "toggle_view_mobile")
|
if (hostSplit[1] == "m") url.searchParams.append("mobileaction", "toggle_view_mobile")
|
||||||
}
|
}
|
||||||
return `${randomInstance}${url.pathname}${GETArguments.toString()}${url.hash}`
|
return `${randomInstance}${url.pathname}${url.search}${url.hash}`
|
||||||
}
|
}
|
||||||
case "proxiTok": {
|
case "proxiTok": {
|
||||||
if (url.pathname.startsWith('/email')) return randomInstance
|
if (url.pathname.startsWith('/email')) return randomInstance
|
||||||
@ -609,17 +609,14 @@ function switchInstance(url) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function reverse(url) {
|
async function reverse(url) {
|
||||||
return new Promise(async resolve => {
|
|
||||||
let options = await utils.getOptions()
|
let options = await utils.getOptions()
|
||||||
let config = await utils.getConfig()
|
let config = await utils.getConfig()
|
||||||
|
|
||||||
let protocolHost = utils.protocolHost(url)
|
let protocolHost = utils.protocolHost(url)
|
||||||
for (const service in config.services) {
|
for (const service in config.services) {
|
||||||
let frontend = options[service].frontend
|
let frontend = options[service].frontend
|
||||||
if (options[frontend] == undefined) continue
|
if (options[frontend] == undefined) continue
|
||||||
if (!options[frontend].includes(protocolHost)) continue
|
if (!options[frontend].includes(protocolHost)) continue
|
||||||
|
|
||||||
switch (service) {
|
switch (service) {
|
||||||
case "youtube":
|
case "youtube":
|
||||||
case "imdb":
|
case "imdb":
|
||||||
@ -632,24 +629,24 @@ function reverse(url) {
|
|||||||
case "urbanDictionary":
|
case "urbanDictionary":
|
||||||
case "quora":
|
case "quora":
|
||||||
case "medium":
|
case "medium":
|
||||||
resolve(config.services[service].url + url.pathname + url.search)
|
return `${config.services[service].url}${url.pathname}${url.search}`
|
||||||
return
|
|
||||||
case "fandom":
|
case "fandom":
|
||||||
let regex = url.pathname.match(/^\/([a-zA-Z0-9-]+)\/wiki\/(.*)/)
|
let regex = url.pathname.match(/^\/([a-zA-Z0-9-]+)\/wiki\/(.*)/)
|
||||||
if (regex) {
|
if (regex) return `https://${regex[1]}.fandom.com/wiki/${regex[2]}`
|
||||||
resolve(`https://${regex[1]}.fandom.com/wiki/${regex[2]}`)
|
|
||||||
return
|
return
|
||||||
|
case "wikipedia": {
|
||||||
|
const lang = url.searchParams.get("lang")
|
||||||
|
if (lang != null) {
|
||||||
|
url.searchParams.delete("lang")
|
||||||
|
return `https://${lang}.wikipedia.org${url.pathname}${url.search}${url.hash}`
|
||||||
|
}
|
||||||
|
return `https://wikipedia.org${url.pathname}${url.search}${url.hash}`
|
||||||
}
|
}
|
||||||
resolve()
|
|
||||||
return
|
|
||||||
default:
|
default:
|
||||||
resolve()
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve()
|
|
||||||
return
|
return
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultInstances = {
|
const defaultInstances = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user