parent
f5be8fd313
commit
69a0d9034f
4 changed files with 35 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
|||
import config from '../config';
|
||||
import { toUnicode, toASCII } from 'punycode';
|
||||
import { URL } from 'url';
|
||||
|
||||
export function getFullApAccount(username: string, host: string) {
|
||||
return host ? `${username}@${toApHost(host)}` : `${username}@${toApHost(config.host)}`;
|
||||
|
@ -10,6 +11,11 @@ export function isSelfHost(host: string) {
|
|||
return toApHost(config.host) === toApHost(host);
|
||||
}
|
||||
|
||||
export function extractDbHost(uri: string) {
|
||||
const url = new URL(uri);
|
||||
return toDbHost(url.hostname);
|
||||
}
|
||||
|
||||
export function toDbHost(host: string) {
|
||||
if (host == null) return null;
|
||||
return toUnicode(host.toLowerCase());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue