Fix webfinger validator
This commit is contained in:
parent
225a89c2af
commit
604abfbef5
|
@ -27,7 +27,7 @@ function sanitizeUrl (url: string) {
|
||||||
|
|
||||||
// Don't import remote scheme from constants because we are in core utils
|
// Don't import remote scheme from constants because we are in core utils
|
||||||
function sanitizeHost (host: string, remoteScheme: string) {
|
function sanitizeHost (host: string, remoteScheme: string) {
|
||||||
let toRemove = remoteScheme === 'https' ? 443 : 80
|
const toRemove = remoteScheme === 'https' ? 443 : 80
|
||||||
|
|
||||||
return host.replace(new RegExp(`:${toRemove}$`), '')
|
return host.replace(new RegExp(`:${toRemove}$`), '')
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,8 +11,7 @@ function isWebfingerResourceValid (value: string) {
|
||||||
if (actorParts.length !== 2) return false
|
if (actorParts.length !== 2) return false
|
||||||
|
|
||||||
const host = actorParts[1]
|
const host = actorParts[1]
|
||||||
|
return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOST
|
||||||
return sanitizeHost(host, REMOTE_SCHEME.HTTP) === CONFIG.WEBSERVER.HOSTNAME
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import * as Sequelize from 'sequelize'
|
import * as Sequelize from 'sequelize'
|
||||||
import { DataType } from 'sequelize-typescript'
|
|
||||||
import { createPrivateAndPublicKeys } from '../../helpers'
|
|
||||||
import { CONFIG } from '../constants'
|
import { CONFIG } from '../constants'
|
||||||
|
|
||||||
async function up (utils: {
|
async function up (utils: {
|
||||||
|
|
Loading…
Reference in New Issue