enzostvs HF Staff commited on
Commit
538551c
·
1 Parent(s): 1563afa

rate limiting

Browse files
Files changed (1) hide show
  1. app/api/route.ts +11 -11
app/api/route.ts CHANGED
@@ -23,18 +23,18 @@ export async function POST(
23
 
24
  const ip_address = headers.get("x-forwarded-for") ?? request.ip
25
 
26
- if (!headers.get('Authorization')) {
27
- const count = await prisma.collection.count({
28
- where: {
29
- ip_address,
30
- // createdAt: {
31
- // gte: new Date(Date.now() - 24 * 60 * 60 * 1000)
32
- // }
33
- }
34
- })
35
 
36
- if (count > 5) return Response.json({ status: 429, ok: false, message: "You have reached the limit of 5 images per day." });
37
- }
38
 
39
  const textIsNSFW = await isTextNSFW(inputs, global_headers)
40
  if (textIsNSFW) return Response.json({ status: 401, ok: false, message: "Prompt doesn’t work, try another prompt" });
 
23
 
24
  const ip_address = headers.get("x-forwarded-for") ?? request.ip
25
 
26
+ // if (!headers.get('Authorization')) {
27
+ // const count = await prisma.collection.count({
28
+ // where: {
29
+ // ip_address,
30
+ // createdAt: {
31
+ // gte: new Date(Date.now() - 24 * 60 * 60 * 1000)
32
+ // }
33
+ // }
34
+ // })
35
 
36
+ // if (count > 5) return Response.json({ status: 429, ok: false, message: "You have reached the limit of 5 images per day." });
37
+ // }
38
 
39
  const textIsNSFW = await isTextNSFW(inputs, global_headers)
40
  if (textIsNSFW) return Response.json({ status: 401, ok: false, message: "Prompt doesn’t work, try another prompt" });