Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

Add team flag to skip country check (#2300)

devin-ai-integration[bot]d531e7865a27
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 4818966d4..9f474a73f 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -1216,6 +1216,7 @@ export type TeamFlags = {
allowTeammateInvites?: boolean;
crawlTtlHours?: number;
ipWhitelist?: boolean;
+ skipCountryCheck?: boolean;
} | null;
export type AuthCreditUsageChunkFromTeam = Omit<
diff --git a/apps/api/src/routes/shared.ts b/apps/api/src/routes/shared.ts
index 97e80223e..8861c4b3c 100644
--- a/apps/api/src/routes/shared.ts
+++ b/apps/api/src/routes/shared.ts
@@ -193,6 +193,10 @@ export function countryCheck(
res: Response,
next: NextFunction,
) {
+ if (req.acuc?.flags?.skipCountryCheck) {
+ return next();
+ }
+
const couldBeRestricted =
req.body &&
(req.body.actions ||
@@ -246,18 +250,18 @@ export function countryCheck(
export function requestTimingMiddleware(version: string) {
return (req: Request, res: Response, next: NextFunction) => {
const startTime = new Date().getTime();
-
+
// Attach timing data to request
(req as any).requestTiming = {
startTime,
- version
+ version,
};
// Override res.json to log timing when response is sent
const originalJson = res.json.bind(res);
- res.json = function(body: any) {
+ res.json = function (body: any) {
const requestTime = new Date().getTime() - startTime;
-
+
// Only log for successful responses to avoid duplicate error logs
if (body?.success !== false) {
logger.info(`${version} request completed`, {
@@ -269,7 +273,7 @@ export function requestTimingMiddleware(version: string) {
statusCode: res.statusCode,
});
}
-
+
return originalJson(body);
};