From c894d076fe99d2150d3e9fc62209c6617919ca65 Mon Sep 17 00:00:00 2001 From: Marcel Hellkamp Date: Mon, 31 Jul 2023 14:16:08 +0200 Subject: [PATCH] Show account handle in addition to display name --- src/components/Card.vue | 18 ++++++++++++++++-- src/sources.ts | 9 +++++++++ src/types.ts | 1 + 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/components/Card.vue b/src/components/Card.vue index c67d091..207f6c4 100644 --- a/src/components/Card.vue +++ b/src/components/Card.vue @@ -34,8 +34,10 @@ const playVideo = computed(() => {
- + +
+
+
@@ -73,6 +75,18 @@ const playVideo = computed(() => { border-radius: 50%; } +.wall-item a.avatarlink { + text-overflow: ellipsis; + overflow: hidden; + white-space: nowrap; +} + +.wall-item div.profile { + margin-top: -.3em; + font-size: .85em; + opacity: .5; +} + .wall-item img.emoji { height: 1em; width: 1em; diff --git a/src/sources.ts b/src/sources.ts index ada0ab5..fe65d52 100644 --- a/src/sources.ts +++ b/src/sources.ts @@ -75,6 +75,12 @@ export async function fetchPosts(cfg: Config): Promise { posts.unshift(post) } + const fixLocalAcct = (domain: string, status: MastodonStatus): MastodonStatus => { + if (!status.account.acct.includes('@')) + status.account.acct += "@" + domain + return status + } + // Be nice and not overwhelm servers with parallel requests. // Run tasks for the same domain in sequence instead. const groupedTasks = Object.entries(domainTasks) @@ -84,6 +90,7 @@ export async function fetchPosts(cfg: Config): Promise { try { (await task()) .filter(status => filterStatus(cfg, status)) + .map(status => fixLocalAcct(domain, status)) .map(status => statusToWallPost(cfg, status)) .forEach(addOrRepacePost) } catch (err) { @@ -238,6 +245,7 @@ const statusToWallPost = (cfg: Config, status: MastodonStatus): Post => { const name = status.account.display_name ? replaceEmojis(status.account.display_name, status.account.emojis) : status.account.username + const profile = status.account.acct const content = replaceEmojis(status.content, status.emojis) const media = status.media_attachments?.map((m): PostMedia | undefined => { @@ -258,6 +266,7 @@ const statusToWallPost = (cfg: Config, status: MastodonStatus): Post => { url: status.url || status.uri, author: { name, + profile, url: status.account.url, avatar: status.account.avatar, }, diff --git a/src/types.ts b/src/types.ts index 32dce6a..f2a27f2 100644 --- a/src/types.ts +++ b/src/types.ts @@ -34,6 +34,7 @@ export type Post = { author?: { name: string; + profile: string; avatar?: string; url?: string; };