video.cerulea.blue/common/video.ts
Charlotte Som 89ec573591 ssr for video viewer
this lets us send opengraph tags in the response :D
might make the player also be server-side rendered as well
2026-03-10 23:39:04 +00:00

18 lines
721 B
TypeScript

import { getPdsUrl } from "./identity.ts";
import type { VideoRecord } from "./lexicons.ts";
export async function getVideoRecord(did: string, rkey: string): Promise<VideoRecord> {
const pdsUrl = await getPdsUrl(did);
if (!pdsUrl) throw new Error("Could not resolve PDS");
const url = new URL("/xrpc/com.atproto.repo.getRecord", pdsUrl);
url.searchParams.set("repo", did);
url.searchParams.set("collection", "blue.cerulea.video.video");
url.searchParams.set("rkey", rkey);
const res = await fetch(url, { headers: { "user-agent": "video.cerulea.app" } });
if (!res.ok) throw new Error(`Failed to fetch record: ${res.status}`);
const record = await res.json();
return record.value as VideoRecord;
}