This commit is contained in:
KernelDeimos
2024-04-24 16:16:31 -04:00
parent b2e72adba9
commit 74e9270d58
2 changed files with 6 additions and 1 deletions

View File

@@ -46,6 +46,11 @@ router.post('/contactUs', auth, express.json(), async (req, res, next)=>{
else if(req.body.message.length > 100000)
return res.status(400).send({message: 'message is too long'})
const svc_edgeRateLimit = req.services.get('edge-rate-limit');
if ( ! svc_edgeRateLimit.check('contact-us') ) {
return res.status(429).send('Too many requests.');
}
// modules
const db = req.services.get('database').get(DB_WRITE, 'feedback');

View File

@@ -15,7 +15,7 @@ class EdgeRateLimitService extends BaseService {
limit: 10,
window: 15 * MINUTE,
},
['contactUs']: {
['contact-us']: {
limit: 10,
window: 15 * MINUTE,
},