···66import Post from "./Post.astro";
77import type { Author } from "./post-types";
88import { client } from "./atproto";
99+import type { XRPCErrorPayload } from "@atcute/client";
9101011const { ok, data } = await client.get("app.bsky.feed.getAuthorFeed", {
1112 params: {
1213 actor: socials.atproto.did,
1314 limit: 100,
1414- filter: "posts_no_replies"
1515+ filter: "posts_no_replies",
1516 },
1617});
17181818-if (!ok) {
1919- // error occoured
2020- console.error(data.error, data.message);
2121-2222- return "Error 500: Internal server error fetching this feed. Try refreshing the page";
2323-}
2424-2525-let posts: {
2626- record: AppBskyFeedPost.Main;
2727- author: Author;
2828- uri: ResourceUri;
2929-}[] = data.feed
3030- // make sure it was by me (exclude reposts)
3131- .filter((x) => x.post.author.did === socials.atproto.did)
3232- // makes sure its not a reply
3333- .filter((x) => !x.reply)
3434- // this list now includes original posts & quote skeets
3535- .map((x) => {
3636- return {
3737- record: is(AppBskyFeedPost.mainSchema, x.post.record)
3838- ? x.post.record
3939- : // never type bc it gets filtered out
4040- (undefined as never),
4141- author: {
4242- did: x.post.author.did,
4343- displayName: x.post.author.displayName,
4444- handle: x.post.author.handle,
4545- avatar: x.post.author.avatar,
4646- },
4747- uri: x.post.uri,
4848- };
4949- })
5050- .filter((x) => x.record);
1919+const posts:
2020+ | {
2121+ record: AppBskyFeedPost.Main;
2222+ author: Author;
2323+ uri: ResourceUri;
2424+ }[]
2525+ | undefined = ok
2626+ ? data.feed
2727+ // make sure it was by me (exclude reposts)
2828+ .filter((x) => x.post.author.did === socials.atproto.did)
2929+ // makes sure its not a reply
3030+ .filter((x) => !x.reply)
3131+ // this list now includes original posts & quote skeets
3232+ .map((x) => {
3333+ return {
3434+ record: is(AppBskyFeedPost.mainSchema, x.post.record)
3535+ ? x.post.record
3636+ : // never type bc it gets filtered out
3737+ (undefined as never),
3838+ author: {
3939+ did: x.post.author.did,
4040+ displayName: x.post.author.displayName,
4141+ handle: x.post.author.handle,
4242+ avatar: x.post.author.avatar,
4343+ },
4444+ uri: x.post.uri,
4545+ };
4646+ })
4747+ .filter((x) => x.record)
4848+ : undefined;
5149---
52505351<section class="feed" style={`--box-lr-png: url("${boxLR.src}");`}>
···5553 <h2>Bluesky 🦋</h2>
5654 <ul>
5755 {
5858- posts.map((x) => {
5959- const uriFragments = x.uri.match(
6060- new RegExp(
6161- "at:\/\/(?<did>did:(?:plc|web):[^\/]*)\/(?<nsid>[^\/]*)\/(?<rkey>.*)",
6262- ),
6363- );
6464- let rkey: string = uriFragments?.groups?.rkey ?? "";
6565- return (
6666- <li>
6767- <Post post={x.record} author={x.author} {rkey} />
6868- </li>
6969- );
7070- })
5656+ posts
5757+ ? posts.map((x) => {
5858+ const uriFragments = x.uri.match(
5959+ new RegExp(
6060+ "at:\/\/(?<did>did:(?:plc|web):[^\/]*)\/(?<nsid>[^\/]*)\/(?<rkey>.*)",
6161+ ),
6262+ );
6363+ let rkey: string = uriFragments?.groups?.rkey ?? "";
6464+ return (
6565+ <li>
6666+ <Post post={x.record} author={x.author} {rkey} />
6767+ </li>
6868+ );
6969+ })
7070+ : (() => {
7171+ console.error(
7272+ (data as XRPCErrorPayload).error,
7373+ (data as XRPCErrorPayload).message,
7474+ );
7575+ return (
7676+ <p>
7777+ Internal server error while loading feed:
7878+ <br />
7979+ Erorr: <code>{(data as XRPCErrorPayload).error}</code>
8080+ <br />
8181+ Message: <code>{(data as XRPCErrorPayload).message}</code>
8282+ </p>
8383+ );
8484+ })()
7185 }
7286 </ul>
7387 </div>
+2-1
src/components/home/playing/TopSongs.astro
···2626 .then((tracks) => (!tracks ? throws("Top tracks failed") : tracks))
2727 .catch((err) => console.error(err));
28282929-if (!topSongs) return "Error 500 failed to get top songs!!";
2929+if (!topSongs)
3030+ return "Error: Failed to load top songs. Spotify refresh token may have expired or spotify may be down.";
3031---
31323233<ul class="top-songs">