I guess we displaying posts now

This commit is contained in:
Ariadna 2025-04-20 00:42:56 -04:00
parent 3f03c12152
commit 19eb695b08
Signed by: ari
SSH key fingerprint: SHA256:j4xpQafvRcIH4rwZqM5aREIogWsCjyYohia7vH0+uZY
14 changed files with 387 additions and 171 deletions

View file

@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/witchcraft.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>ATProto PDS</title>
</head>

BIN
web/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

View file

@ -1,21 +1,53 @@
<script lang="ts">
import { Post } from "./pdsfetch";
let { post } : { post : Post } = $props();
let { post }: { post: Post } = $props();
</script>
<div>
<p>{post.displayName} | {post.timenotstamp}</p>
<p>{post.text}</p>
{#if post.replyingDid}
<p>Replying to: {post.replyingDid}</p>
{/if}
{#if post.imagesLinksCid}
{#each post.imagesLinksCid as imageLink}
<img src="https://pds.witchcraft.systems/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={imageLink}" />
{/each}
{/if}
{#if post.videosLinkCid}
<video src="https://pds.witchcraft.systems/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={post.videosLinkCid}" />
{/if}
</div>
<div id="postContainer">
<div id="postHeader">
{#if post.authorAvatarCid}
<img
id="avatar"
src="https://pds.witchcraft.systems/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={post.authorAvatarCid}"
/>
{/if}
<p>{post.displayName} | {post.timenotstamp}</p>
</div>
<div id="postContent">
<p>{post.text}</p>
{#if post.replyingDid}
<p>Replying to: {post.replyingDid}</p>
{/if}
{#if post.imagesLinksCid}
{#each post.imagesLinksCid as imageLink}
<img
id="embedImages"
src="https://pds.witchcraft.systems/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={imageLink}"
/>
{/each}
{/if}
{#if post.videosLinkCid}
<video
id="embedVideo"
src="https://pds.witchcraft.systems/xrpc/com.atproto.sync.getBlob?did={post.authorDid}&cid={post.videosLinkCid}"
/>
{/if}
</div>
</div>
<style>
#postContainer {
display: column;
text-align: start;
border: 2px solid black;
padding: 4%;
}
#postHeader {
text-decoration: underline;
}
#avatar {
width: 50px;
height: 50px;
border-radius: 50%;
}
</style>

View file

@ -1,6 +1,6 @@
import { simpleFetchHandler, XRPC } from "@atcute/client";
import "@atcute/bluesky/lexicons";
// import { ComAtprotoRepoListRecords } from "@atcute/client/lexicons";
// import { ComAtprotoRepoListRecords.Record } from "@atcute/client/lexicons";
// import { AppBskyFeedPost } from "@atcute/client/lexicons";
// import { AppBskyActorDefs } from "@atcute/client/lexicons";
@ -11,6 +11,7 @@ interface AccountMetadata {
}
class Post {
authorDid: string;
authorAvatarCid: string | null;
displayName : string;
text: string;
timestamp: number;
@ -18,12 +19,11 @@ class Post {
quotingDid: string | null;
replyingDid: string | null;
imagesLinksCid: string[] | null;
imagesAltText: string[] | null;
videosLinkCid: string | null;
videosLinksUrls: string[] | null;
constructor(record: ComAtprotoRepoListRecords.Record, account : AccountMetadata) {
this.authorDid = account.did;
this.authorAvatarCid = account.avatarCid;
this.displayName = account.displayName;
const post = record.value as AppBskyFeedPost.Record;
this.timenotstamp = post.createdAt;
@ -42,7 +42,6 @@ class Post {
this.imagesLinksCid = post.embed.images.map((imageRecord) =>
imageRecord.image.ref.$link
);
this.imagesAltText = post.embed.images.map((imageRecord) => imageRecord.alt || "no alt text :(")
break;
case "app.bsky.embed.video":
this.videosLinkCid = post.embed.video.ref.$link;
@ -57,12 +56,11 @@ class Post {
this.imagesLinksCid = post.embed.media.images.map((imageRecord) =>
imageRecord.image.ref.$link
);
this.imagesAltText = post.embed.images.map((imageRecord) => imageRecord.alt || "no alt text :(")
break;
case "app.bsky.embed.video":
this.videosLinkCid = post.embed.media.video.ref.$link;
break;
}
break;