atproto explorer pdsls.dev
atproto tool

add getBlob link

Changed files
+31 -21
src
components
+31 -21
src/components/json.tsx
···
import VideoPlayer from "./video-player";
-
import { createSignal, For } from "solid-js";
+
import { createSignal, For, Show } from "solid-js";
import { A } from "@solidjs/router";
+
import { pds } from "./navbar";
+
import Tooltip from "./tooltip";
interface AtBlob {
$type: string;
···
const blob: AtBlob = data as any;
-
if (blob.$type === "blob" && blob.mimeType.startsWith("image/")) {
-
return (
-
<>
-
<a
-
href={`https://cdn.bsky.app/img/feed_thumbnail/plain/${repo}/${blob.ref.$link}@jpeg`}
-
target="_blank"
-
class="contents"
-
>
-
<img
-
class="max-h-[16rem] max-w-[16rem]"
-
src={`https://cdn.bsky.app/img/feed_thumbnail/plain/${repo}/${blob.ref.$link}@jpeg`}
-
/>
-
</a>
-
{rawObj}
-
</>
-
);
-
}
-
-
if (blob.$type === "blob" && blob.mimeType === "video/mp4") {
+
if (blob.$type === "blob") {
return (
<>
-
<VideoPlayer did={repo} cid={blob.ref.$link} />
+
<span class="flex gap-x-1">
+
<Show when={blob.mimeType.startsWith("image/")}>
+
<a
+
href={`https://cdn.bsky.app/img/feed_thumbnail/plain/${repo}/${blob.ref.$link}@jpeg`}
+
target="_blank"
+
class="contents"
+
>
+
<img
+
class="max-h-[16rem] max-w-[16rem]"
+
src={`https://cdn.bsky.app/img/feed_thumbnail/plain/${repo}/${blob.ref.$link}@jpeg`}
+
/>
+
</a>
+
</Show>
+
<Show when={blob.mimeType === "video/mp4"}>
+
<VideoPlayer did={repo} cid={blob.ref.$link} />
+
</Show>
+
<Show when={pds()}>
+
<a
+
href={`https://${pds()}/xrpc/com.atproto.sync.getBlob?did=${repo}&cid=${blob.ref.$link}`}
+
target="_blank"
+
>
+
<Tooltip text="Blob link">
+
<div class="i-tabler-external-link" />
+
</Tooltip>
+
</a>
+
</Show>
+
</span>
{rawObj}
</>
);