The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Fix og image routes
Steven Teyedcfd11d88a7
diff --git a/apps/web/app/api/og/analytics/route.tsx b/apps/web/app/api/og/analytics/route.tsxindex 0190e44178..992abe0c92 100644--- a/apps/web/app/api/og/analytics/route.tsx+++ b/apps/web/app/api/og/analytics/route.tsx@@ -10,13 +10,11 @@ import {} from "@dub/utils";import { ImageResponse } from "next/og";import { NextRequest } from "next/server";--export const runtime = "edge";+import { loadGoogleFont } from "../load-google-font";export async function GET(req: NextRequest) {- const interMedium = await fetch(- new URL("@/styles/Inter-Medium.ttf", import.meta.url),- ).then((res) => res.arrayBuffer());+ // Load Inter Medium font (weight 500)+ const interMedium = await loadGoogleFont("Inter:wght@500");const linkId = req.nextUrl.searchParams.get("linkId");const folderId = req.nextUrl.searchParams.get("folderId");@@ -201,12 +199,16 @@ export async function GET(req: NextRequest) {{width: 1200,height: 630,- fonts: [- {- name: "Inter Medium",- data: interMedium,- },- ],+ fonts: interMedium+ ? [+ {+ name: "Inter",+ data: interMedium,+ style: "normal",+ weight: 500,+ },+ ]+ : [],},);}diff --git a/apps/web/app/api/og/program/route.tsx b/apps/web/app/api/og/program/route.tsxindex 5192d4c226..0c9915c9e5 100644--- a/apps/web/app/api/og/program/route.tsx+++ b/apps/web/app/api/og/program/route.tsx@@ -6,6 +6,7 @@ import { Reward } from "@dub/prisma/client";import { ImageResponse } from "next/og";import { NextRequest } from "next/server";import { SVGProps } from "react";+import { loadGoogleFont } from "../load-google-font";const DARK_CELLS = [[2, 3],@@ -15,10 +16,8 @@ const DARK_CELLS = [];export async function GET(req: NextRequest) {- // Use only Inter-Semibold to reduce bundle size (~300KB savings)- const interSemibold = await fetch(- new URL("@/styles/Inter-Semibold.ttf", import.meta.url),- ).then((res) => res.arrayBuffer());+ // Load Inter Semibold font (weight 600)+ const interSemibold = await loadGoogleFont("Inter:wght@600");const slug = req.nextUrl.searchParams.get("slug");const groupSlug = req.nextUrl.searchParams.get("groupSlug");@@ -67,7 +66,7 @@ export async function GET(req: NextRequest) {(<divtw="flex flex-col bg-white w-full h-full"- style={{ fontFamily: "Inter Semibold" }}+ style={{ fontFamily: "Inter" }}>{/* @ts-ignore */}<svg tw="absolute inset-0 text-black/10" width="1200" height="630">@@ -134,7 +133,7 @@ export async function GET(req: NextRequest) {display: "block",lineClamp: 2,textOverflow: "ellipsis",- fontFamily: "Inter Semibold",+ fontFamily: "Inter",}}>{`Join the ${program.name} affiliate program`}@@ -161,7 +160,7 @@ export async function GET(req: NextRequest) {<divtw="mt-10 text-white px-4 h-16 flex items-center text-2xl justify-center rounded-lg border-2 border-white/30 shadow-xl"style={{- fontFamily: "Inter Semibold",+ fontFamily: "Inter",backgroundColor: brandColor,}}>@@ -173,12 +172,16 @@ export async function GET(req: NextRequest) {{width: 1200,height: 630,- fonts: [- {- name: "Inter Semibold",- data: interSemibold,- },- ],+ fonts: interSemibold+ ? [+ {+ name: "Inter",+ data: interSemibold,+ style: "normal",+ weight: 600,+ },+ ]+ : [],},);}