INNER CODE UNIT · TypeScript

isArenaBuildAsset

Ammaar-Alam/minebench · middleware.ts:281

  const isArenaBuildAsset = /^\/api\/arena\/builds\/[^/]+(?:\/stream)?$/.test(pathname);
  const isCustomBuildCreate =
    (pathname === "/api/custom-builds" || pathname === "/api/generations") && req.method === "POST";
  const isGalleryReport = pathname === "/api/gallery/reports" && req.method === "POST";
  const maxPerWindow = pathname === "/api/local/voxel-exec" ? MAX_PER_WINDOW_LOCAL_EXEC : MAX_PER_WINDOW;
  const { value: ip, trusted: hasTrustedIp } = getIp(req);
  const modelAnonymousBucketId = isModelDetailApi && !hasTrustedIp
    ? getAnonymousBucketId(req, null)
    : null;
  const modelSession = modelAnonymousBucketId
    ? getRateLimitSession(req, modelAnonymousBucketId)
    : null;
  const bucketPath = normalizeRateLimitPath(pathname);
  const ipBucket = ip ?? "unknown";
  const now = Date.now();
  maybePruneExpiredBuckets(now);
  const contactIp = hasTrustedIp ? ip : null;
  const contactSession = isContactApi

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…