mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 13:39:41 +00:00
Merge 09ab781cd5 into 1d0b7e383a
This commit is contained in:
commit
ecac07d7d8
9 changed files with 319 additions and 2 deletions
|
|
@ -771,5 +771,32 @@ class MiscController {
|
|||
currentDailyLogs: Logger.logManager.getMostRecentCurrentDailyLogs()
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* GET: /api/test-proxy-header
|
||||
* Test proxy header endpoint
|
||||
*
|
||||
* @param {RequestWithUser} req
|
||||
* @param {Response} res
|
||||
*/
|
||||
testProxyHeader(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
Logger.error(`[MiscController] Non-admin user "${req.user.username}" attempted to test proxy header`)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
const headerName = req.query.headerName
|
||||
if (!headerName) {
|
||||
return res.status(400).json({ message: 'Header name is required' })
|
||||
}
|
||||
|
||||
const headerValue = req.headers[headerName.toLowerCase()]
|
||||
|
||||
res.json({
|
||||
headerFound: !!headerValue,
|
||||
headerValue: headerValue || null,
|
||||
headerName: headerName
|
||||
})
|
||||
}
|
||||
}
|
||||
module.exports = new MiscController()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue