mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 18:48:59 +08:00
preview-token
This commit is contained in:
parent
e1cfe1da48
commit
55a4a3d768
@ -200,7 +200,7 @@ export async function supaAuthenticateUser(
|
|||||||
let priceId: string | null = null;
|
let priceId: string | null = null;
|
||||||
let chunk: AuthCreditUsageChunk | null = null;
|
let chunk: AuthCreditUsageChunk | null = null;
|
||||||
let plan: PlanType = "free";
|
let plan: PlanType = "free";
|
||||||
if (token == "this_is_just_a_preview_token") {
|
if (token == process.env.PREVIEW_TOKEN) {
|
||||||
if (mode == RateLimiterMode.CrawlStatus) {
|
if (mode == RateLimiterMode.CrawlStatus) {
|
||||||
rateLimiter = getRateLimiter(RateLimiterMode.CrawlStatus, token);
|
rateLimiter = getRateLimiter(RateLimiterMode.CrawlStatus, token);
|
||||||
} else if (mode == RateLimiterMode.ExtractStatus) {
|
} else if (mode == RateLimiterMode.ExtractStatus) {
|
||||||
@ -295,7 +295,7 @@ export async function supaAuthenticateUser(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const team_endpoint_token =
|
const team_endpoint_token =
|
||||||
token === "this_is_just_a_preview_token" ? iptoken : teamId;
|
token === process.env.PREVIEW_TOKEN ? iptoken : teamId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await rateLimiter.consume(team_endpoint_token);
|
await rateLimiter.consume(team_endpoint_token);
|
||||||
@ -325,7 +325,7 @@ export async function supaAuthenticateUser(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
token === "this_is_just_a_preview_token" &&
|
token === process.env.PREVIEW_TOKEN &&
|
||||||
(mode === RateLimiterMode.Scrape ||
|
(mode === RateLimiterMode.Scrape ||
|
||||||
mode === RateLimiterMode.Preview ||
|
mode === RateLimiterMode.Preview ||
|
||||||
mode === RateLimiterMode.Map ||
|
mode === RateLimiterMode.Map ||
|
||||||
|
@ -24,7 +24,7 @@ export async function crawlPreviewController(req: Request, res: Response) {
|
|||||||
|
|
||||||
const incomingIP = (req.headers["x-forwarded-for"] ||
|
const incomingIP = (req.headers["x-forwarded-for"] ||
|
||||||
req.socket.remoteAddress) as string;
|
req.socket.remoteAddress) as string;
|
||||||
const iptoken = incomingIP + "this_is_just_a_preview_token";
|
const iptoken = incomingIP + process.env.PREVIEW_TOKEN;
|
||||||
const team_id = `preview_${iptoken}`;
|
const team_id = `preview_${iptoken}`;
|
||||||
|
|
||||||
if (!auth.success) {
|
if (!auth.success) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user