services: Fix `anonymousOverflow` redirect
This commit is contained in:
parent
dddc203f4e
commit
617b0da884
|
@ -367,7 +367,7 @@ function redirect(url, type, initiator, forceRedirection) {
|
||||||
if (url.hostname.match(/^[a-zA-Z0-9-]+\.(?:fandom|wikia)\.com/)) {
|
if (url.hostname.match(/^[a-zA-Z0-9-]+\.(?:fandom|wikia)\.com/)) {
|
||||||
wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.(?:fandom|wikia)\.com)/)
|
wiki = url.hostname.match(/^[a-zA-Z0-9-]+(?=\.(?:fandom|wikia)\.com)/)
|
||||||
if (wiki == "www" || !wiki) wiki = ""
|
if (wiki == "www" || !wiki) wiki = ""
|
||||||
else wiki = `/${wiki}`;
|
else wiki = `/${wiki}`
|
||||||
urlpath = url.pathname
|
urlpath = url.pathname
|
||||||
} else {
|
} else {
|
||||||
wiki = url.pathname.match(/(?<=wiki\/w:c:)[a-zA-Z0-9-]+(?=:)/)
|
wiki = url.pathname.match(/(?<=wiki\/w:c:)[a-zA-Z0-9-]+(?=:)/)
|
||||||
|
@ -406,9 +406,9 @@ function redirect(url, type, initiator, forceRedirection) {
|
||||||
case "neuters": {
|
case "neuters": {
|
||||||
const p = url.pathname
|
const p = url.pathname
|
||||||
if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) {
|
if (p.startsWith('/article/') || p.startsWith('/pf/') || p.startsWith('/arc/') || p.startsWith('/resizer/')) {
|
||||||
return null;
|
return null
|
||||||
}
|
}
|
||||||
return `${randomInstance}${p}`;
|
return `${randomInstance}${p}`
|
||||||
}
|
}
|
||||||
case "dumb": {
|
case "dumb": {
|
||||||
if (url.pathname.endsWith('-lyrics')) return `${randomInstance}${url.pathname}`
|
if (url.pathname.endsWith('-lyrics')) return `${randomInstance}${url.pathname}`
|
||||||
|
@ -419,7 +419,8 @@ function redirect(url, type, initiator, forceRedirection) {
|
||||||
}
|
}
|
||||||
case "anonymousOverflow": {
|
case "anonymousOverflow": {
|
||||||
if (!url.pathname.startsWith('/questions') && url.pathname != '/') return
|
if (!url.pathname.startsWith('/questions') && url.pathname != '/') return
|
||||||
return `${randomInstance}${url.pathname}${url.search}`
|
const threadID = /\/\d+(?=[?&#/]|$)/.exec(url.pathname)?.[0]
|
||||||
|
return `${randomInstance}${threadID ? '/questions' + threadID : url.pathname}${url.search}`
|
||||||
}
|
}
|
||||||
case "biblioReads": {
|
case "biblioReads": {
|
||||||
if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return
|
if (!url.pathname.startsWith('/book/show/') && url.pathname != '/') return
|
||||||
|
|
Loading…
Reference in New Issue