diff --git a/src/components/posts/PostHeader.svelte b/src/components/posts/PostHeader.svelte index 66849ce..ebba0e9 100644 --- a/src/components/posts/PostHeader.svelte +++ b/src/components/posts/PostHeader.svelte @@ -56,6 +56,9 @@ Mastodon logo {:else} {post.hasValidHandle ? `@${post.author.handle}` : '[invalid handle]'} + {#if post.authorIsBot} + + {/if} {/if} • @@ -123,6 +126,12 @@ margin-left: 3px; } + .is-bot { + color: #888; + vertical-align: 2px; + margin-left: 3px; + } + .time { color: #666; font-weight: normal; diff --git a/src/models/posts.ts b/src/models/posts.ts index e3b7ff2..9f5ec0a 100644 --- a/src/models/posts.ts +++ b/src/models/posts.ts @@ -180,6 +180,7 @@ export class Post extends BasePost { isEmbed: boolean | undefined; record: json; + author: json; embed: Embed | undefined; viewerData: json | undefined; viewerLike: string | undefined; @@ -391,6 +392,14 @@ export class Post extends BasePost { return (this.viewerData !== undefined); } + get authorIsBot(): boolean { + return this.author.labels?.some((x: json) => ( + x.src == this.author.did + && x.uri == `at://${x.src}/app.bsky.actor.profile/self` + && x.val == 'bot' + )); + } + get parentReference(): ATProtoRecord | undefined { return this.record.reply?.parent && new ATProtoRecord(this.record.reply?.parent); } @@ -408,6 +417,8 @@ export class Post extends BasePost { export class BlockedPost extends BasePost { + author: json; + constructor(data: json) { super(data); this.author = data.author;