lets try this
This commit is contained in:
parent
1b250435bb
commit
110cdd171e
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user