mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
add basic rate limiting
This commit is contained in:
@ -2,6 +2,7 @@ const express = require('express')
|
||||
const bodyParser = require('body-parser')
|
||||
const path = require('path')
|
||||
const favicon = require('serve-favicon')
|
||||
const rateLimit = require('express-rate-limit')
|
||||
|
||||
const crawl = require('./crawler')
|
||||
const parseHTML = require('./parser')
|
||||
@ -30,18 +31,13 @@ app.get('/error', (req, res) => {
|
||||
.render('error', { error })
|
||||
})
|
||||
|
||||
app.get('/download', (req, res) => {
|
||||
res
|
||||
.status(200)
|
||||
.render('download')
|
||||
})
|
||||
|
||||
// NOTE: Capture all unkown URLs
|
||||
app.get('*', (req, res) => {
|
||||
res.status(400).render('404')
|
||||
})
|
||||
|
||||
app.use('/download', checkFBURL)
|
||||
app.use('/download', rateLimit())
|
||||
app.post('/download', async (req, res) => {
|
||||
const { url } = req.body
|
||||
|
||||
|
Reference in New Issue
Block a user