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.

move bots list to middleware

Steven Teyf192af5b4c29
diff --git a/packages/utils/src/constants/bots.ts b/apps/web/lib/middleware/utils/bots-list.ts
similarity index 62%
rename from packages/utils/src/constants/bots.ts
rename to apps/web/lib/middleware/utils/bots-list.ts
index 793cdbd460..cbe2123c75 100644
--- a/packages/utils/src/constants/bots.ts
+++ b/apps/web/lib/middleware/utils/bots-list.ts
@@ -1,21 +1,21 @@
export const UA_BOTS = [
- "bot",
+ "bot", // most bots & crawlers
"metatags", // Dub.co Metatags API (https://api.dub.co/metatags)
- "chatgpt",
- "bluesky",
- "facebookexternalhit",
- "WhatsApp",
- "google",
- "baidu",
- "bing",
- "msn",
- "duckduckbot",
- "teoma",
- "slurp",
- "yandex",
- "MetaInspector",
- "Go-http-client",
- "iframely",
+ "chatgpt", // ChatGPT
+ "bluesky", // Bluesky crawler
+ "facebookexternalhit", // Facebook crawler
+ "WhatsApp", // WhatsApp crawler
+ "google", // Google crawler
+ "baidu", // Baidu crawler
+ "bing", // Bing crawler
+ "msn", // MSN crawler
+ "duckduckbot", // DuckDuckGo crawler
+ "teoma", // Teoma crawler
+ "slurp", // Slurp crawler
+ "yandex", // Yandex crawler
+ "MetaInspector", // metatags.io
+ "Go-http-client", // Go-http-client/1.1 is a bot: https://user-agents.net/string/go-http-client-1-1
+ "iframely", // https://iframely.com/docs/about (used by Notion, Linear)
// new
"ia_archiver",
diff --git a/apps/web/lib/middleware/utils/detect-bot.ts b/apps/web/lib/middleware/utils/detect-bot.ts
index 25900f0517..bc096fb224 100644
--- a/apps/web/lib/middleware/utils/detect-bot.ts
+++ b/apps/web/lib/middleware/utils/detect-bot.ts
@@ -1,6 +1,6 @@
-import { IP_BOTS, UA_BOTS } from "@dub/utils/src/constants";
import { ipAddress } from "@vercel/functions";
import { userAgent } from "next/server";
+import { IP_BOTS, UA_BOTS } from "./bots-list";
export const detectBot = (req: Request) => {
const searchParams = new URL(req.url).searchParams;
diff --git a/packages/utils/src/constants/index.ts b/packages/utils/src/constants/index.ts
index 223cda4573..51999a5abe 100644
--- a/packages/utils/src/constants/index.ts
+++ b/packages/utils/src/constants/index.ts
@@ -1,4 +1,3 @@
-export * from "./bots";
export * from "./cctlds";
export * from "./connect-supported-countries";
export * from "./continents";