mirror of
https://github.com/jina-ai/node-DeepResearch.git
synced 2026-03-22 07:29:35 +08:00
assert uid for each request
This commit is contained in:
@@ -86,10 +86,10 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction
|
|||||||
[RPC_CALL_ENVIRONMENT]: { req, res }
|
[RPC_CALL_ENVIRONMENT]: { req, res }
|
||||||
});
|
});
|
||||||
|
|
||||||
const uid = await authDto.solveUID();
|
const uid = await authDto.assertUID();
|
||||||
if (!uid && !ctx.ip) {
|
// if (!uid && !ctx.ip) {
|
||||||
throw new OperationNotAllowedError(`Missing IP information for anonymous user`);
|
// throw new OperationNotAllowedError(`Missing IP information for anonymous user`);
|
||||||
}
|
// }
|
||||||
let rateLimitPolicy
|
let rateLimitPolicy
|
||||||
if (uid) {
|
if (uid) {
|
||||||
const user = await authDto.assertUser();
|
const user = await authDto.assertUser();
|
||||||
@@ -110,7 +110,7 @@ export const jinaAiMiddleware = (req: Request, res: Response, next: NextFunction
|
|||||||
} else {
|
} else {
|
||||||
rateLimitPolicy = [
|
rateLimitPolicy = [
|
||||||
RateLimitDesc.from({
|
RateLimitDesc.from({
|
||||||
occurrence: 1,
|
occurrence: 0,
|
||||||
periodSeconds: 120
|
periodSeconds: 120
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user