diff options
Diffstat (limited to 'src/remote/webfinger.ts')
| -rw-r--r-- | src/remote/webfinger.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/src/remote/webfinger.ts b/src/remote/webfinger.ts deleted file mode 100644 index f63fd03628..0000000000 --- a/src/remote/webfinger.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { URL } from 'url'; -import { getJson } from '@/misc/fetch'; -import { query as urlQuery } from '@/prelude/url'; - -type ILink = { - href: string; - rel?: string; -}; - -type IWebFinger = { - links: ILink[]; - subject: string; -}; - -export default async function(query: string): Promise<IWebFinger> { - const url = genUrl(query); - - return await getJson(url, 'application/jrd+json, application/json'); -} - -function genUrl(query: string) { - if (query.match(/^https?:\/\//)) { - const u = new URL(query); - return `${u.protocol}//${u.hostname}/.well-known/webfinger?` + urlQuery({ resource: query }); - } - - const m = query.match(/^([^@]+)@(.*)/); - if (m) { - const hostname = m[2]; - return `https://${hostname}/.well-known/webfinger?` + urlQuery({ resource: `acct:${query}` }); - } - - throw new Error(`Invalid query (${query})`); -} |