mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-26 18:59:25 +02:00
Clean up ApiRouter adding MiscController, move upload and scan to api endpoints
This commit is contained in:
parent
69fcb103e4
commit
57399bb79e
14 changed files with 299 additions and 270 deletions
|
@ -487,6 +487,20 @@ class LibraryController {
|
|||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
// GET: api/scan (Root)
|
||||
async scan(req, res) {
|
||||
if (!req.user.isRoot) {
|
||||
Logger.error(`[LibraryController] Non-root user attempted to scan library`, req.user)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
var options = {
|
||||
forceRescan: req.query.force == 1
|
||||
}
|
||||
res.sendStatus(200)
|
||||
await this.scanner.scan(req.library, options)
|
||||
Logger.info('[LibraryController] Scan complete')
|
||||
}
|
||||
|
||||
middleware(req, res, next) {
|
||||
var librariesAccessible = req.user.librariesAccessible || []
|
||||
if (librariesAccessible && librariesAccessible.length && !librariesAccessible.includes(req.params.id)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue