Something went wrong. Try again.
Mirror of https://github.com/kualta/site — web infrastructure
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950---import ActivityRows from "@/components/activity/ActivityRows.astro";import { decodeActivityCursor, getActivityFeed, getActivityHistory } from "@/lib/activity";import { env } from "cloudflare:workers";
// serves both halves of the feed's paging: the newest rows for the live poll,// and older pages as the reader scrolls past what the page shipped withexport const prerender = false;export const partial = true;
const ROW_LIMIT = 20;const before = Astro.url.searchParams.get("before");const cache = env.ACTIVITY_CACHE;
// paging reads history only; the newest rows go through the feed, so the poll// is also what keeps the stored data warmconst feed = before ? null : await getActivityFeed({ cache, githubToken: env.GITHUB_ACTIVITY_TOKEN, });const page = feed ?? (await getActivityHistory({ cache, before, limit: ROW_LIMIT * 5 }));
const from = decodeActivityCursor(before);const boundarySeen = Boolean( from && page.completeSince && Date.parse(from.occurredAt) < Date.parse(page.completeSince),);
Astro.response.headers.set("cache-control", "no-store");---{ feed && ( <span hidden data-activity-meta data-last-seen={feed.lastSeenAt ?? undefined} data-trusted-until={feed.trustedUntil ?? undefined} data-delayed={feed.delayed ? "true" : "false"} /> )}<ActivityRows events={page.events} completeSince={page.completeSince} limitedBy={page.coverageLimitedBy} boundarySeen={boundarySeen} limit={ROW_LIMIT}/>