--- import Base from "../layouts/Base.astro"; import { fetchAllFragments, blobUrl, DID, fetchBskyPosts, fetchBskyFeed, parseBskyUrl, } from "../lib/atproto"; import type { Fragment, BskyPost } from "../lib/types"; // Pinned bsky post URLs const PINNED_BSKY_URLS = [ "https://bsky.app/profile/nate.rip/post/3mcs53dio3c2s", "https://bsky.app/profile/nate.rip/post/3malzuto3x22s", "https://bsky.app/profile/nate.rip/post/3lxqjbta66k2k", "https://bsky.app/profile/nate.rip/post/3ltkowbdsuk2g", "https://bsky.app/profile/nate.rip/post/3ljqadka7qk2r", "https://bsky.app/profile/nate.rip/post/3ljixbqlta22z", "https://bsky.app/profile/nate.rip/post/3li2ujkthr22x", "https://bsky.app/profile/nate.rip/post/3lggjq25c6k2w", "https://bsky.app/profile/nate.rip/post/3lbulbyvexk2v", "https://bsky.app/profile/nate.rip/post/3ju4vkv7esa2p", ]; const pinnedRkeys = PINNED_BSKY_URLS.map((u) => parseBskyUrl(u)!).filter( Boolean, ); // Fetch everything in parallel const [fragments, pinnedPosts, feedPosts] = await Promise.all([ fetchAllFragments(), fetchBskyPosts(pinnedRkeys), fetchBskyFeed(25, new Set(pinnedRkeys)), ]); // Build a unified timeline: fragments + pinned bsky posts, sorted by date desc type GridEntry = | { kind: "fragment"; f: Fragment } | { kind: "bsky"; p: BskyPost }; const allEntries: GridEntry[] = [ ...fragments.map((f) => ({ kind: "fragment" as const, f })), ...pinnedPosts.map((p) => ({ kind: "bsky" as const, p })), ]; allEntries.sort((a, b) => { const da = new Date( a.kind === "fragment" ? a.f.createdAt : a.p.createdAt, ).getTime(); const db = new Date( b.kind === "fragment" ? b.f.createdAt : b.p.createdAt, ).getTime(); return db - da; // newest first }); const hero = allEntries.find( (e) => e.kind === "fragment" && e.f.type === "shot" && e.f.images?.length, ); const grid = allEntries.filter((e) => e !== hero); const totalFragments = fragments.length; const myAvatar = 'https://github.com/iamnbutler.png'; function excerpt(text: string, len: number = 120): string { return text .replace(/[#*_\[\]()>`~\-]/g, "") .replace(/\n+/g, " ") .trim() .slice(0, len); } function extractListItems(content: string, max: number = 5): string[] { const items: string[] = []; for (const line of content.split("\n")) { if (items.length >= max) break; const h = line.match(/^##\s+(.+)/); if (h) { items.push(h[1].replace(/\*\*/g, "")); continue; } const b = line.match(/^[-*]\s+(.+)/); if (b && !line.startsWith(" ")) { items.push( b[1] .replace(/\[([^\]]+)\]\([^)]+\)/g, "$1") .replace(/\*\*/g, "") .trim(), ); } } return items; } function countListItems(content: string): number { return content.split("\n").filter((l) => l.match(/^(##\s|[-*]\s)/)).length; } const SHOT_VARIANTS = ["viewfinder", "evidence", "hud"] as const; type ShotVariant = (typeof SHOT_VARIANTS)[number]; function shotMeta( i: number, imgCount: number, ): { cls: string; isHero: boolean; variant: ShotVariant } { const variant = SHOT_VARIANTS[i % 3]; // Shots are visual — never 1x1, always at least 2-wide if (imgCount >= 3 && i % 6 === 0) return { cls: "tile-hero-wide", isHero: true, variant }; // 3x2 hero if (i % 7 === 0) return { cls: "tile-3w", isHero: false, variant }; // 3-wide if (i % 4 === 0) return { cls: "tile-w tile-t", isHero: false, variant }; // 2x2 feature return { cls: "tile-w", isHero: false, variant }; // default 2-wide } const POST_VARIANTS = ["cassette", "circuit", "blast"] as const; type PostVariant = (typeof POST_VARIANTS)[number]; function postMeta( i: number, contentLen: number, ): { cls: string; showExcerpt: boolean; variant: PostVariant } { const variant = POST_VARIANTS[i % 3]; // More variety — roughly half of posts get bigger treatment if (contentLen > 2000 && i % 4 === 0) return { cls: "tile-text-lg", showExcerpt: true, variant }; // 2-wide featured if (i % 7 === 0) return { cls: "tile-text-tall", showExcerpt: true, variant }; // tall with excerpt if (i % 3 === 0) return { cls: "tile-w", showExcerpt: true, variant }; // 2-wide with excerpt return { cls: "", showExcerpt: false, variant }; // 1x1 } // Bsky tiles — visual-first, generous sizing function bskySize(p: BskyPost, i: number): string { if (p.video) return "tile-bsky-hero"; // videos 3x2 if (p.images && p.images.length >= 2) return "tile-bsky-hero"; // multi-image 3x2 if (p.images?.length === 1) return i % 3 === 0 ? "tile-bsky-hero" : "tile-w"; // single image: some hero, rest 2-wide if (p.hasMedia) return "tile-w"; // link thumb 2-wide return ""; // text-only 1x1 } // Build render sequence with log + feed injected type RenderItem = | { kind: "log" } | { kind: "feed" } | { kind: "entry"; e: GridEntry; i: number }; const renderItems: RenderItem[] = []; grid.forEach((e, i) => { if (i === 5) renderItems.push({ kind: "log" }); if (i === 12) renderItems.push({ kind: "feed" }); renderItems.push({ kind: "entry", e, i }); }); if (grid.length <= 5) renderItems.push({ kind: "log" }); if (grid.length <= 12) renderItems.push({ kind: "feed" }); // Format relative time for bsky posts function relTime(iso: string): string { const d = new Date(iso); const now = Date.now(); const diff = now - d.getTime(); const days = Math.floor(diff / 86400000); if (days < 1) return "today"; if (days < 30) return `${days}d ago`; if (days < 365) return `${Math.floor(days / 30)}mo ago`; return d.toISOString().slice(0, 10); } ---

