CoolFace
Apppublic

Trkaga/SaaS.ai.replit.v.II

sourceHugging Faceupdated 6mo agoView on Hugging Face
0likes
middleware.js18 linesDownload Raw Back to root
1import fs from "fs";2 3export function checkLimit(userEmail) {4  const db = JSON.parse(fs.readFileSync("./db.json"));5 6  const user = db.users.find(u => u.email === userEmail);7 8  if (!user) return false;9 10  if (user.runsLeft <= 0 && user.plan === "free") {11    return { error: "Limit doldu. Pro'ya geç 🚀" };12  }13 14  user.runsLeft -= 1;15  fs.writeFileSync("./db.json", JSON.stringify(db, null, 2));16 17  return { ok: true };18}