/.well-known 周りをいい感じに (#4141)
* Enhance /.well-known and their friends * Fix bug
This commit is contained in:
committed by
GitHub
parent
2f4434b0d8
commit
9dd06a7621
@ -1,4 +1,6 @@
|
||||
export default (acct: string) => {
|
||||
import Acct from './type';
|
||||
|
||||
export default (acct: string): Acct => {
|
||||
if (acct.startsWith('@')) acct = acct.substr(1);
|
||||
const split = acct.split('@', 2);
|
||||
return { username: split[0], host: split[1] || null };
|
||||
|
@ -1,8 +1,5 @@
|
||||
type UserLike = {
|
||||
host: string;
|
||||
username: string;
|
||||
};
|
||||
import Acct from './type';
|
||||
|
||||
export default (user: UserLike) => {
|
||||
export default (user: Acct) => {
|
||||
return user.host === null ? user.username : `${user.username}@${user.host}`;
|
||||
};
|
||||
|
6
src/misc/acct/type.ts
Normal file
6
src/misc/acct/type.ts
Normal file
@ -0,0 +1,6 @@
|
||||
type Acct = {
|
||||
username: string;
|
||||
host: string;
|
||||
};
|
||||
|
||||
export default Acct;
|
Reference in New Issue
Block a user