The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
/og/avatar?seed= → /og/avatar/:seed
Steven Tey42de7024ced6
diff --git a/apps/web/app/api/og/avatar/route.tsx b/apps/web/app/api/og/avatar/[[...seed]]/route.tsxsimilarity index 92%rename from apps/web/app/api/og/avatar/route.tsxrename to apps/web/app/api/og/avatar/[[...seed]]/route.tsxindex 4f4f3f9ccc..5f3d37566b 100644--- a/apps/web/app/api/og/avatar/route.tsx+++ b/apps/web/app/api/og/avatar/[[...seed]]/route.tsx@@ -4,7 +4,10 @@ import { getTheme } from "./utils";export const runtime = "edge";-export async function GET(req: NextRequest) {+export async function GET(+ req: NextRequest,+ { params }: { params: { seed?: string[] } },+) {const origin = req.headers.get("origin");// Validate the origin header and set CORS headers accordinglyconst corsHeaders = {@@ -17,7 +20,7 @@ export async function GET(req: NextRequest) {}const { searchParams } = new URL(req.url);- const seed = searchParams.get("seed");+ const seed = params.seed?.[0] ?? searchParams.get("seed");const theme = getTheme(seed);return new ImageResponse(diff --git a/apps/web/app/api/og/avatar/themes.tsx b/apps/web/app/api/og/avatar/[[...seed]]/themes.tsxsimilarity index 100%rename from apps/web/app/api/og/avatar/themes.tsxrename to apps/web/app/api/og/avatar/[[...seed]]/themes.tsxdiff --git a/apps/web/app/api/og/avatar/utils.ts b/apps/web/app/api/og/avatar/[[...seed]]/utils.tssimilarity index 100%rename from apps/web/app/api/og/avatar/utils.tsrename to apps/web/app/api/og/avatar/[[...seed]]/utils.tsdiff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsxindex fd75fbc3e3..db1bb091f3 100644--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsx+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/tokens/page-client.tsx@@ -103,7 +103,7 @@ export default function TokensPageClient() {<imgsrc={row.original.user.isMachine- ? "https://api.dicebear.com/7.x/bottts/svg?seed=Sara"+ ? `https://api.dicebear.com/7.x/bottts/svg?seed=${row.original.user.id}`: row.original.user.image ||`${OG_AVATAR_URL}${row.original.user.id}`}diff --git a/apps/web/lib/upstash/format-redis-link.ts b/apps/web/lib/upstash/format-redis-link.tsindex 20f652d56e..62f4a8a702 100644--- a/apps/web/lib/upstash/format-redis-link.ts+++ b/apps/web/lib/upstash/format-redis-link.ts@@ -53,8 +53,7 @@ export function formatRedisLink(link: ExpandedLink): RedisLinkProps {partner: {id: partner.id,name: partner.name,- image:- partner.image || `https://api.dub.co/og/avatar?seed=${partner.id}`,+ image: partner.image || `https://api.dub.co/og/avatar/${partner.id}`,},}),...(discount && {diff --git a/apps/web/lib/webhook/sample-events/lead-created.json b/apps/web/lib/webhook/sample-events/lead-created.jsonindex 743917dad3..a3b65be200 100644--- a/apps/web/lib/webhook/sample-events/lead-created.json+++ b/apps/web/lib/webhook/sample-events/lead-created.json@@ -5,7 +5,7 @@"externalId": "cus_BH6tDUWc9n0Y2pf55tVbk1hc","name": "Tiny Beige Badger","email": "[email protected]",- "avatar": "https://api.dub.co/og/avatar?seed=cus_BH6tDUWc9n0Y2pf55tVbk1hc",+ "avatar": "https://api.dub.co/og/avatar/cus_BH6tDUWc9n0Y2pf55tVbk1hc","createdAt": "2025-01-14T04:49:23.385Z"},"click": {diff --git a/apps/web/lib/webhook/sample-events/sale-created.json b/apps/web/lib/webhook/sample-events/sale-created.jsonindex ec5bcd4ac2..e0f2f3c2de 100644--- a/apps/web/lib/webhook/sample-events/sale-created.json+++ b/apps/web/lib/webhook/sample-events/sale-created.json@@ -5,7 +5,7 @@"externalId": "cus_jTrfVKYN3Buc3F80JoqBiY0g","name": "Rural Red Goldfish","email": "[email protected]",- "avatar": "https://api.dub.co/og/avatar?seed=cus_jTrfVKYN3Buc3F80JoqBiY0g",+ "avatar": "https://api.dub.co/og/avatar/cus_jTrfVKYN3Buc3F80JoqBiY0g","createdAt": "2024-10-12T04:55:36.007Z"},"click": {diff --git a/apps/web/tests/customers/index.test.ts b/apps/web/tests/customers/index.test.tsindex 585e775f32..7b04411e2b 100644--- a/apps/web/tests/customers/index.test.ts+++ b/apps/web/tests/customers/index.test.ts@@ -43,7 +43,7 @@ describe.sequential("/customers/**", async () => {test("PATCH /customers/{id}", async () => {const toUpdate = {name: "Updated",- avatar: "https://api.dub.co/og/avatar?seed=1234567890",+ avatar: "https://api.dub.co/og/avatar/1234567890",};const { status, data: customer } = await http.patch<Customer>({diff --git a/apps/web/ui/customers/customer-table/example-data.ts b/apps/web/ui/customers/customer-table/example-data.tsindex b282205e29..30d104e70f 100644--- a/apps/web/ui/customers/customer-table/example-data.ts+++ b/apps/web/ui/customers/customer-table/example-data.ts@@ -6,7 +6,7 @@ export const EXAMPLE_CUSTOMER_DATA = [externalId: "djk29fjj3I1",name: "Liam White",email: "[email protected]",- avatar: "https://api.dub.co/og/avatar?seed=l",+ avatar: "https://api.dub.co/og/avatar/l",country: "US",sales: 1,saleAmount: 20_00,@@ -19,7 +19,7 @@ export const EXAMPLE_CUSTOMER_DATA = [externalId: "c34kd94jcz2",name: "Emma Green",email: "[email protected]",- avatar: "https://api.dub.co/og/avatar?seed=e",+ avatar: "https://api.dub.co/og/avatar/e",country: "CA",sales: 30,saleAmount: 1200_00,@@ -32,7 +32,7 @@ export const EXAMPLE_CUSTOMER_DATA = [externalId: "nm58fnz9071",name: "Daniel Brown",email: "[email protected]",- avatar: "https://api.dub.co/og/avatar?seed=d",+ avatar: "https://api.dub.co/og/avatar/d",country: "US",sales: 3,saleAmount: 90_00,diff --git a/apps/web/ui/modals/delete-token-modal.tsx b/apps/web/ui/modals/delete-token-modal.tsxindex 04f1c2d001..a5c8894414 100644--- a/apps/web/ui/modals/delete-token-modal.tsx+++ b/apps/web/ui/modals/delete-token-modal.tsx@@ -78,7 +78,7 @@ function DeleteTokenModal({<imgsrc={token.user.isMachine- ? "https://api.dicebear.com/7.x/bottts/svg?seed=Sara"+ ? `https://api.dicebear.com/7.x/bottts/svg?seed=${token.user.id}`: token.user.image || `${OG_AVATAR_URL}${token.user.id}`}alt={token.user.name!}diff --git a/apps/web/ui/partners/merge-accounts/merge-account-form.tsx b/apps/web/ui/partners/merge-accounts/merge-account-form.tsxindex 138021006c..3a9425dfc6 100644--- a/apps/web/ui/partners/merge-accounts/merge-account-form.tsx+++ b/apps/web/ui/partners/merge-accounts/merge-account-form.tsx@@ -58,7 +58,7 @@ export function MergeAccountForm({<imgsrc={sourceAccount.avatarUrl ||- `https://api.dub.co/og/avatar?seed=${sourceAccount.email}`+ `https://api.dub.co/og/avatar/${sourceAccount.email}`}alt={sourceAccount.name}className="size-12 rounded-full object-cover"@@ -83,7 +83,7 @@ export function MergeAccountForm({<imgsrc={targetAccount.avatarUrl ||- `https://api.dub.co/og/avatar?seed=${targetAccount.email}`+ `https://api.dub.co/og/avatar/${targetAccount.email}`}alt={targetAccount.name}className="size-12 rounded-full object-cover"diff --git a/packages/ui/src/avatar.tsx b/packages/ui/src/avatar.tsxindex 5b89fadfcc..795a572efd 100644--- a/packages/ui/src/avatar.tsx+++ b/packages/ui/src/avatar.tsx@@ -14,7 +14,7 @@ export function getUserAvatarUrl(user?: User | null) {if (!user?.id) return "https://api.dub.co/og/avatar";- const ogAvatar = `https://api.dub.co/og/avatar?seed=${encodeURIComponent(user.id)}`;+ const ogAvatar = `https://api.dub.co/og/avatar/${user.id}`;return user.email? `https://0.gravatar.com/avatar/${sha256(user.email)}?d=${ogAvatar}`@@ -52,7 +52,7 @@ export function Avatar({)}draggable={false}onError={() => {- setUrl(`https://api.dub.co/og/avatar?seed=${user.id}`);+ setUrl(`https://api.dub.co/og/avatar/${user.id}`);}}/>);diff --git a/packages/utils/src/constants/misc.ts b/packages/utils/src/constants/misc.tsindex 82d63b5104..0945464e17 100644--- a/packages/utils/src/constants/misc.ts+++ b/packages/utils/src/constants/misc.ts@@ -26,7 +26,7 @@ export const DEFAULT_LINK_PROPS: any = {export const GOOGLE_FAVICON_URL ="https://www.google.com/s2/favicons?sz=64&domain_url=";-export const OG_AVATAR_URL = "https://api.dub.co/og/avatar?seed=";+export const OG_AVATAR_URL = "https://api.dub.co/og/avatar/";export const PAGINATION_LIMIT = 100;