diff options
Diffstat (limited to 'src/misc/convert-host.ts')
| -rw-r--r-- | src/misc/convert-host.ts | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/misc/convert-host.ts b/src/misc/convert-host.ts deleted file mode 100644 index 6e9f6ed3e9..0000000000 --- a/src/misc/convert-host.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { URL } from 'url'; -import config from '@/config/index'; -import { toASCII } from 'punycode/'; - -export function getFullApAccount(username: string, host: string | null) { - return host ? `${username}@${toPuny(host)}` : `${username}@${toPuny(config.host)}`; -} - -export function isSelfHost(host: string) { - if (host == null) return true; - return toPuny(config.host) === toPuny(host); -} - -export function extractDbHost(uri: string) { - const url = new URL(uri); - return toPuny(url.hostname); -} - -export function toPuny(host: string) { - return toASCII(host.toLowerCase()); -} - -export function toPunyNullable(host: string | null | undefined): string | null { - if (host == null) return null; - return toASCII(host.toLowerCase()); -} |