exempts 'special' role from rate limiting
This commit is contained in:
@@ -7,7 +7,7 @@ export const setApiFormat = (api: {
|
||||
outApi: APIFormat;
|
||||
service: LLMService,
|
||||
}): RequestPreprocessor => {
|
||||
return (req) => {
|
||||
return function configureRequestApiFormat (req) {
|
||||
req.inboundApi = api.inApi;
|
||||
req.outboundApi = api.outApi;
|
||||
req.service = api.service;
|
||||
|
||||
@@ -63,10 +63,8 @@ export const ipLimiter = async (
|
||||
res: Response,
|
||||
next: NextFunction
|
||||
) => {
|
||||
if (!RATE_LIMIT_ENABLED) {
|
||||
next();
|
||||
return;
|
||||
}
|
||||
if (!RATE_LIMIT_ENABLED) return next();
|
||||
if (req.user?.type === "special") return next();
|
||||
|
||||
// Exempt Agnai.chat from rate limiting since it's shared between a lot of
|
||||
// users. Dunno how to prevent this from being abused without some sort of
|
||||
|
||||
Vendored
+1
-1
@@ -1,7 +1,7 @@
|
||||
import type { HttpRequest } from "@smithy/types";
|
||||
import { Express } from "express-serve-static-core";
|
||||
import { APIFormat, Key, LLMService } from "../shared/key-management";
|
||||
import { User } from "../shared/users/user-store";
|
||||
import { User } from "../shared/users/schema";
|
||||
|
||||
declare global {
|
||||
namespace Express {
|
||||
|
||||
Reference in New Issue
Block a user