Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Nick:

Nicolasd8d159b26839
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index d71480121..07519bbbd 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -206,7 +206,7 @@ export async function supaAuthenticateUser(
} else {
rateLimiter = getRateLimiter(RateLimiterMode.Preview, token);
}
- teamId = "preview";
+ teamId = `preview_${iptoken}`;
plan = "free";
} else {
normalizedApi = parseApi(token);
@@ -332,7 +332,7 @@ export async function supaAuthenticateUser(
mode === RateLimiterMode.Extract ||
mode === RateLimiterMode.Search)
) {
- return { success: true, team_id: "preview", chunk: null, plan: "free" };
+ return { success: true, team_id: `preview_${iptoken}`, chunk: null, plan: "free" };
// check the origin of the request and make sure its from firecrawl.dev
// const origin = req.headers.origin;
// if (origin && origin.includes("firecrawl.dev")){
diff --git a/apps/api/src/controllers/v0/crawlPreview.ts b/apps/api/src/controllers/v0/crawlPreview.ts
index 37c84cdc4..00776e53e 100644
--- a/apps/api/src/controllers/v0/crawlPreview.ts
+++ b/apps/api/src/controllers/v0/crawlPreview.ts
@@ -22,7 +22,10 @@ export async function crawlPreviewController(req: Request, res: Response) {
try {
const auth = await authenticateUser(req, res, RateLimiterMode.Preview);
- const team_id = "preview";
+ const incomingIP = (req.headers["x-forwarded-for"] ||
+ req.socket.remoteAddress) as string;
+ const iptoken = incomingIP + "this_is_just_a_preview_token";
+ const team_id = `preview_${iptoken}`;
if (!auth.success) {
return res.status(auth.status).json({ error: auth.error });