mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-24 09:49:24 +02:00
Update:API status codes and default provider for findCovers route
This commit is contained in:
parent
357a63a4d9
commit
70d887bada
2 changed files with 14 additions and 7 deletions
|
@ -11,20 +11,20 @@ class PodcastController {
|
|||
async create(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
Logger.error(`[PodcastController] Non-admin user attempted to create podcast`, req.user)
|
||||
return res.sendStatus(500)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
const payload = req.body
|
||||
|
||||
const library = this.db.libraries.find(lib => lib.id === payload.libraryId)
|
||||
if (!library) {
|
||||
Logger.error(`[PodcastController] Create: Library not found "${payload.libraryId}"`)
|
||||
return res.status(400).send('Library not found')
|
||||
return res.status(404).send('Library not found')
|
||||
}
|
||||
|
||||
const folder = library.folders.find(fold => fold.id === payload.folderId)
|
||||
if (!folder) {
|
||||
Logger.error(`[PodcastController] Create: Folder not found "${payload.folderId}"`)
|
||||
return res.status(400).send('Folder not found')
|
||||
return res.status(404).send('Folder not found')
|
||||
}
|
||||
|
||||
var podcastPath = payload.path.replace(/\\/g, '/')
|
||||
|
@ -115,7 +115,7 @@ class PodcastController {
|
|||
async checkNewEpisodes(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
Logger.error(`[PodcastController] Non-admin user attempted to check/download episodes`, req.user)
|
||||
return res.sendStatus(500)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
var libraryItem = req.libraryItem
|
||||
|
@ -135,7 +135,7 @@ class PodcastController {
|
|||
clearEpisodeDownloadQueue(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
Logger.error(`[PodcastController] Non-admin user attempting to clear download queue "${req.user.username}"`)
|
||||
return res.sendStatus(500)
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
this.podcastManager.clearDownloadQueue(req.params.id)
|
||||
res.sendStatus(200)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue