mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-28 21:19:42 +00:00
fix: missing function
This commit is contained in:
parent
96c5a51eac
commit
09ab781cd5
1 changed files with 27 additions and 0 deletions
|
|
@ -768,5 +768,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