lets try this

This commit is contained in:
Evert Prants 2019-05-13 14:54:37 +03:00
parent 1b250435bb
commit 110cdd171e
Signed by: evert
GPG Key ID: 1688DA83D222D0B5

View File

@ -46,6 +46,7 @@ async function init () {
}) })
router.post('/publish', async (req, res, next) => { router.post('/publish', async (req, res, next) => {
let ip = req.ip
let token = req.header('token') || req.body.token let token = req.header('token') || req.body.token
if (!token || !config.tokens[token]) return res.status(402).send('Forbidden') if (!token || !config.tokens[token]) return res.status(402).send('Forbidden')
@ -63,14 +64,6 @@ async function init () {
if (!allFiles.length) return res.status(400).send('Invalid request') if (!allFiles.length) return res.status(400).send('Invalid request')
// Determine real IP address
let ip
if (req.header('x-forwarded-for')) {
ip = req.header('x-forwarded-for')
} else {
ip = req.connection.remoteAddress
}
console.log('[%s] from %s request to upload %d file(s)', new Date(), ip, allFiles.length) console.log('[%s] from %s request to upload %d file(s)', new Date(), ip, allFiles.length)
// Handle all files provided // Handle all files provided