mirror of
https://github.com/comatory/fb2iCal
synced 2025-06-05 22:09:25 +02:00
allow passing FB event number as parameter
This commit is contained in:
@ -7,7 +7,7 @@ const rateLimit = require('express-rate-limit')
|
||||
const crawl = require('./crawler')
|
||||
const parseHTML = require('./parser')
|
||||
const generateICS = require('./ics')
|
||||
const { genericErrorHandler, checkFBURL } = require('./middlewares')
|
||||
const { genericErrorHandler, checkURLParameter } = require('./middlewares')
|
||||
|
||||
const port = process.env.PORT
|
||||
const app = express()
|
||||
@ -36,9 +36,9 @@ app.get('*', (req, res) => {
|
||||
res.status(400).render('404')
|
||||
})
|
||||
|
||||
app.use('/download', checkFBURL)
|
||||
app.use('/download', checkURLParameter)
|
||||
app.use('/download', rateLimit())
|
||||
app.post('/download', async (req, res) => {
|
||||
app.post('/download', async (req, res, next) => {
|
||||
const { url } = req.body
|
||||
|
||||
try {
|
||||
@ -52,7 +52,8 @@ app.post('/download', async (req, res) => {
|
||||
.send(200, new Buffer(ics, 'utf8'))
|
||||
}
|
||||
} catch (err) {
|
||||
return next(err)
|
||||
next(err)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user