Personal Site
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Filter out reposts and replies, and make sure all records are structured properly

+24
+24
src/components/home/feeds/Bluesky.astro
··· 1 1 --- 2 2 import { socials } from "/site-config"; 3 + import { is } from "@atcute/lexicons"; 4 + import { AppBskyFeedPost } from "@atcute/bluesky"; 5 + import BskyPost, { type Author } from "./BskyPost.astro"; 3 6 import { client } from "./atproto"; 4 7 5 8 const { ok, data } = await client.get("app.bsky.feed.getAuthorFeed", { ··· 16 19 return "Error 500: Internal server error fetching this feed. Try refreshing the page"; 17 20 } 18 21 22 + let posts: { record: AppBskyFeedPost.Main; author: Author }[] = data.feed 23 + // make sure it was by me (exclude reposts) 24 + .filter((x) => x.post.author.did === socials.atproto.did) 25 + // makes sure its not a reply 26 + .filter((x) => !x.reply) 27 + // this list now includes original posts & quote skeets 28 + .map((x) => { 29 + return { 30 + record: is(AppBskyFeedPost.mainSchema, x.post.record) 31 + ? x.post.record 32 + // never type bc it gets filtered out 33 + : undefined as never, 34 + author: { 35 + did: x.post.author.did, 36 + displayName: x.post.author.displayName, 37 + handle: x.post.author.handle, 38 + avatar: x.post.author.avatar, 39 + }, 40 + }; 41 + }) 42 + .filter((x) => x.record); 19 43 --- 20 44 21 45 <h1>Bsky</h1>