fix: correctly parse hostname for instance block (#1328)
This commit is contained in:
parent
6b40b2efbf
commit
0e2479559b
|
@ -23,7 +23,8 @@ async function redirectToOauth () {
|
||||||
if (Object.keys(loggedInInstances).includes(instanceNameInSearch)) {
|
if (Object.keys(loggedInInstances).includes(instanceNameInSearch)) {
|
||||||
throw createKnownError(`You've already logged in to ${instanceNameInSearch}`)
|
throw createKnownError(`You've already logged in to ${instanceNameInSearch}`)
|
||||||
}
|
}
|
||||||
if (DOMAIN_BLOCKS.some(domain => new RegExp(`(?:\\.|^)${domain}$`, 'i').test(instanceNameInSearch))) {
|
let instanceHostname = new URL(`http://${instanceNameInSearch}`).hostname
|
||||||
|
if (DOMAIN_BLOCKS.some(domain => new RegExp(`(?:\\.|^)${domain}$`, 'i').test(instanceHostname))) {
|
||||||
throw createKnownError('This service is blocked')
|
throw createKnownError('This service is blocked')
|
||||||
}
|
}
|
||||||
let registrationPromise = registerApplication(instanceNameInSearch, REDIRECT_URI)
|
let registrationPromise = registerApplication(instanceNameInSearch, REDIRECT_URI)
|
||||||
|
|
Loading…
Reference in a new issue