1
0
forked from mirror/misskey
mi.moris.day/packages/frontend-embed/src/utils.ts
2024-08-23 13:30:35 +09:00

24 lines
594 B
TypeScript

/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as Misskey from 'misskey-js';
import { url } from '@/config.js';
export const acct = (user: Misskey.Acct) => {
return Misskey.acct.toString(user);
};
export const userName = (user: Misskey.entities.User) => {
return user.name || user.username;
};
export const userPage = (user: Misskey.Acct, path?: string, absolute = false) => {
return `${absolute ? url : ''}/@${acct(user)}${(path ? `/${path}` : '')}`;
};
export const notePage = note => {
return `/notes/${note.id}`;
};