diff options
Diffstat (limited to 'server/helpers/custom-validators/webfinger.ts')
-rw-r--r-- | server/helpers/custom-validators/webfinger.ts | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/server/helpers/custom-validators/webfinger.ts b/server/helpers/custom-validators/webfinger.ts deleted file mode 100644 index dd914341e..000000000 --- a/server/helpers/custom-validators/webfinger.ts +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | import { REMOTE_SCHEME, WEBSERVER } from '../../initializers/constants' | ||
2 | import { sanitizeHost } from '../core-utils' | ||
3 | import { exists } from './misc' | ||
4 | |||
5 | function isWebfingerLocalResourceValid (value: string) { | ||
6 | if (!exists(value)) return false | ||
7 | if (value.startsWith('acct:') === false) return false | ||
8 | |||
9 | const actorWithHost = value.substr(5) | ||
10 | const actorParts = actorWithHost.split('@') | ||
11 | if (actorParts.length !== 2) return false | ||
12 | |||
13 | const host = actorParts[1] | ||
14 | return sanitizeHost(host, REMOTE_SCHEME.HTTP) === WEBSERVER.HOST | ||
15 | } | ||
16 | |||
17 | // --------------------------------------------------------------------------- | ||
18 | |||
19 | export { | ||
20 | isWebfingerLocalResourceValid | ||
21 | } | ||