This commit is contained in:
ManeraKai 2022-12-10 11:59:28 +03:00
parent ad4c00e663
commit c19491edc0
No known key found for this signature in database
GPG Key ID: 5ABC31FFD562E337
1 changed files with 9 additions and 1 deletions

View File

@ -413,7 +413,7 @@ function redirect(url, type, initiator, forceRedirection) {
if (url.hostname.match(/^[a-zA-Z0-9-]+\.fandom\.com/)) {
wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.fandom\.com)/)
if (wiki == "www" || !wiki) wiki = ""
else wiki = "/" + wiki
else wiki = `/${wiki}`;
urlpath = url.pathname
} else {
wiki = url.pathname.match(/(?<=wiki\/w:c:)[a-zA-Z0-9-]+(?=:)/)
@ -545,6 +545,14 @@ function reverse(url, urlString) {
if (!urlString) resolve(config.services[service].url + url.pathname + url.search)
else resolve(url.replace(/https?:\/{2}(?:[^\s\/]+\.)+[a-zA-Z0-9]+/, config.services[service].url))
return
case "fandom":
let regex = url.pathname.match(/^\/([a-zA-Z0-9-]+)\/wiki\/([a-zA-Z0-9-]+)/)
if (regex) {
resolve(`https://${regex[1]}.fandom.com/wiki/${regex[2]}`)
return
}
resolve()
return
default:
resolve()
return