diff --git a/packages/frontend-embed/src/components/EmAvatar.vue b/packages/frontend-embed/src/components/EmAvatar.vue index 22f3d260a1..d4aeff10ed 100644 --- a/packages/frontend-embed/src/components/EmAvatar.vue +++ b/packages/frontend-embed/src/components/EmAvatar.vue @@ -42,7 +42,7 @@ import { computed } from 'vue'; import * as Misskey from 'misskey-js'; import MkImgWithBlurhash from '../MkImgWithBlurhash.vue'; import EmA from './EmA.vue'; -import { userPage } from '@/filters/user.js'; +import { userPage } from '@/utils.js'; import MkUserOnlineIndicator from '@/components/MkUserOnlineIndicator.vue'; const props = withDefaults(defineProps<{ diff --git a/packages/frontend-embed/src/utils.ts b/packages/frontend-embed/src/utils.ts new file mode 100644 index 0000000000..a87766764d --- /dev/null +++ b/packages/frontend-embed/src/utils.ts @@ -0,0 +1,19 @@ +/* + * 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}` : '')}`; +};