video-optimizer-bot / src /security /abuseProtection.js
Hugging Face Deployer
Deploy bot to Hugging Face Spaces
03b405b
Raw History Blame Contribute Delete
351 Bytes
const { allowRate } = require("./rateLimit");
const { AppError } = require("../utils/errors");
function assertUserCanCreateJob(userId) {
if (!allowRate(`jobs:${userId}`, 12, 60 * 60 * 1000)) {
throw new AppError("Rate limit reached. Please wait before sending more videos.", "RATE_LIMITED");
}
}
module.exports = { assertUserCanCreateJob };