mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-08-07 19:54:57 +02:00
Fix RSS feeds to use slug instead of id
This commit is contained in:
parent
a0bc959850
commit
b5d4c11f6f
4 changed files with 37 additions and 54 deletions
|
@ -30,7 +30,7 @@ class RSSFeedController {
|
|||
}
|
||||
|
||||
// Check that this slug is not being used for another feed (slug will also be the Feed id)
|
||||
if (this.rssFeedManager.feeds[options.slug]) {
|
||||
if (this.rssFeedManager.findFeedBySlug(options.slug)) {
|
||||
Logger.error(`[RSSFeedController] Cannot open RSS feed because slug "${options.slug}" is already in use`)
|
||||
return res.status(400).send('Slug already in use')
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ class RSSFeedController {
|
|||
}
|
||||
|
||||
// Check that this slug is not being used for another feed (slug will also be the Feed id)
|
||||
if (this.rssFeedManager.feeds[options.slug]) {
|
||||
if (this.rssFeedManager.findFeedBySlug(options.slug)) {
|
||||
Logger.error(`[RSSFeedController] Cannot open RSS feed because slug "${options.slug}" is already in use`)
|
||||
return res.status(400).send('Slug already in use')
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ class RSSFeedController {
|
|||
}
|
||||
|
||||
// Check that this slug is not being used for another feed (slug will also be the Feed id)
|
||||
if (this.rssFeedManager.feeds[options.slug]) {
|
||||
if (this.rssFeedManager.findFeedBySlug(options.slug)) {
|
||||
Logger.error(`[RSSFeedController] Cannot open RSS feed because slug "${options.slug}" is already in use`)
|
||||
return res.status(400).send('Slug already in use')
|
||||
}
|
||||
|
@ -111,10 +111,8 @@ class RSSFeedController {
|
|||
}
|
||||
|
||||
// POST: api/feeds/:id/close
|
||||
async closeRSSFeed(req, res) {
|
||||
await this.rssFeedManager.closeRssFeed(req.params.id)
|
||||
|
||||
res.sendStatus(200)
|
||||
closeRSSFeed(req, res) {
|
||||
this.rssFeedManager.closeRssFeed(req, res)
|
||||
}
|
||||
|
||||
middleware(req, res, next) {
|
||||
|
@ -123,14 +121,6 @@ class RSSFeedController {
|
|||
return res.sendStatus(403)
|
||||
}
|
||||
|
||||
if (req.params.id) {
|
||||
const feed = this.rssFeedManager.findFeed(req.params.id)
|
||||
if (!feed) {
|
||||
Logger.error(`[RSSFeedController] RSS feed not found with id "${req.params.id}"`)
|
||||
return res.sendStatus(404)
|
||||
}
|
||||
}
|
||||
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue