preview-token

This commit is contained in:
rafaelmmiller 2025-03-06 18:16:07 -03:00
parent e1cfe1da48
commit 55a4a3d768
2 changed files with 4 additions and 4 deletions

View File

@ -200,7 +200,7 @@ export async function supaAuthenticateUser(
let priceId: string | null = null;
let chunk: AuthCreditUsageChunk | null = null;
let plan: PlanType = "free";
if (token == "this_is_just_a_preview_token") {
if (token == process.env.PREVIEW_TOKEN) {
if (mode == RateLimiterMode.CrawlStatus) {
rateLimiter = getRateLimiter(RateLimiterMode.CrawlStatus, token);
} else if (mode == RateLimiterMode.ExtractStatus) {
@ -295,7 +295,7 @@ export async function supaAuthenticateUser(
}
const team_endpoint_token =
token === "this_is_just_a_preview_token" ? iptoken : teamId;
token === process.env.PREVIEW_TOKEN ? iptoken : teamId;
try {
await rateLimiter.consume(team_endpoint_token);
@ -325,7 +325,7 @@ export async function supaAuthenticateUser(
}
if (
token === "this_is_just_a_preview_token" &&
token === process.env.PREVIEW_TOKEN &&
(mode === RateLimiterMode.Scrape ||
mode === RateLimiterMode.Preview ||
mode === RateLimiterMode.Map ||

View File

@ -24,7 +24,7 @@ export async function crawlPreviewController(req: Request, res: Response) {
const incomingIP = (req.headers["x-forwarded-for"] ||
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}`;
if (!auth.success) {