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.

updates

Steven Teyff99e096ccdb
diff --git a/apps/web/app/api/links/check-conversion-script/route.ts b/apps/web/app/api/links/check-conversion-script/route.ts
deleted file mode 100644
index 4c2e22a394..0000000000
--- a/apps/web/app/api/links/check-conversion-script/route.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import { handleAndReturnErrorResponse } from "@/lib/api/errors";
-import { ratelimitOrThrow } from "@/lib/api/utils";
-import { getUrlQuerySchema } from "@/lib/zod/schemas/links";
-import { fetchWithTimeout } from "@dub/utils";
-import { NextRequest, NextResponse } from "next/server";
-
-export const runtime = "edge";
-
-export async function GET(req: NextRequest) {
- try {
- const { url } = getUrlQuerySchema.parse({
- url: req.nextUrl.searchParams.get("url"),
- });
-
- await ratelimitOrThrow(req, "check-conversion-script");
-
- // ping URL to see if the dubcdn.com/analytics/script.js script is installed
- const res = await fetchWithTimeout(url, {
- headers: {
- "User-Agent": "Dub.co",
- },
- });
-
- if (res.status !== 200) {
- throw new Error(`Failed to fetch ${url}`);
- }
-
- const html = await res.text();
-
- const installed = html.includes("dubcdn.com/analytics/script.js");
-
- return NextResponse.json({ installed });
- } catch (error) {
- return handleAndReturnErrorResponse(error);
- }
-}
diff --git a/apps/web/app/api/metatags/utils.ts b/apps/web/app/api/metatags/utils.ts
index 4d6952b143..522388b437 100644
--- a/apps/web/app/api/metatags/utils.ts
+++ b/apps/web/app/api/metatags/utils.ts
@@ -5,11 +5,7 @@ import he from "he";
import { parse } from "node-html-parser";
export const getHtml = async (url: string) => {
- return await fetchWithTimeout(url, {
- headers: {
- "User-Agent": "Dub.co",
- },
- })
+ return await fetchWithTimeout(url)
.then((r) => r.text())
.catch(() => null);
};
diff --git a/packages/utils/src/functions/is-iframeable.ts b/packages/utils/src/functions/is-iframeable.ts
index 16ac1356a1..4f2e76b0b9 100644
--- a/packages/utils/src/functions/is-iframeable.ts
+++ b/packages/utils/src/functions/is-iframeable.ts
@@ -6,11 +6,7 @@ export const isIframeable = async ({
url: string;
requestDomain: string;
}) => {
- const res = await fetch(url, {
- headers: {
- "User-Agent": "Dub.co",
- },
- });
+ const res = await fetch(url);
const xFrameOptions = res.headers.get("X-Frame-Options");
if (xFrameOptions === "DENY" || xFrameOptions === "SAMEORIGIN") {