From c2ad3583906bb4376d27d136675cec8d6a4ba3ce Mon Sep 17 00:00:00 2001 From: Nicolas Date: Thu, 6 Jun 2024 12:05:20 -0700 Subject: [PATCH] Nick: --- apps/api/src/controllers/auth.ts | 2 +- apps/api/src/services/rate-limiter.ts | 9 +-------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts index 2fdbf4e..2c4b0c7 100644 --- a/apps/api/src/controllers/auth.ts +++ b/apps/api/src/controllers/auth.ts @@ -130,7 +130,7 @@ export async function supaAuthenticateUser( } } - const team_endpoint_token = team_id; + const team_endpoint_token = token === "this_is_just_a_preview_token" ? iptoken : team_id; try { await rateLimiter.consume(team_endpoint_token); diff --git a/apps/api/src/services/rate-limiter.ts b/apps/api/src/services/rate-limiter.ts index 637ab50..705d1c7 100644 --- a/apps/api/src/services/rate-limiter.ts +++ b/apps/api/src/services/rate-limiter.ts @@ -67,18 +67,11 @@ const createRateLimiter = (keyPrefix, points) => duration: 60, // Duration in seconds }); -export const previewRateLimiter = createRateLimiter( - "preview", - RATE_LIMITS.preview.default -); export const serverRateLimiter = createRateLimiter( "server", RATE_LIMITS.account.default ); -export const crawlStatusRateLimiter = createRateLimiter( - "crawl-status", - RATE_LIMITS.crawlStatus.default -); + export const testSuiteRateLimiter = createRateLimiter( "test-suite", RATE_LIMITS.testSuite.default