mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-06-26 18:59:25 +02:00
Update:Encode & embed metadata API endpoints, separate cache & search endpoints into controllers
This commit is contained in:
parent
cd92a22f4d
commit
e3ba739db5
8 changed files with 183 additions and 136 deletions
26
server/controllers/CacheController.js
Normal file
26
server/controllers/CacheController.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const Logger = require('../Logger')
|
||||
|
||||
class CacheController {
|
||||
constructor() { }
|
||||
|
||||
// POST: api/cache/purge
|
||||
async purgeCache(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
Logger.info(`[MiscController] Purging all cache`)
|
||||
await this.cacheManager.purgeAll()
|
||||
res.sendStatus(200)
|
||||
}
|
||||
|
||||
// POST: api/cache/items/purge
|
||||
async purgeItemsCache(req, res) {
|
||||
if (!req.user.isAdminOrUp) {
|
||||
return res.sendStatus(403)
|
||||
}
|
||||
Logger.info(`[MiscController] Purging items cache`)
|
||||
await this.cacheManager.purgeItems()
|
||||
res.sendStatus(200)
|
||||
}
|
||||
}
|
||||
module.exports = new CacheController()
|
Loading…
Add table
Add a link
Reference in a new issue