nate.rip

{totalFragments}
{ hero && hero.kind === "fragment" && hero.f.images && ( {hero.f.title}
<> <>
shot #{hero.f.id}

{hero.f.title}

) } { renderItems.map((item) => { // Log tile — tactical data terminal if (item.kind === "log") { return ( ); } // Feed tile — comms terminal with CRT effect if (item.kind === "feed") { return (
@ nate.rip on bsky
<>
); } // Grid entries const { e, i } = item; // Bsky pinned post tile — signal packet style if (e.kind === "bsky") { const p = e.p; const sizeCls = bskySize(p, i); const bskyUrl = `https://bsky.app/profile/${p.author.handle}/post/${p.rkey}`; const hasMedia = !!(p.video || p.images?.length || p.externalEmbed?.thumb); const mediaSrc = p.video ? null : p.images?.[0]?.fullsize ?? p.externalEmbed?.thumb ?? null; const mediaAlt = p.images?.[0]?.alt ?? p.externalEmbed?.title ?? ""; const textLen = p.text.length; // Media packet — header + media + overlay if (hasMedia) { return (
SRC nate.rip TS {relTime(p.createdAt)}
{p.video ? (
); } // Text-only packet — header + body + checksum return (
SRC nate.rip TS {relTime(p.createdAt)} LEN {textLen}

{p.text.length > 180 ? p.text.slice(0, 180) + "..." : p.text}

{p.likeCount > 0 ? `0x${p.likeCount.toString(16).padStart(2, '0')} likes` : ''} {p.likeCount > 0 && p.replyCount > 0 ? ' \u2022 ' : ''} {p.replyCount > 0 ? `0x${p.replyCount.toString(16).padStart(2, '0')} rpl` : ''}
); } // Fragment entries (same as before) const f = e.f; const isShot = f.type === "shot" && f.images?.length; const isList = f.type === "list"; if (isShot) { const { cls, isHero: promoted, variant } = shotMeta( i, f.images!.length, ); if (promoted) { return ( {f.title}
<> <>
shot #{f.id}

{f.title}

); } // Viewfinder variant — crosshairs + ticks + exposure if (variant === "viewfinder") { return ( {f.title} f/{f.id} • {new Date(f.createdAt).toISOString().slice(0, 10)}
); } // Evidence variant — film holder notches + marker badge if (variant === "evidence") { return ( {f.title}
{f.id}
); } // HUD variant — broken corner frame + scan line + data overlay return ( {f.title}
REC
{String(f.id).padStart(3, "0")}
); } if (isList) { const items = extractListItems(f.content ?? ""); const total = countListItems(f.content ?? ""); return (
list

{f.title}