mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
Download log update
This commit is contained in:
parent
ef2d736b20
commit
b55d8250cc
@ -109,13 +109,12 @@ class LibraryItemController {
|
|||||||
* @param {import('express').Response} res
|
* @param {import('express').Response} res
|
||||||
*/
|
*/
|
||||||
download(req, res) {
|
download(req, res) {
|
||||||
const libraryItemPath = req.libraryItem.path
|
|
||||||
const itemTitle = req.libraryItem.media.metadata.title
|
|
||||||
|
|
||||||
if (!req.user.canDownload) {
|
if (!req.user.canDownload) {
|
||||||
Logger.warn('User attempted to download without permission', req.user)
|
Logger.warn('User attempted to download without permission', req.user)
|
||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
|
const libraryItemPath = req.libraryItem.path
|
||||||
|
const itemTitle = req.libraryItem.media.metadata.title
|
||||||
|
|
||||||
// If library item is a single file in root dir then no need to zip
|
// If library item is a single file in root dir then no need to zip
|
||||||
if (req.libraryItem.isFile) {
|
if (req.libraryItem.isFile) {
|
||||||
@ -125,7 +124,7 @@ class LibraryItemController {
|
|||||||
res.setHeader('Content-Type', audioMimeType)
|
res.setHeader('Content-Type', audioMimeType)
|
||||||
}
|
}
|
||||||
Logger.info(`[LibraryItemController] User "${req.user.username}" requested download for item "${itemTitle}" at "${libraryItemPath}"`)
|
Logger.info(`[LibraryItemController] User "${req.user.username}" requested download for item "${itemTitle}" at "${libraryItemPath}"`)
|
||||||
res.download(req.libraryItem.path, req.libraryItem.relPath)
|
res.download(libraryItemPath, req.libraryItem.relPath)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -716,7 +715,7 @@ class LibraryItemController {
|
|||||||
return res.sendStatus(403)
|
return res.sendStatus(403)
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.info(`[LibraryItemController] User "${req.user.username}" requested download for item "${req.libraryItem.media.metadata.title}" at "${libraryFile.metadata.path}"`)
|
Logger.info(`[LibraryItemController] User "${req.user.username}" requested download for item "${req.libraryItem.media.metadata.title}" file at "${libraryFile.metadata.path}"`)
|
||||||
|
|
||||||
if (global.XAccel) {
|
if (global.XAccel) {
|
||||||
const encodedURI = encodeUriPath(global.XAccel + libraryFile.metadata.path)
|
const encodedURI = encodeUriPath(global.XAccel + libraryFile.metadata.path)
|
||||||
|
Loading…
Reference in New Issue
Block a user