From 6f41539587d855de8c50fddb0af6ae6c6762dc43 Mon Sep 17 00:00:00 2001 From: Sha Zhou Date: Fri, 9 May 2025 18:42:35 +0800 Subject: [PATCH] assert uid for each request --- jina-ai/src/patch-express.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jina-ai/src/patch-express.ts b/jina-ai/src/patch-express.ts index f82476c..2a8814c 100644 --- a/jina-ai/src/patch-express.ts +++ b/jina-ai/src/patch-express.ts @@ -86,10 +86,10 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction [RPC_CALL_ENVIRONMENT]: { req, res } }); - const uid = await authDto.solveUID(); - if (!uid && !ctx.ip) { - throw new OperationNotAllowedError(`Missing IP information for anonymous user`); - } + const uid = await authDto.assertUID(); + // if (!uid && !ctx.ip) { + // throw new OperationNotAllowedError(`Missing IP information for anonymous user`); + // } let rateLimitPolicy if (uid) { const user = await authDto.assertUser(); @@ -110,7 +110,7 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction } else { rateLimitPolicy = [ RateLimitDesc.from({ - occurrence: 1, + occurrence: 0, periodSeconds: 120 }) ]