Spaces:
Runtime error
Runtime error
rate limiting
Browse files- 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 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
|
36 |
-
|
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" });
|