mirror of
https://github.com/defnull/fediwall.git
synced 2024-12-01 12:03:07 +01:00
Show account handle in addition to display name
This commit is contained in:
parent
c57d9815d3
commit
c894d076fe
@ -34,8 +34,10 @@ const playVideo = computed(() => {
|
|||||||
<div v-if="post.author?.avatar" class="flex-shrink-0">
|
<div v-if="post.author?.avatar" class="flex-shrink-0">
|
||||||
<img :src="post.author.avatar" class="me-2 avatar" />
|
<img :src="post.author.avatar" class="me-2 avatar" />
|
||||||
</div>
|
</div>
|
||||||
<a :href="post.author.url || post.url" target="_blank" v-dompurify-html="post.author.name"
|
<a :href="post.author.url || post.url" target="_blank" class="text-body flex-grow-1 m-0 avatarlink">
|
||||||
class="flex-grow-1 m-0 text-body"></a>
|
<div v-dompurify-html="post.author.name" class="displayname"></div>
|
||||||
|
<div v-dompurify-html="post.author.profile" class="profile"></div>
|
||||||
|
</a>
|
||||||
<slot name="topleft"></slot>
|
<slot name="topleft"></slot>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
@ -73,6 +75,18 @@ const playVideo = computed(() => {
|
|||||||
border-radius: 50%;
|
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 {
|
.wall-item img.emoji {
|
||||||
height: 1em;
|
height: 1em;
|
||||||
width: 1em;
|
width: 1em;
|
||||||
|
@ -75,6 +75,12 @@ export async function fetchPosts(cfg: Config): Promise<Post[]> {
|
|||||||
posts.unshift(post)
|
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.
|
// Be nice and not overwhelm servers with parallel requests.
|
||||||
// Run tasks for the same domain in sequence instead.
|
// Run tasks for the same domain in sequence instead.
|
||||||
const groupedTasks = Object.entries(domainTasks)
|
const groupedTasks = Object.entries(domainTasks)
|
||||||
@ -84,6 +90,7 @@ export async function fetchPosts(cfg: Config): Promise<Post[]> {
|
|||||||
try {
|
try {
|
||||||
(await task())
|
(await task())
|
||||||
.filter(status => filterStatus(cfg, status))
|
.filter(status => filterStatus(cfg, status))
|
||||||
|
.map(status => fixLocalAcct(domain, status))
|
||||||
.map(status => statusToWallPost(cfg, status))
|
.map(status => statusToWallPost(cfg, status))
|
||||||
.forEach(addOrRepacePost)
|
.forEach(addOrRepacePost)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -238,6 +245,7 @@ const statusToWallPost = (cfg: Config, status: MastodonStatus): Post => {
|
|||||||
const name = status.account.display_name
|
const name = status.account.display_name
|
||||||
? replaceEmojis(status.account.display_name, status.account.emojis)
|
? replaceEmojis(status.account.display_name, status.account.emojis)
|
||||||
: status.account.username
|
: status.account.username
|
||||||
|
const profile = status.account.acct
|
||||||
const content = replaceEmojis(status.content, status.emojis)
|
const content = replaceEmojis(status.content, status.emojis)
|
||||||
|
|
||||||
const media = status.media_attachments?.map((m): PostMedia | undefined => {
|
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,
|
url: status.url || status.uri,
|
||||||
author: {
|
author: {
|
||||||
name,
|
name,
|
||||||
|
profile,
|
||||||
url: status.account.url,
|
url: status.account.url,
|
||||||
avatar: status.account.avatar,
|
avatar: status.account.avatar,
|
||||||
},
|
},
|
||||||
|
@ -34,6 +34,7 @@ export type Post = {
|
|||||||
|
|
||||||
author?: {
|
author?: {
|
||||||
name: string;
|
name: string;
|
||||||
|
profile: string;
|
||||||
avatar?: string;
|
avatar?: string;
|
||||||
url?: string;
|
url?: string;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user