Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/openstatusHQ/openstatus. ๐ซ Status page with uptime monitoring & API monitoring as code ๐ซ openstatus.dev
bun drizzle-orm monitoring monitoring-as-code nextjs observability on-call open-source shadcn-ui status-page statuspage synthetic-monitoring tinybird turso uptime uptime-checker uptime-monitor
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475import { OSTinybird } from "@openstatus/tinybird";import { ImageResponse } from "next/og";
import { env } from "../../../../env";import { DESCRIPTION, TITLE } from "../../../../lib/metadata/shared-metadata";import { BasicLayout } from "../_components/basic-layout";import { Tracker } from "../_components/tracker";import { SIZE, calSemiBold, interLight, interRegular } from "../utils";
const tb = new OSTinybird({ token: env.TINY_BIRD_API_KEY, baseUrl: env.TINYBIRD_URL, noop: env.TINYBIRD_NOOP,});
export const runtime = "edge";
export async function GET(req: Request) { const [interRegularData, interLightData, calSemiBoldData] = await Promise.all( [interRegular, interLight, calSemiBold], );
const { searchParams } = new URL(req.url);
const title = (searchParams.has("title") && searchParams.get("title")) || TITLE;
const description = (searchParams.has("description") && searchParams.get("description")) || DESCRIPTION;
const monitorId = (searchParams.has("id") && searchParams.get("id")) || undefined;
// TODO: we need to pass the monitor type here
const res = (monitorId && (await tb.legacy_httpStatus45d({ monitorId, }))) || { data: [] };
return new ImageResponse( <BasicLayout title={title} description={description} tw={res.data.length === 0 ? "mt-32" : undefined} > {res.data.length ? <Tracker data={res.data} /> : null} </BasicLayout>, { ...SIZE, fonts: [ { name: "Inter", data: interRegularData, style: "normal", weight: 400, }, { name: "Inter", data: interLightData, style: "normal", weight: 300, }, { name: "Cal", data: calSemiBoldData, style: "normal", weight: 600, }, ], }, );}