1 import 'express-validator'
3 import { CONFIG } from '../../initializers/constants'
4 import { exists } from './misc'
6 function isWebfingerResourceValid (value: string) {
7 if (!exists(value)) return false
8 if (value.startsWith('acct:') === false) return false
10 const accountWithHost = value.substr(5)
11 const accountParts = accountWithHost.split('@')
12 if (accountParts.length !== 2) return false
14 const host = accountParts[1]
16 if (host !== CONFIG.WEBSERVER.HOST) return false
21 // ---------------------------------------------------------------------------
24 isWebfingerResourceValid