Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

edits

Steven Tey70e2e28a0d44
diff --git a/apps/web/app/api/edge/stats/[endpoint]/route.ts b/apps/web/app/api/edge/stats/[endpoint]/route.ts
index 0e2b5dba56..a9eb48edf5 100644
--- a/apps/web/app/api/edge/stats/[endpoint]/route.ts
+++ b/apps/web/app/api/edge/stats/[endpoint]/route.ts
@@ -38,9 +38,7 @@ export const GET = async (
} else {
const data = await getLinkViaEdge(domain, key);
// if the link is explicitly private (publicStats === false)
- // or if the link doesn't exist in database (data === undefined) and is not a dub.sh link
- // (we need to exclude dub.sh public demo links here)
- if (data?.publicStats === 0 || (domain !== "dub.sh" && !data)) {
+ if (data?.publicStats === 0) {
return new Response(`Stats for this link are not public`, {
status: 403,
});
diff --git a/apps/web/app/api/links/route.ts b/apps/web/app/api/links/route.ts
index eace01ca44..e5ba02f26b 100644
--- a/apps/web/app/api/links/route.ts
+++ b/apps/web/app/api/links/route.ts
@@ -49,6 +49,16 @@ export const POST = withAuth(
return new Response("Missing or invalid body.", { status: 400, headers });
}
+ const { link, error, status } = await processLink({
+ payload: body,
+ project,
+ session,
+ });
+
+ if (error) {
+ return new Response(error, { status, headers });
+ }
+
if (!session) {
const ip = req.headers.get("x-forwarded-for") || LOCALHOST_IP;
const { success } = await ratelimit(10, "1 d").limit(ip);
@@ -61,16 +71,6 @@ export const POST = withAuth(
}
}
- const { link, error, status } = await processLink({
- payload: body,
- project,
- session,
- });
-
- if (error) {
- return new Response(error, { status, headers });
- }
-
const [response, invalidFavicon] = await Promise.allSettled([
addLink(link),
...(!project