1 import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants'
2 import { sanitizeHost } from '../core-utils'
3 import { exists } from './misc'
5 function isWebfingerLocalResourceValid (value: string) {
6 if (!exists(value)) return false
7 if (value.startsWith('acct:') === false) return false
9 const actorWithHost = value.substr(5)
10 const actorParts = actorWithHost.split('@')
11 if (actorParts.length !== 2) return false
13 const host = actorParts[1]
14 return sanitizeHost(host, REMOTE_SCHEME.HTTP) === WEBSERVER.HOST
17 // ---------------------------------------------------------------------------
20 isWebfingerLocalResourceValid