The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
simplify metatags
Steven Teyaf444cedd2ca
diff --git a/apps/web/app/api/links/metatags/route.ts b/apps/web/app/api/links/metatags/route.tsindex 82dac1016e..056632c611 100644--- a/apps/web/app/api/links/metatags/route.ts+++ b/apps/web/app/api/links/metatags/route.ts@@ -11,7 +11,7 @@ export async function GET(req: NextRequest) {const origin = req.headers.get("origin");// Validate the origin header and set CORS headers accordinglyconst corsHeaders = {- "Access-Control-Allow-Methods": "GET, OPTIONS",+ "Access-Control-Allow-Methods": "GET","Access-Control-Allow-Headers": "Content-Type",};diff --git a/apps/web/app/api/links/metatags/utils.ts b/apps/web/app/api/links/metatags/utils.tsindex 32d12057d4..04d1d17342 100644--- a/apps/web/app/api/links/metatags/utils.ts+++ b/apps/web/app/api/links/metatags/utils.ts@@ -5,26 +5,8 @@ import he from "he";import { parse } from "node-html-parser";export const getHtml = async (url: string) => {- const parsedUrl = new URL(url);try {- const response = await fetchWithTimeout(url, {- headers: {- "User-Agent":- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Version H1cbA69",- Accept:- "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",- "Accept-Language": "en-US,en;q=0.5",- "Accept-Encoding": "gzip, deflate, br",- Connection: "keep-alive",- "Upgrade-Insecure-Requests": "1",- "Sec-Fetch-Dest": "document",- "Sec-Fetch-Mode": "navigate",- "Sec-Fetch-Site": "none",- "Sec-Fetch-User": "?1",- "Cache-Control": "max-age=0",- Referer: `${parsedUrl.protocol}//${parsedUrl.hostname}`,- },- });+ const response = await fetchWithTimeout(url);if (!response.ok) {// If we get a 406 or other error, check if it's a Cloudflare-protected sitediff --git a/apps/web/app/api/track/lead/route.ts b/apps/web/app/api/track/lead/route.tsindex 4215b9f176..b64c057da0 100644--- a/apps/web/app/api/track/lead/route.ts+++ b/apps/web/app/api/track/lead/route.ts@@ -44,8 +44,8 @@ export const POST = withWorkspace(} = trackLeadRequestSchema.extend({// add backwards compatibility- externalId: z.string().optional(),- customerId: z.string().optional(),+ externalId: z.string().nullish(),+ customerId: z.string().nullish(),}).parse(body);diff --git a/apps/web/app/api/track/sale/route.ts b/apps/web/app/api/track/sale/route.tsindex 0adb04f4e5..e96e7ccff6 100644--- a/apps/web/app/api/track/sale/route.ts+++ b/apps/web/app/api/track/sale/route.ts@@ -42,8 +42,8 @@ export const POST = withWorkspace(} = trackSaleRequestSchema.extend({// add backwards compatibility- externalId: z.string().optional(),- customerId: z.string().optional(),+ externalId: z.string().nullish(),+ customerId: z.string().nullish(),}).parse(body);