The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
bruh
Steven Teyc9e2893d4459
diff --git a/lib/stats.ts b/lib/stats.tsindex 22c8f9ce75..7435e3c9e7 100644--- a/lib/stats.ts+++ b/lib/stats.ts@@ -132,12 +132,10 @@ export const getStats = async ({// 3. interval is not defined// 4. there's a connection to MySQLif (endpoint === "clicks" && key !== "_root" && !interval && conn) {- console.log("Getting all-time clicks count from MySQL", domain, key);const response = await conn.execute("SELECT clicks FROM Link WHERE domain = ? AND `key` = ?",[domain, key],);- console.log("MySQL response", response);try {const clicks = response.rows[0]["clicks"];return clicks || "0";diff --git a/pages/api/edge/links/[key]/stats/[endpoint].ts b/pages/api/edge/links/[key]/stats/[endpoint].tsindex 49e2d57547..64d58b381f 100644--- a/pages/api/edge/links/[key]/stats/[endpoint].ts+++ b/pages/api/edge/links/[key]/stats/[endpoint].ts@@ -9,10 +9,9 @@ export const config = {export default async function handler(req: NextRequest) {if (req.method === "GET") {- const key = req.nextUrl.searchParams.get("key");+ const key = req.nextUrl.pathname.split("/")[4];const interval = req.nextUrl.searchParams.get("interval");const endpoint = req.nextUrl.searchParams.get("endpoint");- console.log("domain", req.headers.get("host"), req.nextUrl.hostname);let domain = req.nextUrl.hostname;if (isHomeHostname(domain)) domain = "dub.sh";